org.jboss.remoting.samples.callback.statistics
Class CallbackServer.SampleInvocationHandler

java.lang.Object
  extended by org.jboss.remoting.samples.callback.statistics.CallbackServer.SampleInvocationHandler
All Implemented Interfaces:
java.lang.Runnable, CallbackListener, ServerInvocationHandler
Enclosing class:
CallbackServer

public static class CallbackServer.SampleInvocationHandler
extends java.lang.Object
implements ServerInvocationHandler, java.lang.Runnable, CallbackListener

Simple invocation handler implementation. When callback clients are registered, will generate callbacks periodically.


Constructor Summary
CallbackServer.SampleInvocationHandler()
           
 
Method Summary
 void acknowledgeCallback(InvokerCallbackHandler callbackHandler, java.lang.Object callbackId, java.lang.Object response)
           
 void addListener(InvokerCallbackHandler callbackHandler)
          Adds a callback handler that will listen for callbacks from the server invoker handler.
 java.lang.Object invoke(InvocationRequest invocation)
          Called by the remoting server to handle the invocation from client.
 void removeListener(InvokerCallbackHandler callbackHandler)
          Removes the callback handler that was listening for callbacks from the server invoker handler.
 void run()
          Will generate callback messages every second while shouldGenerateCallbacks flag is true.
 void setInvoker(ServerInvoker invoker)
          set the invoker that owns this handler
 void setMBeanServer(javax.management.MBeanServer server)
          set the mbean server that the handler can reference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.remoting.ServerInvocationHandler
toString
 

Constructor Detail

CallbackServer.SampleInvocationHandler

public CallbackServer.SampleInvocationHandler()
Method Detail

invoke

public java.lang.Object invoke(InvocationRequest invocation)
                        throws java.lang.Throwable
Called by the remoting server to handle the invocation from client.

Specified by:
invoke in interface ServerInvocationHandler
Returns:
Throws:
java.lang.Throwable

addListener

public void addListener(InvokerCallbackHandler callbackHandler)
Adds a callback handler that will listen for callbacks from the server invoker handler.

Specified by:
addListener in interface ServerInvocationHandler

removeListener

public void removeListener(InvokerCallbackHandler callbackHandler)
Removes the callback handler that was listening for callbacks from the server invoker handler.

Specified by:
removeListener in interface ServerInvocationHandler

run

public void run()
Will generate callback messages every second while shouldGenerateCallbacks flag is true.

Specified by:
run in interface java.lang.Runnable

setMBeanServer

public void setMBeanServer(javax.management.MBeanServer server)
Description copied from interface: ServerInvocationHandler
set the mbean server that the handler can reference

Specified by:
setMBeanServer in interface ServerInvocationHandler

setInvoker

public void setInvoker(ServerInvoker invoker)
Description copied from interface: ServerInvocationHandler
set the invoker that owns this handler

Specified by:
setInvoker in interface ServerInvocationHandler

acknowledgeCallback

public void acknowledgeCallback(InvokerCallbackHandler callbackHandler,
                                java.lang.Object callbackId,
                                java.lang.Object response)
Specified by:
acknowledgeCallback in interface CallbackListener
Parameters:
callbackHandler - InvokerCallbackHandler that handled this callback
callbackId - id of callback being acknowledged
response - either (1) response sent with acknowledgement or (2) null


Copyright � 1998-2005 JBoss Inc . All Rights Reserved.