Class TimeLimitedCodeBlock


  • public class TimeLimitedCodeBlock
    extends Object
    Since:
    3.0.0
    Author:
    AgileLARUS
    • Method Detail

      • runWithTimeout

        public static void runWithTimeout​(Runnable runnable,
                                          long timeout,
                                          TimeUnit timeUnit)
        This method is used to run a specific Runnable for at most a timeout period of time. If a timeout of 0 is set then no timeout will be applied.
        Parameters:
        runnable - The runnable to run
        timeout - The maximum time a run should last
        timeUnit - The TimeUnit unit for the timeout
        Throws:
        Neo4jJdbcRuntimeException - Any exception thrown by the runnable wrapped.