Package org.opennms.core.ipc.sink.common
Class AsyncDispatcherImpl<W,S extends Message,T extends Message>
- java.lang.Object
-
- org.opennms.core.ipc.sink.common.AsyncDispatcherImpl<W,S,T>
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,AsyncDispatcher<S>
public class AsyncDispatcherImpl<W,S extends Message,T extends Message> extends java.lang.Object implements AsyncDispatcher<S>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opennms.core.ipc.sink.api.AsyncDispatcher
AsyncDispatcher.DispatchStatus
-
-
Constructor Summary
Constructors Constructor Description AsyncDispatcherImpl(DispatcherState<W,S,T> state, AsyncPolicy asyncPolicy, SyncDispatcher<S> syncDispatcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
long
getMissedFutures()
int
getQueueSize()
Returns the number of messages that are currently queued awaiting for dispatch.java.util.concurrent.CompletableFuture<AsyncDispatcher.DispatchStatus>
send(S message)
Asynchronously send the given message.
-
-
-
Constructor Detail
-
AsyncDispatcherImpl
public AsyncDispatcherImpl(DispatcherState<W,S,T> state, AsyncPolicy asyncPolicy, SyncDispatcher<S> syncDispatcher)
-
-
Method Detail
-
send
public java.util.concurrent.CompletableFuture<AsyncDispatcher.DispatchStatus> send(S message)
Description copied from interface:AsyncDispatcher
Asynchronously send the given message.- Specified by:
send
in interfaceAsyncDispatcher<W>
- Parameters:
message
- the message to send- Returns:
- a future that is resolved once the message was dispatched or queued
-
getMissedFutures
public long getMissedFutures()
-
getQueueSize
public int getQueueSize()
Description copied from interface:AsyncDispatcher
Returns the number of messages that are currently queued awaiting for dispatch.- Specified by:
getQueueSize
in interfaceAsyncDispatcher<W>
- Returns:
- current queue size
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
-