Package org.eclipse.core.runtime
Interface ISafeRunnable
- All Known Subinterfaces:
ISafeRunnableWithResult<T>
- All Known Implementing Classes:
EarlyStartupRunnable
,SafeRunnable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
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).
This interface can be used without OSGi running.
Clients may implement this interface.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
handleException
(Throwable exception) Handles an exception thrown by this runnable'srun()
method.void
run()
Runs this runnable.
-
Method Details
-
run
Runs this runnable. Any exceptions thrown from this method will be logged by the caller and passed to this runnable'shandleException(java.lang.Throwable)
method.- Throws:
Exception
- if a problem occurred while running this method- See Also:
-
handleException
Handles an exception thrown by this runnable'srun()
method. The processing done here should be specific to the particular use case for this runnable. Generalized exception processing, including logging in the Platform's log, is done by theSafeRunner
.All exceptions from the
run()
method are passed to this method, along with certainError
types that are typically caused by programming errors in the untrusted code being run.- Parameters:
exception
- an exception which occurred during processing the body of this runnable (i.e., inrun()
)- See Also:
-