Package uk.co.westhawk.snmp.beans
Class SNMPRunBean
java.lang.Object
uk.co.westhawk.snmp.beans.SNMPBean
uk.co.westhawk.snmp.beans.SNMPRunBean
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
AnnexModemStatusBean
,AscendActiveSessionBean
,DialogChannelStatusBean
,InterfaceIndexesBean
,NTPrintQBean
,NTServiceNamesBean
,NTSharedResBean
,NTUserNamesBean
,OneInterfaceBean
,OneNTPrintQBean
,OneNTServiceBean
,OneNTSharedResBean
This bean forms the base of the Runnable SNMP beans. It extends the SNMPBean class.
This bean is used when SNMP requests have to be sent continuously, instead of just once. For that purpose the update interval setUpdateInterval() can be set. The default value is 2000, i.e. 2 msec.
When implementing an extention of this class, the method action() should be implemented. It should somehow start the run by calling setRunning(true). Stopping the thread might be called by the application or applet.
- Version:
- $Revision: 1.9 $ $Date: 2006/02/09 14:20:09 $
- Author:
- Birgit Arkesteijn
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the update interval.boolean
Returns if the bean is running.abstract void
run()
Method according to the Runnable interface.void
setRunning
(boolean b) Starts or stops the thread.void
setUpdateInterval
(int i) Sets the update interval.void
Sets the update interval as String.Methods inherited from class uk.co.westhawk.snmp.beans.SNMPBean
action, addPropertyChangeListener, getBindAddress, getCommunityName, getHost, getMessage, getPort, getSocketType, removePropertyChangeListener, setBindAddress, setCommunityName, setHost, setPort, setPort, setSocketType
-
Constructor Details
-
SNMPRunBean
public SNMPRunBean()The default constructor
-
-
Method Details
-
run
public abstract void run()Method according to the Runnable interface. This method should provide the continuous sending of a Pdu, with a sleeping interval set by setUpdateInterval(). -
getUpdateInterval
public int getUpdateInterval()Returns the update interval. This is the interval that the bean will sleep between 2 requests.- Returns:
- the update interval in msec
- See Also:
-
setUpdateInterval
public void setUpdateInterval(int i) Sets the update interval. This is the interval that the bean will sleep between 2 requests. The default will be 2000 (= 2 sec).- Parameters:
i
- the interval in msec- See Also:
-
setUpdateInterval
Sets the update interval as String.- Parameters:
i
- the interval in msec as String- See Also:
-
isRunning
public boolean isRunning()Returns if the bean is running.- Returns:
- the running mode
- See Also:
-
setRunning
public void setRunning(boolean b) Starts or stops the thread. Starting this thread should be a result of calling the action() method, so should be implemented in the action method of any child class. Stopping this thread may be called by the application of applet. This method does NOT call Thread.stop() anymore. Every run() method should check isRunning(), so that when setRunning(false) is called, the run() method will stop running!!- See Also:
-