fr.dyade.aaa.agent
Class PoolNetwork

java.lang.Object
  extended by fr.dyade.aaa.agent.Network
      extended by fr.dyade.aaa.agent.StreamNetwork
          extended by fr.dyade.aaa.agent.PoolNetwork
All Implemented Interfaces:
MessageConsumer, NetworkMBean, PoolNetworkMBean
Direct Known Subclasses:
SSLNetwork

public class PoolNetwork
extends StreamNetwork
implements PoolNetworkMBean

PoolNetwork is an implementation of StreamNetwork class that manages multiple connection in a pool paradigm way.


Field Summary
static byte[] magic
          Magic number to identify peer.
 
Fields inherited from class fr.dyade.aaa.agent.Network
bootTSFN, domain, idxLS, logmon, name, nbMessageIn, nbMessageOut, port, qout, servers, serversFN, sid
 
Constructor Summary
PoolNetwork()
          Creates a new network component.
 
Method Summary
 void addServer(short id)
          Adds the server sid in the network configuration.
 void delServer(short id)
          Removes the server sid in the network configuration.
 boolean getCompressedFlows()
          Returns if the stream between servers are compressed or not.
 long getIdleTimeout()
          Returns the maximum idle period permitted before reseting the connection.
 int getNbActiveSession()
          Returns the number of currently connected sessions.
 int getNbMaxActiveSession()
          Returns the maximum number of concurrent connected sessions.
 int getNbWaitingMessages()
          Gets the number of waiting messages in this engine.
 void init(java.lang.String name, int port, short[] servers)
          Initializes a new network component.
 boolean isRunning()
          Tests if the network component is alive.
 void setIdleTimeout(long idleTimeout)
          Sets the maximum idle period permitted before reseting the connection.
 void setProperties()
          Set the properties of the network.
 void start()
          Causes this network component to begin execution.
 void stop()
          Forces the network component to stop executing.
 java.lang.String toString()
          Returns a string representation of this consumer, including the daemon's name and status.
 void wakeup()
          Wakes up the watch-dog thread.
 
Methods inherited from class fr.dyade.aaa.agent.Network
delete, deliver, getAverageLoad1, getAverageLoad15, getAverageLoad5, getDomainName, getName, getNbMessageReceived, getNbMessageSent, getPort, getQueue, getStamp, getWDActivationPeriod, getWDNbRetryLevel1, getWDNbRetryLevel2, getWDRetryPeriod1, getWDRetryPeriod2, getWDRetryPeriod3, index, insert, post, restore, save, setPort, setStamp, setWDActivationPeriod, setWDNbRetryLevel1, setWDNbRetryLevel2, setWDRetryPeriod1, setWDRetryPeriod2, setWDRetryPeriod3, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fr.dyade.aaa.agent.NetworkMBean
getAverageLoad1, getAverageLoad15, getAverageLoad5, getName, getNbMessageReceived, getNbMessageSent, getWDActivationPeriod, getWDNbRetryLevel1, getWDNbRetryLevel2, getWDRetryPeriod1, getWDRetryPeriod2, getWDRetryPeriod3, setWDActivationPeriod, setWDNbRetryLevel1, setWDNbRetryLevel2, setWDRetryPeriod1, setWDRetryPeriod2, setWDRetryPeriod3
 

Field Detail

magic

public static final byte[] magic
Magic number to identify peer.

Constructor Detail

PoolNetwork

public PoolNetwork()
            throws java.lang.Exception
Creates a new network component.

Throws:
java.lang.Exception
Method Detail

getCompressedFlows

public boolean getCompressedFlows()
Returns if the stream between servers are compressed or not.

Specified by:
getCompressedFlows in interface PoolNetworkMBean
Returns:
true if the streams between servers are compressed, false otherwise.

getNbMaxActiveSession

public int getNbMaxActiveSession()
Returns the maximum number of concurrent connected sessions.

Specified by:
getNbMaxActiveSession in interface PoolNetworkMBean
Returns:
the number of concurrent connected sessions.

getNbActiveSession

public int getNbActiveSession()
Returns the number of currently connected sessions.

Specified by:
getNbActiveSession in interface PoolNetworkMBean
Returns:
the number of currently connected sessions.

getIdleTimeout

public long getIdleTimeout()
Returns the maximum idle period permitted before reseting the connection.

Specified by:
getIdleTimeout in interface PoolNetworkMBean
Returns:
the maximum idle period permitted before reseting the connection.

setIdleTimeout

public void setIdleTimeout(long idleTimeout)
Sets the maximum idle period permitted before reseting the connection.

Specified by:
setIdleTimeout in interface PoolNetworkMBean
Parameters:
the - maximum idle period permitted before reseting the connection.

init

public void init(java.lang.String name,
                 int port,
                 short[] servers)
          throws java.lang.Exception
Initializes a new network component. This method is used in order to easily creates and configure a Network component from a class name. So we can use the Class.newInstance() method for create (without any parameter) the component, then we can initialize it with this method.
This method initializes the logical clock for the domain.

Overrides:
init in class StreamNetwork
Parameters:
name - The domain name.
port - The listen port.
servers - The list of servers directly accessible from this network interface.
Throws:
java.lang.Exception
See Also:
Network

setProperties

public void setProperties()
                   throws java.lang.Exception
Set the properties of the network. Inherited from Network class, can be extended by subclasses.

Overrides:
setProperties in class StreamNetwork
Throws:
java.lang.Exception

addServer

public void addServer(short id)
               throws java.lang.Exception
Adds the server sid in the network configuration.

Overrides:
addServer in class Network
Parameters:
id - the unique server id.
Throws:
java.lang.Exception

delServer

public void delServer(short id)
               throws java.lang.Exception
Removes the server sid in the network configuration.

Overrides:
delServer in class Network
Parameters:
id - the unique server id.
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Causes this network component to begin execution.

Specified by:
start in interface MessageConsumer
Specified by:
start in interface NetworkMBean
Throws:
java.lang.Exception
See Also:
stop

wakeup

public void wakeup()
Wakes up the watch-dog thread.


stop

public void stop()
Forces the network component to stop executing.

Specified by:
stop in interface MessageConsumer
Specified by:
stop in interface NetworkMBean
See Also:
start

isRunning

public boolean isRunning()
Tests if the network component is alive.

Specified by:
isRunning in interface MessageConsumer
Specified by:
isRunning in interface NetworkMBean
Returns:
true if this MessageConsumer is alive; false otherwise.

getNbWaitingMessages

public int getNbWaitingMessages()
Gets the number of waiting messages in this engine.

Specified by:
getNbWaitingMessages in interface NetworkMBean
Overrides:
getNbWaitingMessages in class Network
Returns:
the number of waiting messages.

toString

public java.lang.String toString()
Returns a string representation of this consumer, including the daemon's name and status.

Specified by:
toString in interface NetworkMBean
Overrides:
toString in class Network
Returns:
A string representation of this consumer.


Copyright © 2011 ScalAgent D.T.. All Rights Reserved.