|
MySnmpCrawler API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.sun.jdmk.comm.CommunicatorServer
|
+--snmp.comm.SnmpAdaptor
The SnmpAdaptor is a SNMP agent that listens for SNMP requests. It is the subclass of the CommunicatorServer to inherit the behavior from JMX API. The SnmpAdaptor is also a MBean that can be managed through the JMX MBean server.
When the SnmpAdaptor receives a request, it creates a new session and schedules a thread from the thread pool to handle the request. Then the SnmpAdaptor continues accepting the incoming requests.
CommunicatorServer| Field Summary | |
private int |
BUFFER_SIZE
|
private java.lang.String |
community
|
private java.lang.String |
host
|
private java.lang.String |
MBEAN_NAME
|
private java.net.DatagramPacket |
packet
|
private EDU.oswego.cs.dl.util.concurrent.PooledExecutor |
pool
|
private int |
port
|
private java.lang.String |
PROTOCOL_NAME
|
private java.net.DatagramSocket |
socket
|
private int |
THREAD_POOL_SIZE
|
| Fields inherited from class com.sun.jdmk.comm.CommunicatorServer |
HTML_TYPE, HTTP_TYPE, HTTPS_TYPE, OFFLINE, ONLINE, RMI_TYPE, SNMP_TYPE, STARTING, STOPPING |
| Constructor Summary | |
SnmpAdaptor(java.lang.String host,
int port,
java.lang.String community)
Constructs the SnmpAdaptor object using the passed host name, port number, and community string. |
|
| Method Summary | |
void |
doBind()
Binds the datagram socket to a particular port. |
protected void |
doError(java.lang.Exception e)
Invoked when the exception occurs. |
protected void |
doProcess()
Processes the received packet when the request comes in. |
protected void |
doReceive()
Receives the packet from the bind socket. |
protected void |
doUnbind()
Invoked whenever the adaptor goes OFFLINE to unbind the socket. |
protected void |
finalize()
Invoked to close the socket and set the socket to NULL. |
java.lang.String |
getMBeanName()
Gets the MBean name of the SnmpAdaptor. |
java.lang.String |
getProtocol()
Gets the protocol name of the adaptor. |
private void |
setupThreadPool()
Setups thread pool to handle the incoming requests. |
void |
start()
Invoked to start the SNMP adaptor. |
void |
stop()
Invoked when the SNMP adaptor goes from "ONLINE" to "OFFLINE". |
| Methods inherited from class com.sun.jdmk.comm.CommunicatorServer |
addNotificationListener, getHost, getMBeanServer, getNotificationInfo, getPort, getState, getStateString, isActive, postDeregister, postRegister, preDeregister, preRegister, removeNotificationListener, run, setMBeanServer, setPort, waitState |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.lang.String PROTOCOL_NAME
private final java.lang.String MBEAN_NAME
private int BUFFER_SIZE
private int THREAD_POOL_SIZE
private java.net.DatagramSocket socket
private java.net.DatagramPacket packet
private java.lang.String host
private int port
private java.lang.String community
private EDU.oswego.cs.dl.util.concurrent.PooledExecutor pool
| Constructor Detail |
public SnmpAdaptor(java.lang.String host,
int port,
java.lang.String community)
throws java.lang.Exception
host - The host name of the SNMP agentport - The port number of the SNMP agentcommunity - The community string used in the SNMP agent
java.lang.Exception - thrown if any error occurs during the object
instantiation.| Method Detail |
protected void doError(java.lang.Exception e)
throws com.sun.jdmk.comm.CommunicationException
doError in class com.sun.jdmk.comm.CommunicatorServercom.sun.jdmk.comm.CommunicationException - thrown when any exception occurs.
public void doBind()
throws com.sun.jdmk.comm.CommunicationException,
java.lang.InterruptedException
doBind in class com.sun.jdmk.comm.CommunicatorServercom.sun.jdmk.comm.CommunicationException - thrown when any SocketException occurs.
java.lang.InterruptedException - thrown when the thread is interrupted.
protected void doReceive()
throws com.sun.jdmk.comm.CommunicationException,
java.lang.InterruptedException
doReceive in class com.sun.jdmk.comm.CommunicatorServercom.sun.jdmk.comm.CommunicationException - thrown when any SocketException occurs.
java.lang.InterruptedException - thrown when the thread is interrupted.
protected void doProcess()
throws com.sun.jdmk.comm.CommunicationException,
java.lang.InterruptedException
doProcess in class com.sun.jdmk.comm.CommunicatorServercom.sun.jdmk.comm.CommunicationException - thrown when any SocketException occurs.
java.lang.InterruptedException - thrown when the thread is interrupted.
protected void doUnbind()
throws com.sun.jdmk.comm.CommunicationException,
java.lang.InterruptedException
doUnbind in class com.sun.jdmk.comm.CommunicatorServercom.sun.jdmk.comm.CommunicationException - thrown when any SocketException occurs.
java.lang.InterruptedException - thrown when the thread is interrupted.public java.lang.String getProtocol()
getProtocol in interface com.sun.jdmk.comm.CommunicatorServerMBeangetProtocol in class com.sun.jdmk.comm.CommunicatorServerprotected void finalize()
finalize in class java.lang.Objectcom.sun.jdmk.comm.CommunicationException - thrown when any SocketException occurs.
java.lang.InterruptedException - thrown when the thread is interrupted.public void start()
start in interface com.sun.jdmk.comm.CommunicatorServerMBeanstart in class com.sun.jdmk.comm.CommunicatorServerpublic void stop()
stop in interface com.sun.jdmk.comm.CommunicatorServerMBeanstop in class com.sun.jdmk.comm.CommunicatorServerpublic java.lang.String getMBeanName()
private void setupThreadPool()
|
MySnmpCrawler API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||