org.jboss.remoting.callback
Class CallbackPoller

java.lang.Object
  extended by java.util.TimerTask
      extended by org.jboss.remoting.callback.CallbackPoller
All Implemented Interfaces:
java.lang.Runnable

public class CallbackPoller
extends java.util.TimerTask
implements java.lang.Runnable

CallbackPoller is used to simulate push callbacks on transports that don't support bidirectional connections. It will periodically pull callbacks from the server and pass them to the InvokerCallbackHandler.

Author:
Tom Elrod, Ron Sigal

Field Summary
static java.lang.String CALLBACK_POLL_PERIOD
          The key value to use to specify the desired poll period within the metadata Map.
static java.lang.String CALLBACK_SCHEDULE_MODE
          The key value to use in metadata Map to specify the desired scheduling mode.
static int DEFAULT_BLOCKING_TIMEOUT
          Default timeout for getting callbacks in blocking mode.
static int DEFAULT_MAX_ERROR_COUNT
          Default number of exceptions before callback polling wil be shut down.
static long DEFAULT_POLL_PERIOD
          Default polling period for getting callbacks from the server.
static java.lang.String MAX_ERROR_COUNT
          The key to use to specify the number of errors before callback polling will be shut down.
static java.lang.String REPORT_STATISTICS
          The key to use in metadata Map to request statistics.
static java.lang.String SCHEDULE_FIXED_DELAY
          Use java.util.timer.scheduleAtFixedRate().
static java.lang.String SCHEDULE_FIXED_RATE
          Use java.util.timer.schedule().
static java.lang.String SYNCHRONIZED_SHUTDOWN
          The key value to use to specify if stop() should wait for the call to org.jboss.remoting.Client.getCallbacks() should return.
 
Constructor Summary
CallbackPoller(Client client, InvokerCallbackHandler callbackhandler, java.util.Map metadata, java.lang.Object callbackHandlerObject)
           
 
Method Summary
 void run()
           
 void start()
           
 void stop()
           
 void stop(int timeout)
          stop() will not return until all received callbacks have been processed by the CallbackHandler and acknowledgements have been sent for all callbacks for which acknowledgements have been requested.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_POLL_PERIOD

public static final long DEFAULT_POLL_PERIOD
Default polling period for getting callbacks from the server. Default is 5000 milliseconds.

See Also:
Constant Field Values

DEFAULT_BLOCKING_TIMEOUT

public static final int DEFAULT_BLOCKING_TIMEOUT
Default timeout for getting callbacks in blocking mode. Default is 5000 milliseconds.

See Also:
Constant Field Values

DEFAULT_MAX_ERROR_COUNT

public static final int DEFAULT_MAX_ERROR_COUNT
Default number of exceptions before callback polling wil be shut down. Default is 5.

See Also:
Constant Field Values

SYNCHRONIZED_SHUTDOWN

public static final java.lang.String SYNCHRONIZED_SHUTDOWN
The key value to use to specify if stop() should wait for the call to org.jboss.remoting.Client.getCallbacks() should return. The default behavior is do a synchronized shutdown for nonblocking callbacks and a nonsynchronized shutdown for blocking callbacks.

See Also:
Constant Field Values

CALLBACK_POLL_PERIOD

public static final java.lang.String CALLBACK_POLL_PERIOD
The key value to use to specify the desired poll period within the metadata Map.

See Also:
Constant Field Values

SCHEDULE_FIXED_RATE

public static final java.lang.String SCHEDULE_FIXED_RATE
Use java.util.timer.schedule().

See Also:
Constant Field Values

SCHEDULE_FIXED_DELAY

public static final java.lang.String SCHEDULE_FIXED_DELAY
Use java.util.timer.scheduleAtFixedRate().

See Also:
Constant Field Values

MAX_ERROR_COUNT

public static final java.lang.String MAX_ERROR_COUNT
The key to use to specify the number of errors before callback polling will be shut down.

See Also:
Constant Field Values

REPORT_STATISTICS

public static final java.lang.String REPORT_STATISTICS
The key to use in metadata Map to request statistics. The associated is ignored.

See Also:
Constant Field Values

CALLBACK_SCHEDULE_MODE

public static final java.lang.String CALLBACK_SCHEDULE_MODE
The key value to use in metadata Map to specify the desired scheduling mode.

See Also:
Constant Field Values
Constructor Detail

CallbackPoller

public CallbackPoller(Client client,
                      InvokerCallbackHandler callbackhandler,
                      java.util.Map metadata,
                      java.lang.Object callbackHandlerObject)
Method Detail

start

public void start()
           throws java.lang.Exception
Throws:
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

stop

public void stop()

stop

public void stop(int timeout)
stop() will not return until all received callbacks have been processed by the CallbackHandler and acknowledgements have been sent for all callbacks for which acknowledgements have been requested.



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