|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.mmbase.clustering.unicast.ChangesSender
public class ChangesSender
ChangesSender is a runnable object sending the nodes found in the sending queue over unicast connections. Using
start() (and stop()) it can run itself in a dedicated thread.
Unicast| Nested Class Summary | |
|---|---|
static class |
ChangesSender.OtherMachine
On object to represent a peer in unicast. |
| Constructor Summary | |
|---|---|
ChangesSender(Map<String,String> configuration,
int unicastPort,
int unicastTimeout,
BlockingQueue<byte[]> nodesToSend,
Statistics send,
int version)
Construct UniCast Sender |
|
| Method Summary | |
|---|---|
protected Iterable<ChangesSender.OtherMachine> |
getOtherMachines()
Returns the peers to which must be connected. |
protected int |
remove(ChangesSender.OtherMachine remove)
|
void |
run()
|
protected long |
sendVersion1(InetSocketAddress address,
Collection<byte[]> data)
Sends a collection of messages to the given address. |
protected long |
sendVersion2(InetSocketAddress address,
Collection<byte[]> data)
Sends a collection of messages to the given address. |
void |
setCollectCount(int cc)
The maximum number of events to collect before starting to send (only if version >= 2) |
void |
setCollectTime(int ct)
The maximum time (in second) to collect events before starting to send (only if version >= 2) |
protected void |
setOtherMachines(Iterable<ChangesSender.OtherMachine> om)
|
void |
setOtherMachines(String s)
Sets the other machines (the 'peers') using a string to be parsed |
void |
start()
|
(package private) void |
stop()
|
protected long |
writeVersion1(OutputStream out,
byte[] d)
Simply writes one message to an output stream. |
protected long |
writeVersion2(OutputStream out,
Collection<byte[]> data)
Writes a number of messages to an output stream, according to 'version 2'protocol of unicast (supporting multiple messages per session) The encoding is as such. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ChangesSender(Map<String,String> configuration,
int unicastPort,
int unicastTimeout,
BlockingQueue<byte[]> nodesToSend,
Statistics send,
int version)
configuration - configuration of unicastunicastPort - port of the unicast connectionsunicastTimeout - timeout on the connectionsnodesToSend - Queue of messages to sendsend - Statistics| Method Detail |
|---|
protected void setOtherMachines(Iterable<ChangesSender.OtherMachine> om)
public void setOtherMachines(String s)
<hostname>:<portnumber>[:<name>[:<version>]],[<hostname>:<portnumber>[:<name>[:<version>]]...]
public void setCollectTime(int ct)
public void setCollectCount(int cc)
public void start()
void stop()
protected long writeVersion2(OutputStream out,
Collection<byte[]> data)
throws IOException
<number of message><size of first message><first message><size second message><second message>....
out - The stream to write the messages todata - The messages to write.
IOException
protected long sendVersion2(InetSocketAddress address,
Collection<byte[]> data)
throws IOException
writeVersion2(java.io.OutputStream, java.util.Collection) to
send the messages
address - The address to send to.data - The message to send
IOException
protected long writeVersion1(OutputStream out,
byte[] d)
throws IOException
IOException
protected long sendVersion1(InetSocketAddress address,
Collection<byte[]> data)
throws IOException
writeVersion1(java.io.OutputStream, byte[]) to
send the messages. The version 1 protocol supports only one message per session, so this method opens a new
connection for every message in the given collection.
address - The address to send to.data - The message to send
IOExceptionpublic void run()
run in interface Runnableprotected int remove(ChangesSender.OtherMachine remove)
protected Iterable<ChangesSender.OtherMachine> getOtherMachines()
getActiveServers()).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||