1 package org.sapia.ubik.rmi.examples.interceptor; 2 3 import org.sapia.ubik.rmi.interceptor.Interceptor; 4 import org.sapia.ubik.rmi.server.Hub; 5 import org.sapia.ubik.rmi.server.invocation.ServerPreInvokeEvent; 6 7 8 16 public class HitCountInterceptor implements Interceptor { 17 private int _count; 18 19 public synchronized void onServerPreInvokeEvent(ServerPreInvokeEvent evt) { 20 _count++; 21 } 22 23 public synchronized int getCount() { 24 return _count; 25 } 26 27 public static void main(String [] args) { 28 Hub.serverRuntime.dispatcher.addInterceptor(ServerPreInvokeEvent.class, 29 new HitCountInterceptor()); 30 } 31 } 32 | Popular Tags |