[SNMP4J] Correct way to close AgentX connection?

Frank Fock fock at agentpp.com
Sat Jan 3 00:37:20 CET 2009


Hi Andy,

The first two statements (session close and transport
disconnect) should be sufficient. The fourth thread
is the connection management thread of the TCP
transport mapping. To remove it, call stop() on
the transport mapping (this will close all connections
of that mapping).

Best regards,
Frank

Andy O'Neill wrote:
> I was wondering if anyone knows the correct way to close an AgentX 
> connection to a master agent. Here are some setup snippets:
> 
> private AgentXSubagent _subagent;
> private AgentXSession _session;
> private TcpAddress _masterAddress;
> ...
> // I initalize a bunch of stuff, including this:
> _subagent.setThreadPool(ThreadPool.create("MySubAgent", 3));
> 
> Basically I want to close my connection and start a new one without 
> exiting the Java process. This is what I was doing to close the connection:
> 
> _subagent.close(_session, AgentXProtocol.REASON_SHUTDOWN);
> _subagent.disconnect(_masterAddress);
> ((ConnectionOrientedTransportMapping)_session.getPeer().getTransport()).close(_masterAddress); 
> 
> 
> However, I still see 4 threads hanging around after this operation: 
> MySubAgent.0, MySubAgent.1, MySubAgent.2, and 
> DefaultTCPTransportMapping_127.0.0.1/0. Anyone know what I'm doing wrong?
> 
> Thanks,
> Andy O'Neill
> 
> 
> <http://www.tavve.com?leadlander>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com





More information about the SNMP4J mailing list