Package org.eclipse.core.runtime
Interface ISafeRunnableWithResult<T>
-
- Type Parameters:
T
- the type of the result
- All Superinterfaces:
ISafeRunnable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ISafeRunnableWithResult<T> extends ISafeRunnable
Safe runnables represent blocks of code and associated exception handlers. They are typically used when a plug-in needs to call some untrusted code (e.g., code contributed by another plug-in via an extension). In contradiction toISafeRunnable
this runnable is able to return a result.This interface can be used without OSGi running.
Clients may implement this interface.
- Since:
- 3.11
- See Also:
SafeRunner.run(ISafeRunnableWithResult)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
run()
Runs this runnable.T
runWithResult()
Runs this runnable and returns the result.-
Methods inherited from interface org.eclipse.core.runtime.ISafeRunnable
handleException
-
-
-
-
Method Detail
-
run
default void run() throws Exception
Description copied from interface:ISafeRunnable
Runs this runnable. Any exceptions thrown from this method will be logged by the caller and passed to this runnable'sISafeRunnable.handleException(java.lang.Throwable)
method.- Specified by:
run
in interfaceISafeRunnable
- Throws:
Exception
- if a problem occurred while running this method- See Also:
SafeRunner.run(ISafeRunnable)
-
runWithResult
T runWithResult() throws Exception
Runs this runnable and returns the result. Any exceptions thrown from this method will be logged by the caller and passed to this runnable'sISafeRunnable.handleException(java.lang.Throwable)
method.- Returns:
- the result
- Throws:
Exception
- if a problem occurred while running this method- See Also:
SafeRunner.run(ISafeRunnable)
-
-