Class EventPublisher
- java.lang.Object
-
- org.ovirt.vdsm.jsonrpc.client.events.EventPublisher
-
- All Implemented Interfaces:
java.util.concurrent.Flow.Publisher<java.util.Map<java.lang.String,java.lang.Object>>
public class EventPublisher extends java.lang.Object implements java.util.concurrent.Flow.Publisher<java.util.Map<java.lang.String,java.lang.Object>>Jsonrpc implementation ofFlow.Publisher
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classEventPublisher.EventCallableEvent processing task which is submit to aExecutorServicefor processing.
-
Field Summary
Fields Modifier and Type Field Description private EventDecomposerdecomposerprivate inteventTimeoutInHoursprivate java.util.concurrent.ExecutorServiceexecutorServiceprivate static org.slf4j.Loggerlogprivate SubscriptionMatchermatcherprivate java.util.concurrent.ScheduledExecutorServicescheduledExecutorService
-
Constructor Summary
Constructors Constructor Description EventPublisher(java.util.concurrent.ExecutorService executorService, int eventTimeoutInHours)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidclean(SubscriptionHolder holder)voidcleanupOldEvents()voidclose()intcountEvents(JsonRpcEvent event)private voidprocess(SubscriptionHolder holder)voidprocess(JsonRpcEvent event)This method is used by @linkResponseWorkerto submit an @linkJsonRpcEventfor processing.voidpublish(java.lang.String subscriptionId, java.util.Map<java.lang.String,java.lang.Object> params)private voidscheduleCleanupTask()voidsubscribe(java.util.concurrent.Flow.Subscriber<? super java.util.Map<java.lang.String,java.lang.Object>> subscriber)
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
-
executorService
private final java.util.concurrent.ExecutorService executorService
-
scheduledExecutorService
private final java.util.concurrent.ScheduledExecutorService scheduledExecutorService
-
matcher
private final SubscriptionMatcher matcher
-
decomposer
private final EventDecomposer decomposer
-
eventTimeoutInHours
private final int eventTimeoutInHours
-
-
Method Detail
-
scheduleCleanupTask
private void scheduleCleanupTask()
-
cleanupOldEvents
public void cleanupOldEvents()
-
subscribe
public void subscribe(java.util.concurrent.Flow.Subscriber<? super java.util.Map<java.lang.String,java.lang.Object>> subscriber)
- Specified by:
subscribein interfacejava.util.concurrent.Flow.Publisher<java.util.Map<java.lang.String,java.lang.Object>>
-
publish
public void publish(java.lang.String subscriptionId, java.util.Map<java.lang.String,java.lang.Object> params) throws java.io.IOException- Throws:
java.io.IOException
-
process
private void process(SubscriptionHolder holder)
-
clean
private void clean(SubscriptionHolder holder)
-
process
public void process(JsonRpcEvent event)
This method is used by @linkResponseWorkerto submit an @linkJsonRpcEventfor processing.- Parameters:
event- which is submitted for processing.
-
countEvents
public int countEvents(JsonRpcEvent event)
-
close
public void close()
-
-