Package io.a2a.server.events
Class InMemoryQueueManager
java.lang.Object
io.a2a.server.events.InMemoryQueueManager
- All Implemented Interfaces:
QueueManager
-
Constructor Summary
ConstructorsConstructorDescriptionInMemoryQueueManager(EventQueueFactory factory, TaskStateProvider taskStateProvider) InMemoryQueueManager(TaskStateProvider taskStateProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(String taskId, EventQueue queue) voidawaitQueuePollerStart(EventQueue eventQueue) voidcreateOrTap(String taskId) intgetActiveChildQueueCount(String taskId) Get the count of active child queues for a given task.getCleanupCallback(String taskId) Get the cleanup callback that removes a queue from the map when it closes.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.a2a.server.events.QueueManager
getEventQueueBuilder
-
Constructor Details
-
InMemoryQueueManager
-
InMemoryQueueManager
-
-
Method Details
-
add
- Specified by:
addin interfaceQueueManager
-
get
- Specified by:
getin interfaceQueueManager
-
tap
- Specified by:
tapin interfaceQueueManager
-
close
- Specified by:
closein interfaceQueueManager
-
createOrTap
- Specified by:
createOrTapin interfaceQueueManager
-
awaitQueuePollerStart
- Specified by:
awaitQueuePollerStartin interfaceQueueManager- Throws:
InterruptedException
-
getActiveChildQueueCount
Description copied from interface:QueueManagerGet the count of active child queues for a given task. Used for testing to verify reference counting mechanism.- Specified by:
getActiveChildQueueCountin interfaceQueueManager- Parameters:
taskId- the task ID- Returns:
- number of active child queues, or -1 if queue doesn't exist
-
getCleanupCallback
Get the cleanup callback that removes a queue from the map when it closes. This is exposed so that subclasses (like ReplicatedQueueManager) can reuse this cleanup logic while adding their own callbacks in the correct order.The cleanup callback checks if the task is finalized before removing the queue. If the task is not finalized, the queue remains in the map to handle late-arriving events.
- Parameters:
taskId- the task ID for the queue- Returns:
- a Runnable that removes the queue from the map if appropriate
-