Class InMemoryChannelQueue
-
- All Implemented Interfaces:
-
com.jetbrains.fus.reporting.defaults.dispatcher.EventQueue
public final class InMemoryChannelQueue<E extends Object> implements EventQueue<E>
-
-
Field Summary
Fields Modifier and Type Field Description private final DurationdefaultDelayprivate SendInformationAggregatorsendInformationAggregator
-
Constructor Summary
Constructors Constructor Description InMemoryChannelQueue(FusLoggerFactory loggerFactory, Integer batchSize, Duration defaultDelay)
-
Method Summary
Modifier and Type Method Description DurationgetDefaultDelay()SendInformationAggregatorgetSendInformationAggregator()UnitsetSendInformationAggregator(SendInformationAggregator value)Unitenqueue(E item)Adds an item to the event queue. SendResultdequeue(SuspendFunction1<List<E>, Boolean> action)Dequeues a batch of events from the queue and processes them using the specified action. Unitclose()Closes the event queue, releasing any allocated resources or file handles. -
-
Method Detail
-
getDefaultDelay
Duration getDefaultDelay()
-
getSendInformationAggregator
SendInformationAggregator getSendInformationAggregator()
-
setSendInformationAggregator
Unit setSendInformationAggregator(SendInformationAggregator value)
-
dequeue
SendResult dequeue(SuspendFunction1<List<E>, Boolean> action)
Dequeues a batch of events from the queue and processes them using the specified action.
This method must be thread-safe. Use Mutex to ensure exclusive access to the queue if necessary.
Also, action is expected not to throw exceptions. If an exception is thrown, it will be interpreted as a catastrophic problem with the event log data and the respective data should be discarded.
- Returns:
A pair containing a boolean indicating if the operation was successful, and the duration to delay before the next dequeue attempt. Duration may be zero if dequeue can be executed immediately
-
close
Unit close()
Closes the event queue, releasing any allocated resources or file handles.
This method ensures that the underlying resources, such as files or connections, associated with the event queue are properly closed and cleaned up. It should be called when the event queue is no longer needed to prevent resource leaks.
-
-
-
-