ch.elca.el4j.services.remoting.protocol.loadbalancing.policy
Class AbstractPolicy

java.lang.Object
  extended by ch.elca.el4j.services.remoting.protocol.loadbalancing.policy.AbstractPolicy
Direct Known Subclasses:
RandomPolicy, RedirectUponFailurePolicy, RoundRobinPolicy

public abstract class AbstractPolicy
extends Object

Abstract class that defines the policy of the protocol selection. Protocol comparison must be done using "=="!

Author:
Stefan Pleisch (SPL)
File-location:
AbstractPolicy
Last check-in date:
2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) by swismer for revision 3873

Field Summary
protected  AbstractRemotingProtocol[] m_protocols
          Array of protocols, each represented by an array of Strings, using a [protocolTag, arg1, arg2, ...] representation.
 
Constructor Summary
AbstractPolicy()
           
 
Method Summary
abstract  AbstractRemotingProtocol getNextProtocol()
          Note that protocol comparison must be done using "=="!
 int getProtocolCount()
           
 void notifyFailure(AbstractRemotingProtocol protocol)
          This method is called if the use of one of the protocols has failed.
protected  void removeProtocol(AbstractRemotingProtocol protocol)
          Removes protocol 'pi' from m_protocols.
 void setProtocols(AbstractRemotingProtocol[] protocols)
          This method is called before any other method is called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_protocols

protected AbstractRemotingProtocol[] m_protocols
Array of protocols, each represented by an array of Strings, using a [protocolTag, arg1, arg2, ...] representation.

Constructor Detail

AbstractPolicy

public AbstractPolicy()
Method Detail

setProtocols

public void setProtocols(AbstractRemotingProtocol[] protocols)
This method is called before any other method is called. It passes the protocol information.

Parameters:
protocols - Array of currently defined protocols.

notifyFailure

public void notifyFailure(AbstractRemotingProtocol protocol)
This method is called if the use of one of the protocols has failed. Protocol comparison must be done using "=="!

Parameters:
protocol - The protocol that has lead to a failure.

getProtocolCount

public int getProtocolCount()
Returns:
Number of available protocols

getNextProtocol

public abstract AbstractRemotingProtocol getNextProtocol()
                                                  throws NoProtocolAvailableRTException
Note that protocol comparison must be done using "=="!

Returns:
The next protocol to be used.
Throws:
NoProtocolAvailableRTException - If no protocol is available any more

removeProtocol

protected void removeProtocol(AbstractRemotingProtocol protocol)
Removes protocol 'pi' from m_protocols. Does nothing if 'pi' does not exist.

Parameters:
protocol - Protocol to be removed.


Copyright © 2005-2011 ELCA. All Rights Reserved.