|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.management.comm.SnmpInformRequest
public class SnmpInformRequest
This class is used by the SNMP adaptor server
to send inform requests
to an SNMP manager and receive inform responses.
This class provides basic functions that enable you to fire inform requests,
handle retries, timeouts, and process responses from the manager.
The SNMP adaptor server specifies the destination of the inform request
and controls the size of a single inform request/response to fit into
its bufferSize
.
It specifies the maximum number of tries and the timeout to be used for
the inform requests.
It also provides resources such as the authentication mechanism (using
its PDU factory), controlling all inform requests created by it, and
finally the inform response to the user.
Each inform request, when ready to be sent, is assigned a unique identifier which helps in identifying the inform request with matching inform responses to the protocol engine lying transparently underneath. The engine does the job of retrying the inform requests when the timer expires and calls the SNMP adaptor server when a timeout occurs after exhausting the maximum number of tries.
The inform request object provides the method,
waitForCompletion(long time)
,
which enables a user to operate in a synchronous mode with an inform
request.
This is done by blocking the user thread for the desired time interval.
The user thread gets notified whenever a request reaches completion,
independently of the status of the response.
If an inform callback
is
provided when sending the inform request, the user operates in an
asynchronous mode with the inform request. The user thread is not blocked
and the specific inform callback implementation provided by the user is
invoked when the inform response is received.
Note:
From RFC 1905, the SNMP inform request is defined as a request
generated and transmitted by an SNMPv2 entity acting in a manager role
to another SNMPv2 entity also acting in a manager role.
The mechanisms to implement this behavior are defined in the SNMP
manager API.
Nevertheless, this feature has derived and in some documentations,
the inform request appears
like an SNMPv2 trap that gets responded.
The SnmpInformRequest
class is used to fulfill this
latter case.
Field Summary | |
---|---|
static int |
stAborted
Status of an inform request: request aborted. |
static int |
stInProgress
Status of an inform request: in progress. |
static int |
stInternalError
Status of an inform request: internal error occurred. |
static int |
stNeverUsed
Status of an inform request: request never used. |
static int |
stReceivedReply
Status of an inform request: reply received. |
static int |
stResultsAvailable
Status of an inform request: result available for the request. |
static int |
stTimeout
Status of an inform request: timeout. |
static int |
stWaitingForReply
Status of an inform request: waiting for reply. |
static int |
stWaitingToSend
Status of an inform request: waiting to be sent. |
Method Summary | |
---|---|
void |
cancelRequest()
Cancels the active inform request and removes itself from the polling list. |
void |
finalize()
Finalizer of the SnmpInformRequest objects. |
long |
getAbsMaxTimeToWait()
Gets absolute time in milliseconds (based on epoch time) before which an inform response is expected from a manager. |
long |
getAbsNextPollTime()
Gets absolute time in milliseconds (based on epoch time) when the next polling activity will begin. |
int |
getErrorIndex()
Gets the index. |
int |
getErrorStatus()
Gets the status associated with the SnmpVarBindList . |
int |
getMaxTries()
Gets the maximum number of tries before declaring that the manager is not responding. |
int |
getNumTries()
Gets the number of tries performed for the current inform request. |
int |
getRequestId()
Gets the request id (invoke identifier) of the current inform request. |
int |
getRequestStatus()
Gets the current status of the inform request. |
SnmpVarBindList |
getResponseVarBindList()
Gets the SnmpVarBindList of the inform response. |
boolean |
inProgress()
Indicates whether or not the inform request is in progress. |
boolean |
isAborted()
Indicates whether or not the inform request was aborted. |
boolean |
isResultAvailable()
Indicates whether or not the inform request result is available. |
void |
notifyClient()
Notifies the registered client about the completion of an operation. |
static String |
snmpErrorToString(int errcode)
Returns the String representation of an error code. |
String |
toString()
Gives a status report of the request. |
boolean |
waitForCompletion(long time)
Used in synchronous mode only. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int stInProgress
public static final int stWaitingToSend
public static final int stWaitingForReply
public static final int stReceivedReply
public static final int stAborted
public static final int stTimeout
public static final int stInternalError
public static final int stResultsAvailable
public static final int stNeverUsed
Method Detail |
---|
public final int getRequestId()
public final int getRequestStatus()
public final boolean isAborted()
true
if the inform request was aborted,
false
otherwise.public final boolean inProgress()
true
if the inform request is in progress,
false
otherwise.public final boolean isResultAvailable()
true
if the inform request result is available,
false
otherwise.public final int getErrorStatus()
SnmpVarBindList
.
public final int getErrorIndex()
NOTE: this value is equal to the errorIndex
field
minus 1.
public final int getMaxTries()
public final int getNumTries()
public final long getAbsNextPollTime()
public final long getAbsMaxTimeToWait()
public final SnmpVarBindList getResponseVarBindList()
SnmpVarBindList
of the inform response.
It returns a null value if the inform request is in progress.
This ensures accidental manipulation does not occur when a request
is in progress.
In case of an error, SnmpVarBindList
is the copy
of the original SnmpVarBindList
at the time of making
the inform request.
SnmpVarBind
objects returned by
the manager or the null value if the request
is in progress.public final boolean waitForCompletion(long time)
time
- The amount of time to wait. Zero means block until complete.
true
if the inform request has completed,
false
if it is still active.public final void cancelRequest()
public final void notifyClient()
public void finalize()
SnmpInformRequest
objects.
This method is called by the garbage collector on an object
when garbage collection determines that there are no more
references to the object.
Sets all the references to this SNMP inform request object to
null
.
finalize
in class Object
public static String snmpErrorToString(int errcode)
String
representation of an error code.
errcode
- The error code as an integer.
String
.public String toString()
toString
in class Object
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |