xmlBlaster 2.2.0 API

org.xmlBlaster.engine
Class AvailabilityChecker

java.lang.Object
  extended by org.xmlBlaster.engine.AvailabilityChecker
All Implemented Interfaces:
java.util.EventListener, I_RunlevelListener

public final class AvailabilityChecker
extends java.lang.Object
implements I_RunlevelListener

This checks depending on the run level to accept or deny messages from outside.

Author:
Marcel Ruff

Field Summary
private  ServerScope glob
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  RunlevelManager runlevelManager
           
private  boolean startup
           
 
Constructor Summary
AvailabilityChecker(ServerScope glob)
          Ctor
 
Method Summary
 XmlBlasterException checkException(MethodName action, java.lang.Throwable origEx)
          Checks the given exception and depending on the current run level it is converted into a communication exception (with the original embedded).
 void checkServerIsReady(SessionName sessionName, AddressServer addressServer, MsgUnit msgUnit, MethodName action)
          The extended check when the message is imported/decrypted.
 java.lang.String getName()
          A human readable name of the listener for logging.
 java.lang.String getStatus(java.lang.String qos)
          Returns the stringified availability status.
 void runlevelChange(int from, int to, boolean force)
          Invoked on run level change, see RunlevelManager.RUNLEVEL_HALTED and RunlevelManager.RUNLEVEL_RUNNING

Enforced by I_RunlevelListener

 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private java.lang.String ME

glob

private final ServerScope glob

log

private static java.util.logging.Logger log

runlevelManager

private RunlevelManager runlevelManager

startup

private boolean startup
Constructor Detail

AvailabilityChecker

public AvailabilityChecker(ServerScope glob)
Ctor

Parameters:
glob -
Method Detail

shutdown

public void shutdown()

getStatus

public java.lang.String getStatus(java.lang.String qos)
Returns the stringified availability status.

Parameters:
qos - Currently ignored
Returns:
"OK" if we are ready for client invocations, else the run level string, id's are for example "RUNLEVEL_CLEANUP", "RUNLEVEL_STANDBY", "RUNLEVEL_HALTED".
See Also:
org.xmlBlaster.protocol.I_XmlBlaster#ping(String)

checkServerIsReady

public void checkServerIsReady(SessionName sessionName,
                               AddressServer addressServer,
                               MsgUnit msgUnit,
                               MethodName action)
                        throws XmlBlasterException
The extended check when the message is imported/decrypted.

Parameters:
sessionName - The client, null is OK
msgUnit - The decrypted (readable) message received, null is OK
action - The method name for logging, never null!
Throws:
XmlBlasterException: - If the server is not in a run level to accept messages it throws ErrorCode.COMMUNICATION_NOCONNECTION_SERVERDENY
XmlBlasterException

checkException

public XmlBlasterException checkException(MethodName action,
                                          java.lang.Throwable origEx)
Checks the given exception and depending on the current run level it is converted into a communication exception (with the original embedded). This case usually happens if a long publishArr() is processed and the server is simultaneously shutdown. The publishArr() is failing and will be reported to the client as a communication exception.

Parameters:
action - The method name for logging
origEx - The internal cause during shutdown
Returns:
XmlBlasterException With the probably corrected exception errorCode or the origEx If the server is not in a run level to accept messages it throws ErrorCode.COMMUNICATION_NOCONNECTION_SERVERDENY

getName

public java.lang.String getName()
A human readable name of the listener for logging.

Enforced by I_RunlevelListener

Specified by:
getName in interface I_RunlevelListener

runlevelChange

public void runlevelChange(int from,
                           int to,
                           boolean force)
                    throws XmlBlasterException
Invoked on run level change, see RunlevelManager.RUNLEVEL_HALTED and RunlevelManager.RUNLEVEL_RUNNING

Enforced by I_RunlevelListener

Specified by:
runlevelChange in interface I_RunlevelListener
Parameters:
from - The current runlevel
to - The runlevel we want to switch to
force - If true force the change even if messages are lost
Throws:
XmlBlasterException

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.