Package com.daml.grpc.adapter
Class SingleThreadExecutionSequencer
- java.lang.Object
-
- com.daml.grpc.adapter.SingleThreadExecutionSequencer
-
- All Implemented Interfaces:
ExecutionSequencer
,java.lang.AutoCloseable
public class SingleThreadExecutionSequencer extends java.lang.Object implements ExecutionSequencer
Ensures serial execution and thread safety of Runnables by using a single thread underneath.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
sequence(java.lang.Runnable runnable)
Runs the argument asynchronously in an environment that assures the following: - The runnables passed in will be executed one at a time, sequentially.
-
-
-
Method Detail
-
sequence
public void sequence(java.lang.Runnable runnable)
Description copied from interface:ExecutionSequencer
Runs the argument asynchronously in an environment that assures the following: - The runnables passed in will be executed one at a time, sequentially. - The runnables don't need to concern themselves with synchronization and visibility of the mutable state that they modify if that is accessed only by Runnables that are passed to this method.- Specified by:
sequence
in interfaceExecutionSequencer
- Parameters:
runnable
- Will be executed asynchronously.
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
-