org.jboss.remoting
Class ConnectionValidator

java.lang.Object
  extended by java.util.TimerTask
      extended by org.jboss.remoting.ConnectionValidator
All Implemented Interfaces:
java.lang.Runnable, StoppableTimerTask

public class ConnectionValidator
extends java.util.TimerTask
implements StoppableTimerTask

Author:
Tom Elrod, Ovidiu Feodorov

Field Summary
static long DEFAULT_PING_PERIOD
          Default ping period.
 
Constructor Summary
ConnectionValidator(Client client)
           
ConnectionValidator(Client client, long pingPeriod)
           
 
Method Summary
 void addConnectionListener(ConnectionListener listener)
           
 boolean cancel()
           
static boolean checkConnection(InvokerLocator locator, java.util.Map config)
          Will make $PING$ invocation on server.
 long getPingPeriod()
           
 boolean removeConnectionListener(ConnectionListener listener)
           
 void run()
          The action to be performed by this timer task.
 void stop()
          stop() will be called when TimerUtil.unschedule() or when TimerUtil.destroy() are called.
 java.lang.String toString()
           
 
Methods inherited from class java.util.TimerTask
scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PING_PERIOD

public static final long DEFAULT_PING_PERIOD
Default ping period. Value is 2 seconds.

See Also:
Constant Field Values
Constructor Detail

ConnectionValidator

public ConnectionValidator(Client client)

ConnectionValidator

public ConnectionValidator(Client client,
                           long pingPeriod)
Method Detail

checkConnection

public static boolean checkConnection(InvokerLocator locator,
                                      java.util.Map config)
                               throws java.lang.Throwable
Will make $PING$ invocation on server. If sucessful, will return true. Otherwise, will throw an exception.

Parameters:
locator - - locator for the server to ping
config - - any configuration needed for server
Returns:
true if alive, false if not
Throws:
java.lang.Throwable

stop

public void stop()
Description copied from interface: StoppableTimerTask
stop() will be called when TimerUtil.unschedule() or when TimerUtil.destroy() are called.

Specified by:
stop in interface StoppableTimerTask

run

public void run()
The action to be performed by this timer task.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

cancel

public boolean cancel()
Overrides:
cancel in class java.util.TimerTask

addConnectionListener

public void addConnectionListener(ConnectionListener listener)

removeConnectionListener

public boolean removeConnectionListener(ConnectionListener listener)

getPingPeriod

public long getPingPeriod()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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