Interface LockableScriptEngine

All Superinterfaces:
ScriptEngine

@NonNullByDefault public interface LockableScriptEngine extends ScriptEngine
This interface is used to indicate that a ScriptEngine is lockable, i.e. that it doesn't support concurrency and should run scripts inside a lock.
Author:
Ravi Nadahar - Initial contribution
  • Method Details

    • getLock

      Lock getLock()
      Returns:
      The Lock instance that should be used to guard script execution.
    • getLockAcquisitionTimeoutMs

      default long getLockAcquisitionTimeoutMs()
      Get the lock acquisition timeout for use with Lock.tryLock(long, java.util.concurrent.TimeUnit). The lock should always be acquired with a timeout to avoid deadlocks.
      Returns:
      The timeout period to wait when trying to acquire the Lock in milliseconds before considering the acquisition a failure.
      Implementation note:
      A default implementation with a 5 seconds timeout exists.