SNMP Stack 4_12

uk.co.westhawk.snmp.stack
Class SnmpContextv2cPool

java.lang.Object
  |
  +--uk.co.westhawk.snmp.stack.SnmpContextPool
        |
        +--uk.co.westhawk.snmp.stack.SnmpContextv2cPool
All Implemented Interfaces:
SnmpContextBasisFace, SnmpContextFace, SnmpContextv2cFace

public class SnmpContextv2cPool
extends SnmpContextPool
implements SnmpContextv2cFace

This class contains the pool of SNMP v2c contexts. It extends the SnmpContextPool and is similar in every way, except it uses a pool of SnmpContextv2c.

Thanks to Seon Lee (slee@virtc.com) for reporting thread safety problems.

Version:
$Revision: 3.8 $ $Date: 2002/10/10 15:13:57 $
Author:
Birgit Arkesteijn
See Also:
SnmpContextv2c, SnmpContextPool, SnmpContextv3Pool

Fields inherited from class uk.co.westhawk.snmp.stack.SnmpContextPool
community, context, contextPool, hostAddr, hostPort, socketType
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextv2cFace
version_id
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
DEFAULT_PORT, KVM_SOCKET, MAXPDU, MSS, NETSCAPE_SOCKET, STANDARD_SOCKET
 
Constructor Summary
SnmpContextv2cPool(java.lang.String host, int port)
          Constructor.
SnmpContextv2cPool(java.lang.String host, int port, java.lang.String typeSocket)
          Constructor.
 
Method Summary
protected  SnmpContext getMatchingContext()
          Returns a v2c context from the pool.
 int getVersion()
          Return the SNMP version of the context.
 
Methods inherited from class uk.co.westhawk.snmp.stack.SnmpContextPool
addPdu, addTrapListener, destroy, dumpContexts, encodePacket, getCommunity, getHashKey, getHost, getPort, getTypeSocket, processIncomingTrap, removePdu, removeTrapListener, sendPacket, setCommunity, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uk.co.westhawk.snmp.stack.SnmpContextFace
getCommunity, setCommunity
 
Methods inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
addPdu, addTrapListener, destroy, encodePacket, getHost, getPort, getTypeSocket, processIncomingTrap, removePdu, removeTrapListener, sendPacket
 

Constructor Detail

SnmpContextv2cPool

public SnmpContextv2cPool(java.lang.String host,
                          int port)
                   throws java.io.IOException
Constructor.
Parameters:
host - The host to which the Pdu will send
port - The port where the SNMP server will be
See Also:
SnmpContextv2c.SnmpContextv2c(String, int)

SnmpContextv2cPool

public SnmpContextv2cPool(java.lang.String host,
                          int port,
                          java.lang.String typeSocket)
                   throws java.io.IOException
Constructor.
Parameters:
host - The host to which the Pdu will send
port - The port where the SNMP server will be
typeSocket - The type of socket to use.
See Also:
SnmpContextv2c.SnmpContextv2c(String, int, String), SnmpContextBasisFace.STANDARD_SOCKET, SnmpContextBasisFace.NETSCAPE_SOCKET, SnmpContextBasisFace.KVM_SOCKET
Method Detail

getVersion

public int getVersion()
Return the SNMP version of the context.
Specified by:
getVersion in interface SnmpContextBasisFace
Overrides:
getVersion in class SnmpContextPool
Returns:
The version

getMatchingContext

protected SnmpContext getMatchingContext()
                                  throws java.io.IOException
Returns a v2c context from the pool. This methods checks for an existing context that matches all our properties. If such a context does not exist a new one is created and added to the pool. This method actually returns a SnmpContextv2c, although it doesn't look like it.
Overrides:
getMatchingContext in class SnmpContextPool
Returns:
A context (v2c) from the pool
See Also:
SnmpContextPool.getHashKey(), SnmpContext, SnmpContextv2c

SNMP Stack 4_12