|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.util.AbstractKernelRunnable
com.sun.sgs.impl.util.KernelCallable<R>
R - the type of the result (the return value of the call
method)public abstract class KernelCallable<R>
An abstract utility class to run a transactional task that returns a
value. A subclass of this class must implement the abstract call method which is invoked in a transaction.
Here's an example of running a KernelCallable that returns a
boolean value:
boolean result = KernelCallable.call(
new KernelCallable<Boolean>("MyKernelCallable") {
public Boolean call() {
return ...;
}
},
txnScheduler, taskOwner);
| Constructor Summary | |
|---|---|
KernelCallable(String name)
Constructs an instance with the specified name. |
|
| Method Summary | ||
|---|---|---|
static
|
call(KernelCallable<R> callable,
TransactionScheduler txnScheduler,
Identity taskOwner)
Runs the specified callable (by invoking its call
method) in a transaction using the specified txnScheduler
and taskOwner and returns the result. |
|
void |
run()
Runs this KernelRunnable. |
|
| Methods inherited from class com.sun.sgs.impl.util.AbstractKernelRunnable |
|---|
getBaseTaskType, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.concurrent.Callable |
|---|
call |
| Constructor Detail |
|---|
public KernelCallable(String name)
name.
name - a descriptive name (or null) for use in the
toString method| Method Detail |
|---|
public void run()
throws Exception
KernelRunnable. If this is run by a
Scheduler that support re-try logic, and if an
Exception is thrown that implements
ExceptionRetryStatus then the Scheduler
will consult the shouldRetry method of the
Exception to see if this task should be re-run.
This implementation invokes the call method of this
instance and sets the result.
run in interface KernelRunnableIllegalStateException - if this task has already been successfully
run via an invocation of the call method
Exception - if any error occurs
public static <R> R call(KernelCallable<R> callable,
TransactionScheduler txnScheduler,
Identity taskOwner)
throws Exception
callable (by invoking its call
method) in a transaction using the specified txnScheduler
and taskOwner and returns the result. The specified
callable can only be used once.
R - the return type of the KernelCallablecallable - a callable to invoketxnScheduler - a transaction schedulertaskOwner - an identity for the task's owner
callable
Exception - if running the specified callable throws
an Exception
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||