Package adams.scripting.connection
Class LoadBalancer
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Connection
,Serializable
,Comparable<Connection>
public class LoadBalancer extends AbstractMultiConnection
Balances the handling of commands among several connections.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_CurrentRequest
the current connection for requests.protected int
m_CurrentResponse
the current connection for responses.-
Fields inherited from class adams.scripting.connection.AbstractMultiConnection
m_Connections
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description LoadBalancer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
checkRequest(RemoteCommand cmd)
Hook method that checks the request command and setup for sending it.protected String
checkResponse(RemoteCommand cmd)
Hook method that checks the response command and setup for sending it.String
connectionsTipText()
Returns the tip text for this property.protected String
doSendRequest(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the request command.protected String
doSendResponse(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the response command.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.-
Methods inherited from class adams.scripting.connection.AbstractMultiConnection
addConnection, defineOptions, getConnections, removeConnection, setConnections
-
Methods inherited from class adams.scripting.connection.AbstractConnection
cleanUp, compareTo, equals, getQuickInfo, sendRequest, sendResponse, toString
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractMultiConnection
-
connectionsTipText
public String connectionsTipText()
Returns the tip text for this property.- Specified by:
connectionsTipText
in classAbstractMultiConnection
- Returns:
- tip text for this property suitable for displaying in the gui
-
checkRequest
protected String checkRequest(RemoteCommand cmd)
Hook method that checks the request command and setup for sending it.- Overrides:
checkRequest
in classAbstractConnection
- Parameters:
cmd
- the command to check- Returns:
- null if successful, otherwise error message
-
doSendRequest
protected String doSendRequest(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the request command.- Specified by:
doSendRequest
in classAbstractConnection
- Parameters:
cmd
- the command to sendprocessor
- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
checkResponse
protected String checkResponse(RemoteCommand cmd)
Hook method that checks the response command and setup for sending it.- Overrides:
checkResponse
in classAbstractConnection
- Parameters:
cmd
- the command to check- Returns:
- null if successful, otherwise error message
-
doSendResponse
protected String doSendResponse(RemoteCommand cmd, RemoteCommandProcessor processor)
Sends the response command.- Specified by:
doSendResponse
in classAbstractConnection
- Parameters:
cmd
- the command to sendprocessor
- the processor for formatting/parsing- Returns:
- null if successful, otherwise error message
-
-