Class ThrowableSuppressingRunnable

  • All Implemented Interfaces:
    java.lang.Runnable, RunnableContainer

    public class ThrowableSuppressingRunnable
    extends java.lang.Object
    implements RunnableContainer, java.lang.Runnable
    Class that is designed to wrap a runnable, and prevent any throwables from propagating out of the run function. If a throwable is thrown, it will be provided to ExceptionUtils.handleException(Throwable).
    Since:
    4.6.0 (since 2.3.0 at org.threadly.concurrent)
    • Constructor Summary

      Constructors 
      Constructor Description
      ThrowableSuppressingRunnable​(java.lang.Runnable task)
      Constructs a new ThrowableSurpressingRunnable with the provided task.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Runnable getContainedRunnable()
      Call to get the contained runnable within the wrapper.
      void run()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ThrowableSuppressingRunnable

        public ThrowableSuppressingRunnable​(java.lang.Runnable task)
        Constructs a new ThrowableSurpressingRunnable with the provided task. If the task is null, when this is run no operation will occur.
        Parameters:
        task - task to be executed and have exceptions prevented from being thrown
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • getContainedRunnable

        public java.lang.Runnable getContainedRunnable()
        Description copied from interface: RunnableContainer
        Call to get the contained runnable within the wrapper.
        Specified by:
        getContainedRunnable in interface RunnableContainer
        Returns:
        runnable contained, or null if none is contained