public class ServerTransport extends ReceiverAdapter implements RtTransport
Modifier and Type | Field and Description |
---|---|
protected InetAddress |
host |
protected Log |
log |
protected boolean |
nio |
protected int |
port |
protected RtReceiver |
receiver |
protected boolean |
server |
protected BaseServer |
srv |
Constructor and Description |
---|
ServerTransport() |
Modifier and Type | Method and Description |
---|---|
List<Object> |
clusterMembers()
Returns the addresses of all cluster members.
|
Object |
localAddress()
Returns the local addres of this member.
|
String[] |
options()
Prints the accepted options, e.g.
|
void |
options(String... options)
Sets options on this transport.
|
void |
receive(Address sender,
byte[] buf,
int offset,
int length)
Delivers a message from a given sender to the application
|
void |
receive(Address sender,
DataInput in) |
void |
receiver(RtReceiver receiver)
Sets the receiver whose
RtReceiver.receive(Object,byte[],int,int) callback will be invoked whenever a
message is received |
void |
send(Object dest,
byte[] buf,
int offset,
int length)
Sends a message
|
void |
start(String... options)
Starts the transport, e.g.
|
void |
stop()
Stops the transport, e.g.
|
receive
protected BaseServer srv
protected RtReceiver receiver
protected InetAddress host
protected int port
protected boolean server
protected boolean nio
protected final Log log
public String[] options()
RtTransport
options
in interface RtTransport
public void options(String... options) throws Exception
RtTransport
RtTransport.start(String...)
is called,
but may also be called at runtime.options
in interface RtTransport
options
- The optionsException
public void receiver(RtReceiver receiver)
RtTransport
RtReceiver.receive(Object,byte[],int,int)
callback will be invoked whenever a
message is receivedreceiver
in interface RtTransport
public Object localAddress()
RtTransport
localAddress
in interface RtTransport
public List<Object> clusterMembers()
RtTransport
clusterMembers
in interface RtTransport
public void start(String... options) throws Exception
RtTransport
start
in interface RtTransport
options
- Options passed to the transport at startup time. May be nullException
public void stop()
RtTransport
stop
in interface RtTransport
public void send(Object dest, byte[] buf, int offset, int length) throws Exception
RtTransport
send
in interface RtTransport
dest
- The destination addressbuf
- The bufferoffset
- The offset at which the data startslength
- The length (in bytes) of the data to sendException
public void receive(Address sender, byte[] buf, int offset, int length)
Receiver
receive
in interface Receiver
receive
in class ReceiverAdapter
sender
- The sender of the messagebuf
- The buffer. An application typically de-serializes data from the buffer into objects used by the
application. Note that when receive() returns, it is not safe to use the buffer any longer;
if an application needs to use a buffer after this callback returns, it must make a copy.offset
- The offset at which the received data startslength
- The length of the received dataCopyright © 2018 JBoss, a division of Red Hat. All rights reserved.