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, Trustin Lee

Field Summary
static java.lang.String DEFAULT_NUMBER_OF_PING_RETRIES
          Default number of ping retries.
static long DEFAULT_PING_PERIOD
          Default ping period.
static java.lang.String DEFAULT_PING_TIMEOUT
          Default ping timeout period.
static int DEFAULT_PING_TIMEOUT_INT
          Default ping timeout period.
static java.lang.String FAILURE_DISCONNECT_TIMEOUT
          Key to determine value of disconnectTimeout upon connection failure.
static java.lang.String STOP_LEASE_ON_FAILURE
          Key to determine whether to stop ConnectionValidator when PING fails.
static java.lang.String TIE_TO_LEASE
          Key to determine if ConnectionValidator should tie failure to presence of active lease on server side.
static java.lang.String VALIDATOR_PING_PERIOD
          Configuration map key for ping period.
static java.lang.String VALIDATOR_PING_TIMEOUT
          Configuration map key for ping timeout.
 
Constructor Summary
ConnectionValidator(Client client)
           
ConnectionValidator(Client client, long pingPeriod)
           
ConnectionValidator(Client client, java.util.Map metadata)
           
 
Method Summary
 boolean addConnectionListener(Client client, ConnectionListener listener)
           
 boolean cancel()
           
static boolean checkConnection(InvokerLocator locator, java.util.Map config)
          Will make $PING$ invocation on server.
 long getPingPeriod()
           
 boolean isStopped()
           
 boolean removeConnectionListener(Client client, 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

VALIDATOR_PING_PERIOD

public static final java.lang.String VALIDATOR_PING_PERIOD
Configuration map key for ping period.

See Also:
Constant Field Values

DEFAULT_PING_PERIOD

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

See Also:
Constant Field Values

VALIDATOR_PING_TIMEOUT

public static final java.lang.String VALIDATOR_PING_TIMEOUT
Configuration map key for ping timeout.

See Also:
Constant Field Values

DEFAULT_PING_TIMEOUT

public static final java.lang.String DEFAULT_PING_TIMEOUT
Default ping timeout period. Value is 1 second.

See Also:
Constant Field Values

DEFAULT_PING_TIMEOUT_INT

public static final int DEFAULT_PING_TIMEOUT_INT
Default ping timeout period. Value is 1 second.

See Also:
Constant Field Values

DEFAULT_NUMBER_OF_PING_RETRIES

public static final java.lang.String DEFAULT_NUMBER_OF_PING_RETRIES
Default number of ping retries. Value is 1. Currently implemented only on socket transport family.

See Also:
Constant Field Values

TIE_TO_LEASE

public static final java.lang.String TIE_TO_LEASE
Key to determine if ConnectionValidator should tie failure to presence of active lease on server side. Default value is "true".

See Also:
Constant Field Values

STOP_LEASE_ON_FAILURE

public static final java.lang.String STOP_LEASE_ON_FAILURE
Key to determine whether to stop ConnectionValidator when PING fails. Default value is "true".

See Also:
Constant Field Values

FAILURE_DISCONNECT_TIMEOUT

public static final java.lang.String FAILURE_DISCONNECT_TIMEOUT
Key to determine value of disconnectTimeout upon connection failure.

See Also:
Constant Field Values
Constructor Detail

ConnectionValidator

public ConnectionValidator(Client client)

ConnectionValidator

public ConnectionValidator(Client client,
                           long pingPeriod)

ConnectionValidator

public ConnectionValidator(Client client,
                           java.util.Map metadata)
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 boolean addConnectionListener(Client client,
                                     ConnectionListener listener)

removeConnectionListener

public boolean removeConnectionListener(Client client,
                                        ConnectionListener listener)

getPingPeriod

public long getPingPeriod()

toString

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

isStopped

public boolean isStopped()


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