public class SpreadReceiver extends AbstractActivatable
Constructor and Description |
---|
SpreadReceiver(SpreadWrapper spread,
ConverterSelectionStrategy<ByteBuffer> converters)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates all resources that belong to a specific object.
|
void |
addHandler(EventHandler handler)
Adds a handler to be called on every new event received.
|
void |
deactivate()
Deactivate all resources that are owned by a specific object in order to
correctly tear down.
|
URI |
getTransportUri()
Returns a URI representing the RSB transport encapsulated by this
instance.
|
boolean |
isActive()
Tells whether this class is currently active or not.
|
void |
join(String groupName)
Join a spread group.
|
void |
leave(String groupName)
Leave a previously joined group.
|
boolean |
removeHandler(EventHandler handler)
Removes a handler from set of registered handlers.
|
close
public SpreadReceiver(SpreadWrapper spread, ConverterSelectionStrategy<ByteBuffer> converters)
spread
- the spread wrapper object to use for the underlying operationsconverters
- the converters to user for receivingpublic void activate() throws RSBException
Activatable
RSBException
- generic error related to RSBpublic void deactivate() throws RSBException, InterruptedException
Activatable
RSBException
- generic error related to RSBInterruptedException
- interrupted while waiting for proper deactivation. Object
might be in an undefined state nowpublic boolean isActive()
Activatable
true
if activepublic void addHandler(EventHandler handler)
handler
- the handler to add. not null
public boolean removeHandler(EventHandler handler)
handler
- handler to removetrue
if the handler was registered before and
removed successfully nowpublic void join(String groupName) throws RSBException, InterruptedException
groupName
- name of the spread group, not null
, must be <=
SpreadUtilities.MAX_GROUP_NAME_LENGTH
RSBException
- unable to join the groupInterruptedException
- interrupted while waiting for the joining to become activepublic void leave(String groupName) throws RSBException, InterruptedException
groupName
- name of the group, not null
RSBException
- unable to leave the groupInterruptedException
- interrupted while waiting for the leave to become activepublic URI getTransportUri()
Copyright © 2018 CoR-Lab. All rights reserved.