java.lang.Object
net.i2p.i2ptunnel.streamr.Subscriber
- All Implemented Interfaces:
Sink
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classTimer event that expires stale subscriptions.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final I2PAppContextThe app context.private static final longTime before a subscriber expires.private final LogThe log for the subscriber.private static final intMost subscribers allowed.private final MultiSourceThe multi source being subscribed to.private final Map<MultiSource.MSink, Long> The subscribers, with their expiration times.private final SimpleTimer2.TimedEventThe timer expiring the subscribers.private booleanTrue while the timer runs.Constructor Summary
ConstructorsConstructorDescriptionSubscriber(MultiSource multi) Creates a new subscriber for managing data source connections.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidsend(Destination dest, int fromPort, int toPort, byte[] data) Handles subscription or unsubscription requests.
Field Details
ctx
The app context.log
The log for the subscriber.subscriptions
The subscribers, with their expiration times.multi
The multi source being subscribed to.timer
The timer expiring the subscribers.timerRunning
private volatile boolean timerRunningTrue while the timer runs.MAX_SUBSCRIPTIONS
EXPIRATION
Constructor Details
Subscriber
Creates a new subscriber for managing data source connections.- Parameters:
multi- the multi-source to register subscriptions with
Method Details
send
Handles subscription or unsubscription requests. Does not really "send" anywhere; instead interprets the data byte as a control command.