Interface RunnableWithResult<T>

Type Parameters:
T - the result type of the runnable
All Superinterfaces:
All Known Implementing Classes:
PrivilegedRunnable, RunnableWithResult.Impl

public interface RunnableWithResult<T>
extends Runnable

Extends the core Java Runnable interface with the ability to return a result. Useful for returning results of read operations from the TransactionalEditingDomain.runExclusive(Runnable) method.

Also, because read transactions can roll back on commit if, for example, some other thread performs a concurrent write that corrupts the data being read, this interface also provides a means to set a status to indicate success or failure of the transaction.

See Also:

Nested Class Summary
static class RunnableWithResult.Impl<T>
          A convenient partial implementation of the RunnableWithResult interface that implements a settable result field and commit status.
Method Summary
 T getResult()
          Returns a result computed by my method.
 IStatus getStatus()
          Queries my commit status.
 void setStatus(IStatus status)
          Sets the commit status after completion of the method.
Methods inherited from interface java.lang.Runnable

Method Detail


T getResult()
Returns a result computed by my method.

my result, or null if none


void setStatus(IStatus status)
Sets the commit status after completion of the method.

status - an OK status if commit succeeds, or an error status if it fails (in which case the transaction rolled back and the status provides details in human-readable form)


IStatus getStatus()
Queries my commit status. My status is only available after I have finished running and after the editing domain has attempted to commit my transaction.

the status of my commit (as set by the setStatus(IStatus) method)

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.