public class GrpcMessagingContext extends Object
ScheduledExecutorService
to schedule events on the context thread.Constructor and Description |
---|
GrpcMessagingContext(GrpcMessagingThreadFactory factory,
io.atomix.catalyst.serializer.Serializer serializer)
Constructs a new single thread
GrpcMessagingContext . |
GrpcMessagingContext(ScheduledExecutorService executor,
io.atomix.catalyst.serializer.Serializer serializer)
Constructs a new single thread
GrpcMessagingContext . |
GrpcMessagingContext(String nameFormat,
io.atomix.catalyst.serializer.Serializer serializer)
Constructs a new
GrpcMessagingContext . |
GrpcMessagingContext(Thread thread,
ScheduledExecutorService executor,
io.atomix.catalyst.serializer.Serializer serializer)
Constructs a new
GrpcMessagingContext . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the context.
|
CompletableFuture<Void> |
execute(Runnable callback)
Executes the given callback.
|
<T> CompletableFuture<T> |
execute(java.util.function.Supplier<T> callback)
Executes the given callback.
|
Executor |
executor() |
protected static GrpcMessagingThread |
getThread(ExecutorService executor)
Gets the thread from a single threaded executor service.
|
org.apache.http.concurrent.Cancellable |
schedule(java.time.Duration delay,
java.time.Duration interval,
Runnable runnable)
Submits a one-shot task that becomes enabled after the given delay.
|
org.apache.http.concurrent.Cancellable |
schedule(java.time.Duration delay,
Runnable runnable)
Submits a one-shot task that becomes enabled after the given delay.
|
io.atomix.catalyst.serializer.Serializer |
serializer() |
public GrpcMessagingContext(String nameFormat, io.atomix.catalyst.serializer.Serializer serializer)
GrpcMessagingContext
.nameFormat
- the name format used when instantiating the context threadserializer
- the context serializerpublic GrpcMessagingContext(GrpcMessagingThreadFactory factory, io.atomix.catalyst.serializer.Serializer serializer)
GrpcMessagingContext
.factory
- factory to use when creating the new threadserializer
- the serializerpublic GrpcMessagingContext(ScheduledExecutorService executor, io.atomix.catalyst.serializer.Serializer serializer)
GrpcMessagingContext
.executor
- the single thread scheduled executor to schedule events onserializer
- the serializerpublic GrpcMessagingContext(Thread thread, ScheduledExecutorService executor, io.atomix.catalyst.serializer.Serializer serializer)
GrpcMessagingContext
.thread
- the threadexecutor
- the executorserializer
- the serializerprotected static GrpcMessagingThread getThread(ExecutorService executor)
public io.atomix.catalyst.serializer.Serializer serializer()
public Executor executor()
public org.apache.http.concurrent.Cancellable schedule(java.time.Duration delay, Runnable runnable)
delay
- the time from now to delay executionrunnable
- the task to executepublic org.apache.http.concurrent.Cancellable schedule(java.time.Duration delay, java.time.Duration interval, Runnable runnable)
delay
- the time from now to delay executioninterval
- the interval between successive executionsrunnable
- the task to executepublic void close()
public CompletableFuture<Void> execute(Runnable callback)
callback
- the callback to executepublic <T> CompletableFuture<T> execute(java.util.function.Supplier<T> callback)
T
- the supplier typecallback
- the callback to executeCopyright © 2023. All Rights Reserved.