Class SnmpContextPool

java.lang.Object
uk.co.westhawk.snmp.stack.SnmpContextPool
All Implemented Interfaces:
SnmpContextBasisFace, SnmpContextFace
Direct Known Subclasses:
SnmpContextv2cPool

public class SnmpContextPool extends Object implements SnmpContextFace
This class contains the pool of SNMP v1 contexts. This class reuses the existings contexts instead of creating a new one every time.

Every time a property changes the pool is checked for a SnmpContext context that matches all the new properties of this class. If no such context exists, a new one is made. The PDUs associated with the old context remain associated with the old context.

A counter indicates the number of times the context is referenced. The counter is decreased when destroy() is called. When the counter reaches zero, the context is released.

Note that because the underlying context can change when a property is changed and the PDUs remain associated with the old context, all properties have to be set BEFORE a PDU is sent.

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

Version:
$Revision: 3.22 $ $Date: 2009/03/05 13:27:41 $
Author:
Birgit Arkesteijn
See Also: