public class WorkUnit
extends java.lang.Object
Uses JNI wrappers to the following C Library APIs:
Note: It is the programmer's responsibility to maintain the lifecycle of a WorkUnit
and to delete()
it.
Note: If a WorkUnit is joined to a Thread and that thread creates new Threads, these new threads are not automatically joined to the WorkUnit.
For additional information, see:
WorkloadManager
,
ServerClassification
Constructor and Description |
---|
WorkUnit()
Create a WLM work unit that represents a continuation of the work unit associated with the
current home address space.
|
WorkUnit(ServerClassification serverClassification,
byte[] arrivalTime,
java.lang.String functionName)
Create a WLM work unit.
|
WorkUnit(ServerClassification serverClassification,
java.lang.String functionName)
Create a WLM work unit.
|
Modifier and Type | Method and Description |
---|---|
void |
delete()
Delete the WLM work unit.
|
long |
getEnclaveToken() |
boolean |
isDeleted() |
void |
join()
Join the WLM work unit.
|
void |
leave()
Leave the WLM work unit.
|
void |
run(java.lang.Runnable runnable)
Execute the supplied Runnable against this WorkUnit.
|
java.lang.Runnable |
wrap(java.lang.Runnable runnable)
Convenience method for wrapping an existing Runnable with a WorkUnit.run() wrapper.
|
public WorkUnit() throws ErrnoException
ErrnoException
java.lang.SecurityException
- if a a SecurityManager is active and the user doesn't have access to JzosPermission("WorkloadManager")public WorkUnit(ServerClassification serverClassification, java.lang.String functionName)
serverClassification
- a configured WorkloadManager ServerClassification instancefunctionName
- a string that represents the descriptive function name of the
associated work request.ErrnoException
java.lang.SecurityException
- if a a SecurityManager is active and the user doesn't have access to JzosPermission("WorkloadManager")public WorkUnit(ServerClassification serverClassification, byte[] arrivalTime, java.lang.String functionName)
serverClassification
- a configured WorkloadManager ServerClassification instancearrivalTime
- The arrival time in STCK format of the associated work request.functionName
- a string that represents the descriptive function name of the
associated work request.ErrnoException
java.lang.SecurityException
- if a a SecurityManager is active and the user doesn't have access to JzosPermission("WorkloadManager")ZUtil.getTodClock().
public void run(java.lang.Runnable runnable) throws ErrnoException
This does the following:
join(); try { runnable.run(); } finally { leave(); }
runnable
- the RunnableErrnoException
public java.lang.Runnable wrap(java.lang.Runnable runnable)
This does the following:
return new Runnable() { public void run() { WorkUnit.this.run(runnable); } };
For example:
new Thread(aWorkUnit.wrap(aRunnable)).start();
runnable
- public void join() throws ErrnoException
The programmer should ensure that leave()
is called for
every WorkUnit.
ErrnoException
java.lang.IllegalStateException
- if the WorkUnit has been deleted.run(Runnable)
,
wrap(Runnable)
public void leave() throws ErrnoException
ErrnoException
java.lang.IllegalStateException
- if the WorkUnit has been deleted.public void delete() throws ErrnoException
Has no effect if already deleted.
ErrnoException
public boolean isDeleted()
public long getEnclaveToken()
java.lang.IllegalStateException
- if the WorkUnit has been deleted.