Methods Summary |
---|
private java.lang.String | debugMsg(java.lang.String message)
String msg = "[Thread " + Thread.currentThread().getName()
+ "] -- " + message;
return msg;
|
public void | doWork(javax.resource.spi.work.Work work)Executes the work instance.
doWork(work, -1, null, null);
|
public void | doWork(javax.resource.spi.work.Work work, long startTimeout, javax.resource.spi.work.ExecutionContext execContext, javax.resource.spi.work.WorkListener workListener)Executes the work instance. The calling thread will wait until the
end of work execution.
if (logger.isLoggable(Level.FINEST)) {
String msg = "doWork for [" + work.toString() + "] START";
logger.log(Level.FINEST, debugMsg(msg));
}
WorkCoordinator wc = new WorkCoordinator
(work, startTimeout, execContext, tp.getAnyWorkQueue(), workListener,
this.workStats);
wc.submitWork(WorkCoordinator.WAIT_UNTIL_FINISH);
wc.lock();
WorkException we = wc.getException();
if (we != null) {
throw we;
}
if (logger.isLoggable(Level.FINEST)) {
String msg = "doWork for [" + work.toString() + "] END";
msg = "doWork for [" + work.toString() + "] END";
logger.log(Level.FINEST, debugMsg(msg));
}
|
public long | getCompletedWorkCount()
return this.workStats.completedWorkCount;
|
public long | getCurrentActiveWorkCount()
return this.workStats.currentActiveWorkCount;
|
public long | getMaxActiveWorkCount()
return this.workStats.maxActiveWorkCount;
|
public long | getMaxWaitQueueLength()
return this.workStats.maxWaitQueueLength;
|
public long | getMaxWorkRequestWaitTime()
return this.workStats.maxWorkRequestWaitTime;
|
public long | getMinActiveWorkCount()
if (this.workStats.minActiveWorkCount != Long.MAX_VALUE){
return this.workStats.minActiveWorkCount;
} else {
return 0;
}
|
public long | getMinWaitQueueLength()
if (this.workStats.minWaitQueueLength != Long.MAX_VALUE){
return this.workStats.minWaitQueueLength;
} else {
return 0;
}
|
public long | getMinWorkRequestWaitTime()
return this.workStats.minWorkRequestWaitTime;
|
public long | getRejectedWorkCount()
return this.workStats.rejectedWorkCount;
|
public long | getSubmittedWorkCount()
return this.workStats.submittedWorkCount;
|
public long | getWaitQueueLength()
return this.workStats.currWaitQueueLength;
|
public boolean | isMonitoringEnabled()
return this.isMonitoringEnabled;
|
public void | scheduleWork(javax.resource.spi.work.Work work)Executes the work instance. Calling thread will continue after scheduling
the work
scheduleWork(work, -1, null, null);
return;
|
public void | scheduleWork(javax.resource.spi.work.Work work, long startTimeout, javax.resource.spi.work.ExecutionContext execContext, javax.resource.spi.work.WorkListener workListener)Executes the work instance. Calling thread will continue after scheduling
the work
if (logger.isLoggable(Level.FINEST)) {
String msg = "scheduleWork for [" + work.toString() + "] START";
logger.log(Level.FINEST, debugMsg(msg));
}
WorkCoordinator wc = new WorkCoordinator
(work, startTimeout, execContext, tp.getAnyWorkQueue(), workListener,
this.workStats);
wc.submitWork(WorkCoordinator.NO_WAIT);
wc.lock();
WorkException we = wc.getException();
if (we != null) {
throw we;
}
if (logger.isLoggable(Level.FINEST)) {
String msg = "scheduleWork for [" + work.toString() + "] END";
logger.log(Level.FINEST, debugMsg(msg));
}
return;
|
public void | setMonitoringEnabled(boolean isEnabled)
this.isMonitoringEnabled = isEnabled;
if ( this.workStats == null ) {
this.workStats = new WorkStats();
}
//reset WorkStats when monitoring disabled
if (!isEnabled){
this.workStats.reset();
}
|
public long | startWork(javax.resource.spi.work.Work work)Executes the work instance. The calling thread will wait until the
start of work execution.
//block the current application thread
//find a thread to run work
//notify the application thread when done
return startWork(work, -1, null, null);
|
public long | startWork(javax.resource.spi.work.Work work, long startTimeout, javax.resource.spi.work.ExecutionContext execContext, javax.resource.spi.work.WorkListener workListener)Executes the work instance. The calling thread will wait until the
start of work execution.
if (logger.isLoggable(Level.FINEST)) {
String msg = "startWork for [" + work.toString() + "] START";
logger.log(Level.FINEST, debugMsg(msg));
}
long acceptanceTime = System.currentTimeMillis();
WorkCoordinator wc = new WorkCoordinator
(work, startTimeout, execContext, tp.getAnyWorkQueue(), workListener,
this.workStats);
wc.submitWork(WorkCoordinator.WAIT_UNTIL_START);
wc.lock();
WorkException we = wc.getException();
if (we != null) {
throw we;
}
if (logger.isLoggable(Level.FINEST)) {
String msg = "startWork for [" + work.toString() + "] END";
logger.log(Level.FINEST, debugMsg(msg));
}
long startTime = System.currentTimeMillis();
return (startTime - acceptanceTime);
|