com.adventnet.snmp.snmp2.agent
Class MultipleAgent

java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.agent.MultipleAgent

public class MultipleAgent
extends java.lang.Object

This class instatiates multiple SnmpAgents on different IpAddresses specified by a IpAddressfile.

In a single JVM you could have a multiple instance of SnmpAgent.

See Also:
SnmpAgent

Constructor Summary
MultipleAgent()
          Constructor for MultipleAgent.
 
Method Summary
 void addSnmpPduRequestListener(SnmpPduRequestListener p1)
          Adds a Listener to which the pdu is forwarded.
 void finalize()
          Destructor for MultipleAgent stop all SnmpAgents.
 java.lang.String getIpAddrFileName()
          The ipAddrFileName , contains ipAddresses on which the agent are running
 int getPort()
          The port on which agents are running
 void removeSnmpPduRequestListener(SnmpPduRequestListener p1)
          Removes the Listener registered for this uni-cast bean.
 void restartMultipleSnmpAgent()
          Restarts the receiver Thread for receiving requests.
 void setIpAddrFileName(java.lang.String ipAddrFileName)
          The file name which has localAddresses on which the agent are going to listen for requests on.
 void setPort(int port)
          The port on which the agents are going to run.
 void stopMultipleSnmpAgent()
          Stops the receiver Thread and closes the socket used by this agent.
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipleAgent

public MultipleAgent()
Constructor for MultipleAgent.
Method Detail

finalize

public void finalize()
              throws java.lang.Throwable
Destructor for MultipleAgent stop all SnmpAgents.
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - If it is not able stop the Agents.

setPort

public void setPort(int port)
             throws AgentRuntimeException
The port on which the agents are going to run.

This restarts all SnmpAgents at the specified port.

Parameters:
port - The udp port number to whcih the SnmpSession is start.
Throws:
AgentRuntimeException - If the Port is already in use.
See Also:
getPort()

getPort

public int getPort()
The port on which agents are running
Returns:
the port number
See Also:
setPort()

setIpAddrFileName

public void setIpAddrFileName(java.lang.String ipAddrFileName)
The file name which has localAddresses on which the agent are going to listen for requests on.

It stops all agents which are currently running and restarts Agents on new ipAddresses specified in the file.

Parameters:
ipAddrFileName - file contains the addresses.
See Also:
getIpAddrFileName()

getIpAddrFileName

public java.lang.String getIpAddrFileName()
The ipAddrFileName , contains ipAddresses on which the agent are running
Returns:
the ipAddrFileName
See Also:
setIpAddrFileName()

addSnmpPduRequestListener

public void addSnmpPduRequestListener(SnmpPduRequestListener p1)
                               throws RegistrationListenerException
Adds a Listener to which the pdu is forwarded.
Parameters:
p1 - The SnmpPduRequestListener to be added.
Throws:
java.util.TooManyListenersException - if already there is a SnmpPduRequestListener is registered.

removeSnmpPduRequestListener

public void removeSnmpPduRequestListener(SnmpPduRequestListener p1)
Removes the Listener registered for this uni-cast bean.
Parameters:
p1 - The Snmp PDU Request listener that is to be removed.

restartMultipleSnmpAgent

public void restartMultipleSnmpAgent()
                              throws AgentRuntimeException
Restarts the receiver Thread for receiving requests.
Throws:
AgentRuntimeException - If unable to restart the Snmp Agents.

stopMultipleSnmpAgent

public void stopMultipleSnmpAgent()
Stops the receiver Thread and closes the socket used by this agent.

This thread doesn't kill all the threads and sessions.

See Also:
SnmpStore