|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.cajo.utils.MonitorItem
public class MonitorItem
This class is used to instrument an object for invocation logging purposes. It is intended as a replacement for standard RMI logging, in that this logger is aware of the Invoke package methodology, and can decode it properly. Specifically, it will gather information about the calling client, the method called, the inbound and outbound data. It will also record the approximate time between client invocations, the time used to service the invocation, and the approximate percentage of free memory available at the completion of the operation. Subclassing of MonitorItem is allowed; primarily to create self-monitoring classes.
Note: monitoring an object can be expensive in runtime efficiency. It is best used for debug and performance analysis, during development, or in production, for objects that would not be called very frequently.
Field Summary | |
---|---|
static boolean |
CLASSOFF
This flag can be used to selectively enable and disable monitoring on a class-wide level. |
java.lang.Object |
item
The object being monitored. |
boolean |
LOCALOFF
This flag can be used to selectively enable and disable monitoring on a instance-wide level. |
Constructor Summary | |
---|---|
MonitorItem(java.lang.Object item)
This creates the monitor object, to instrument the target object's use. |
|
MonitorItem(java.lang.Object item,
java.io.ObjectOutputStream os)
This creates the monitor object, to instrument the target object's use. |
|
MonitorItem(java.lang.Object item,
java.io.OutputStream os)
This creates the monitor object, to instrument the target object's use. |
Method Summary | |
---|---|
java.lang.Object |
invoke(java.lang.String method,
java.lang.Object args)
This method logs the incoming calls, passing the caller's data to the internal item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean CLASSOFF
public boolean LOCALOFF
public final java.lang.Object item
Constructor Detail |
---|
public MonitorItem(java.lang.Object item)
item
- The object to receive the client invocation.public MonitorItem(java.lang.Object item, java.io.OutputStream os)
item
- The object to receive the client invocation.os
- The OutputStream to send the formatted log information.public MonitorItem(java.lang.Object item, java.io.ObjectOutputStream os)
item
- The object to receive the client invocation.os
- The ObjectOutputStream to send input and result objects.Method Detail |
---|
public java.lang.Object invoke(java.lang.String method, java.lang.Object args) throws java.lang.Exception
Note: Logging may be activated and deactivated administratively as needed on both an instance-wide basis via the field LOCALOFF, and on a class-wide basis via the static field CLASSOFF.
invoke
in interface Invoke
method
- The internal object's public method being called.args
- The arguments to pass to the internal object's method.
java.rmi.RemoteException
- For a network related failure.
java.lang.NoSuchMethodException
- If the method/agruments signature cannot
be matched to the internal object's public method interface.
java.lang.Exception
- If the internal object's method rejects the invocation.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |