org.apache.axis2.transport.http.server
Class DefaultConnectionListenerFailureHandler

java.lang.Object
  extended by org.apache.axis2.transport.http.server.DefaultConnectionListenerFailureHandler
All Implemented Interfaces:
ConnectionListenerFailureHandler

public class DefaultConnectionListenerFailureHandler
extends Object
implements ConnectionListenerFailureHandler

Default hander for failures in connection listener IOProcessors. Supports configuration of number retries, delay per retry, and uptime interval considered a success (resets number retries to zero).


Field Summary
protected  int maxRetries
           
protected  int retryDelay
           
protected  int successInterval
           
 
Constructor Summary
DefaultConnectionListenerFailureHandler()
          Create a new DefaultConnectionListenerFailureHandler with default settings.
DefaultConnectionListenerFailureHandler(int retryDelay, int successInterval, int maxRetries)
          Create a new DefaultConnectionListenerFailureHandler
 
Method Summary
 boolean failed(IOProcessor connectionListener, Throwable cause)
          Default behavior is to log a warning and attempt retry per constructor config, eventually failing with a logged error and notification.
 void notifyAbnormalTermination(IOProcessor connectionListener, String message, Throwable cause)
          Default bevarior is to log the error.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

retryDelay

protected int retryDelay

successInterval

protected int successInterval

maxRetries

protected int maxRetries
Constructor Detail

DefaultConnectionListenerFailureHandler

public DefaultConnectionListenerFailureHandler()
Create a new DefaultConnectionListenerFailureHandler with default settings. retryDelay is 1 second, successInterval is 60 seconds, maxRetries is 10


DefaultConnectionListenerFailureHandler

public DefaultConnectionListenerFailureHandler(int retryDelay,
                                               int successInterval,
                                               int maxRetries)
Create a new DefaultConnectionListenerFailureHandler

Parameters:
retryDelay - millis to wait before retrying
successInterval - millis after which an initial or retry attempt will be deemed a success, resetting retry count to 0
maxRetries - maximum number of retries allowed without a success, after which the listener will terminate
Method Detail

failed

public boolean failed(IOProcessor connectionListener,
                      Throwable cause)
Default behavior is to log a warning and attempt retry per constructor config, eventually failing with a logged error and notification. May subclass and override this method to change the behavior.

Specified by:
failed in interface ConnectionListenerFailureHandler
Parameters:
connectionListener - the associated connection listener
cause - cause of failure
Returns:
true if the listener should attempt to re-establish itself, false if it should terminate.

notifyAbnormalTermination

public void notifyAbnormalTermination(IOProcessor connectionListener,
                                      String message,
                                      Throwable cause)
Default bevarior is to log the error. May subclass and override this method to change behavior.

Specified by:
notifyAbnormalTermination in interface ConnectionListenerFailureHandler
Parameters:
connectionListener - the associated connection listener
message - explanation of termination
cause - last exception that is causing termination


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.