## org.eclipse.emf.transaction
Interface RunnableWithResult<T>

Type Parameters:
  `T` - the result type of the runnable

All Superinterfaces:
  Runnable

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:
  `TransactionalEditingDomain.runExclusive(Runnable)`

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 `Runnable.run()` method.
`IStatus` `getStatus()` Queries my commit status.
`void` `setStatus(IStatus status)` Sets the commit status after completion of the `Runnable.run()` method.

Methods inherited from interface java.lang.Runnable
`run`

Method Detail

### getResult

    T getResult()

  Returns a result computed by my `Runnable.run()` method.

  Returns:
    my result, or `null` if none

### setStatus

    void setStatus(IStatus status)

  Sets the commit status after completion of the `Runnable.run()` method.

  Parameters:
    `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)

### getStatus

    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.

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

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