@@ -50,7 +50,7 @@ public class LiveStreamMediatorImpl implements StreamMediator<ObjectEvent<BlockI
50
50
private final Map <
51
51
BlockItemEventHandler <ObjectEvent <BlockItem >>,
52
52
BatchEventProcessor <ObjectEvent <BlockItem >>>
53
- subscribers = new HashMap <>() ;
53
+ subscribers ;
54
54
55
55
private final BlockPersistenceHandler <BlockItem , Block > blockPersistenceHandler ;
56
56
private final Consumer <StreamMediator <ObjectEvent <BlockItem >, BlockItem >> shutdownCallback ;
@@ -61,8 +61,13 @@ public class LiveStreamMediatorImpl implements StreamMediator<ObjectEvent<BlockI
61
61
* @param blockPersistenceHandler the block persistence handler
62
62
*/
63
63
public LiveStreamMediatorImpl (
64
+ final Map <
65
+ BlockItemEventHandler <ObjectEvent <BlockItem >>,
66
+ BatchEventProcessor <ObjectEvent <BlockItem >>>
67
+ subscribers ,
64
68
final BlockPersistenceHandler <BlockItem , Block > blockPersistenceHandler ,
65
69
final Consumer <StreamMediator <ObjectEvent <BlockItem >, BlockItem >> shutdownCallback ) {
70
+ this .subscribers = subscribers ;
66
71
this .blockPersistenceHandler = blockPersistenceHandler ;
67
72
68
73
// Initialize and start the disruptor
@@ -73,6 +78,12 @@ public LiveStreamMediatorImpl(
73
78
this .shutdownCallback = shutdownCallback ;
74
79
}
75
80
81
+ public LiveStreamMediatorImpl (
82
+ final BlockPersistenceHandler <BlockItem , Block > blockPersistenceHandler ,
83
+ final Consumer <StreamMediator <ObjectEvent <BlockItem >, BlockItem >> shutdownCallback ) {
84
+ this (new HashMap <>(), blockPersistenceHandler , shutdownCallback );
85
+ }
86
+
76
87
@ Override
77
88
public void publishEvent (BlockItem blockItem ) {
78
89
@@ -101,6 +112,7 @@ public void subscribe(final BlockItemEventHandler<ObjectEvent<BlockItem>> handle
101
112
ringBuffer .addGatingSequences (batchEventProcessor .getSequence ());
102
113
executor .execute (batchEventProcessor );
103
114
115
+ // Keep track of the subscriber
104
116
subscribers .put (handler , batchEventProcessor );
105
117
}
106
118
0 commit comments