|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.cajo.utils.extra.Nice
public final class Nice
This class wraps an object, and dynamically alters the priority of the invocation thread at runtime. Normally, the thread is moved to lowest priority, to reduce the burden on the serving JVM for methods requiring a lot of processing resources. However the wrapper can also be used escalate the invocation thread to maximum priority, for time critical tasks.
Field Summary | |
---|---|
boolean |
fast
A flag to indicate if this wrapper is maximising or minimising the priority of the invocation thread. |
java.lang.Object |
item
The presumably local object reference, for which invocation thread priority will be managed. |
Constructor Summary | |
---|---|
Nice(java.lang.Object item,
boolean fast)
The constuctor wraps an object reference, and allows invocations to execute at either minumum or maximum priority. |
Method Summary | |
---|---|
java.lang.Object |
invoke(java.lang.String method,
java.lang.Object args)
This method intercepts the remote invocation thread, and alters its priority from normal. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final java.lang.Object item
public final boolean fast
Constructor Detail |
---|
public Nice(java.lang.Object item, boolean fast)
item
- The object reference to be invokedfast
- True to execute invocations at maximum priority, false to
invoke at minimum priorty.Method Detail |
---|
public java.lang.Object invoke(java.lang.String method, java.lang.Object args) throws java.lang.Exception
invoke
in interface Invoke
method
- The name of the method to invoke on the wrapped objectargs
- The data relevant to the invocation. It can be a single
object, an array, or null
java.lang.Exception
- As needed by the object, also, a
java.rmi.RemoteException can be thrown for network related reasons,
also a SecurityException can be thrown, if the codebase does not have
permission from the SecurityManager to alter thread priority.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |