public class SpreadWrapperImpl extends AbstractActivatable implements SpreadWrapper
SpreadWrapper.ConnectionState
Activatable.State
Constructor and Description |
---|
SpreadWrapperImpl(SpreadOptions options)
Creates a new instance for the given settings.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates all resources that belong to a specific object.
|
void |
deactivate()
Deactivate all resources that are owned by a specific object in order to
correctly tear down.
|
String |
getPrivateGroup()
Returns the name of the private spread group for the wrapped connection.
|
InetAddress |
getSpreadhost() |
SpreadWrapper.ConnectionState |
getStatus()
Indicates the current state of the underlying connection.
|
URI |
getTransportUri()
Returns the transport URI for this spread connection.
|
boolean |
isActive()
Tells whether this class is currently active or not.
|
boolean |
isConnected()
Indicate whether this wrapper is currently successfully connected to a
spread daemon.
|
boolean |
isShutdown()
Indicate whether a shutdown was requested.
|
boolean |
isUseTcpNoDelay() |
void |
join(String group)
If connected, joins the specified group.
|
void |
leave(String group)
If connected and joined, leaves the specified group.
|
spread.SpreadMessage |
receive()
Receive the next message from the spread connection in groups this
wrapper has joined.
|
void |
send(DataMessage msg)
Sends the given message.
|
close
public SpreadWrapperImpl(SpreadOptions options) throws UnknownHostException
activate()
.options
- the options to use for the connectionUnknownHostException
- host name cannot be resolvedpublic SpreadWrapper.ConnectionState getStatus()
SpreadWrapper
getStatus
in interface SpreadWrapper
public InetAddress getSpreadhost()
getSpreadhost
in interface SpreadWrapper
public boolean isUseTcpNoDelay()
isUseTcpNoDelay
in interface SpreadWrapper
public void join(String group) throws spread.SpreadException
SpreadWrapper
join
in interface SpreadWrapper
group
- group to joinspread.SpreadException
- error joiningpublic void send(DataMessage msg)
SpreadWrapper
send
in interface SpreadWrapper
msg
- the message to sendpublic void deactivate() throws RSBException
Activatable
deactivate
in interface Activatable
RSBException
- generic error related to RSBpublic void leave(String group)
SpreadWrapper
leave
in interface SpreadWrapper
group
- the group to leavepublic void activate() throws InitializeException
Activatable
activate
in interface Activatable
InitializeException
public boolean isActive()
Activatable
isActive
in interface Activatable
true
if activepublic String getPrivateGroup()
SpreadWrapper
getPrivateGroup
in interface SpreadWrapper
null
if not connected so far.public boolean isConnected()
SpreadWrapper
isConnected
in interface SpreadWrapper
true
if connected, else false
public spread.SpreadMessage receive() throws InterruptedIOException, spread.SpreadException
SpreadWrapper
receive
in interface SpreadWrapper
InterruptedIOException
- interrupted while waiting for the messagespread.SpreadException
- error while reading the next messagepublic boolean isShutdown()
SpreadWrapper
isShutdown
in interface SpreadWrapper
true
if requested.public URI getTransportUri()
SpreadWrapper
getTransportUri
in interface SpreadWrapper
Copyright © 2018 CoR-Lab. All rights reserved.