|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectus.ihmc.mockets.Mocket.Sender
public class Mocket.Sender
The class used to send messages over Mockets.
Obtained by calling getSender
on an instance of Mocket.
Note: messages may also be sent using the Mocket class directly, this class makes it
more convenient by having default or configurable values for some of the parameters.
Constructor Summary | |
---|---|
Mocket.Sender()
|
Method Summary | |
---|---|
int |
cancel(int tagId)
Cancels (deletes) previously enqueued messages that have been tagged with the specified tag. |
protected void |
finalize()
Removes mocket object. |
int |
gsend(byte[] buf1,
byte[] buf2)
|
int |
gsend(byte[] buf1,
byte[] buf2,
byte[] buf3)
|
int |
gsend(byte[] buf1,
byte[] buf2,
byte[] buf3,
byte[] buf4)
|
int |
gsend(byte[] buf1,
int offset1,
int length1,
byte[] buf2,
int offset2,
int length2)
|
int |
gsend(byte[] buf1,
int offset1,
int length1,
byte[] buf2,
int offset2,
int length2,
byte[] buf3,
int offset3,
int length3)
|
int |
gsend(byte[] buf1,
int offset1,
int length1,
byte[] buf2,
int offset2,
int length2,
byte[] buf3,
int offset3,
int length3,
byte[] buf4,
int offset4,
int length4)
|
int |
replace(byte[] buffer,
int oldTag,
int newTag)
First cancels any previously enqueued messages that have been tagged with the specified OldTag
value and then transmits the new message using the specified parameters. |
int |
replace(byte[] buffer,
int offset,
int length,
int oldTag,
int newTag)
First cancels any previously enqueued messages that have been tagged with the specified OldTag
value and then transmits the new message using the specified parameters. |
int |
replace(byte[] buffer,
int offset,
int length,
int oldTag,
int newTag,
short priority,
long enqueueTimeout,
long retryTimeout)
First cancels any previously enqueued messages that have been tagged with the specified OldTag
value and then transmits the new message using the specified parameters. |
int |
replace(byte[] buffer,
int offset,
int length,
int oldTag,
Params params)
First cancels any previously enqueued messages that have been tagged with the specified OldTag
value and then transmits the new message using the specified parameters. |
int |
replace(byte[] buffer,
int oldTag,
int newTag,
short priority,
long enqueueTimeout,
long retryTimeout)
First cancels any previously enqueued messages that have been tagged with the specified OldTag
value and then transmits the new message using the specified parameters. |
int |
replace(byte[] buffer,
int oldTag,
Params params)
First cancels any previously enqueued messages that have been tagged with the specified OldTag
value and then transmits the new message using the specified parameters. |
int |
send(byte[] buffer)
Basic send function. |
int |
send(byte[] buffer,
int offset,
int length)
Basic send function. |
int |
send(byte[] buffer,
int offset,
int length,
int iTag,
short sPriority)
Enqueues data for transmission using the specified parameters. |
int |
send(byte[] buffer,
int offset,
int length,
int iTag,
short Priority,
long EnqueueTimeout,
long RetryTimeout)
Enqueues data for transmission using the specified parameters. |
int |
send(byte[] buffer,
int offset,
int length,
Params pParams)
Enqueues data for transmission using the specified parameters. |
int |
send(byte[] buffer,
int iTag,
short sPriority)
Enqueues data for transmission using the specified parameters. |
int |
send(byte[] buffer,
int iTag,
short sPriority,
long lEnqueueTimeout,
long lRetryTimeout)
Enqueues data for transmission using the specified parameters. |
int |
send(byte[] buffer,
Params pParams)
Enqueues data for transmission using the specified parameters. |
void |
setDefaultEnqueueTimeout(long enqueueTimeout)
Sets the default timeout for enqueuing data into the outgoing queue. |
void |
setDefaultRetryTimeout(long retryTimeout)
Sets the default timeout for retransmission of reliable packets that have not been acknowledged. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Mocket.Sender()
Method Detail |
---|
public int send(byte[] buffer) throws java.io.IOException, java.lang.IllegalArgumentException
Sender
.
Several communication parameter are not specified, the default value is going to be used
for the following parameters:
tag = 0,
priority = 5,
enqueue timeout = 0 or a value set using the method setDefaultEnqueueTimeout
,
retry timeout = 0 or a value set using the method setDefaultRetryTimeout
.
buffer
- the buffer to be sent. The buffer is going to be sent entirely.
0
if the message is successfully enqueued to be sent.-1
if the connection is not in the state ESTABLISHED,
it is not established yet or one of the peers called close
;-2
if adding the data chunk to a packet fails;-3
if inserting into pendingPacketQueue
fails;-10
if MessageSender
is not initialized, MessageSender
is null;-11
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
Mocket.getSender(boolean, boolean)
public int send(byte[] buffer, int offset, int length) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
length
bytes
starting at offset
and enqueues the data for transmission. The delivery will
use the type of flow defined in the constructor of class Sender
.
Several communication parameter are not specified, the default value is going to be used
for the following parameters:
tag = 0,
priority = 5,
enqueue timeout = 0 or a value set using the method setDefaultEnqueueTimeout
,
retry timeout = 0 or a value set using the method setDefaultRetryTimeout
.
buffer
- the buffer to be sent.offset
- the position in the buffer we start to send from.
E.g. offset=10, we send buffer starting at the 10th byte in the arraylength
- the length for which we send.
E.g. length=50 we send 50 bytes of the buffer, starting at offset.
If offset=10, length=50 we send bytes from position 10 in the
buffer through position 60.
0
if the message is successfully enqueued to be sent.-1
if the connection is not in the state ESTABLISHED,
it is not established yet or one of the peers called close
;-2
if adding the data chunk to a packet fails;-3
if inserting into pendingPacketQueue
fails;-10
if MessageSender
is not initialized, MessageSender
is null;-11
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
- if the parameters offset
or
length
are illegal for buffer
.Mocket.getSender(boolean, boolean)
public int send(byte[] buffer, int iTag, short sPriority) throws java.io.IOException, java.lang.IllegalArgumentException
Sender
.
Several communication parameter are not specified, the default value is going to be used
for the following parameters:
enqueue timeout = 0 or a value set using the method setDefaultEnqueueTimeout
,
retry timeout = 0 or a value set using the method setDefaultRetryTimeout
.
buffer
- the buffer to be sent. The buffer is going to be sent entirely.iTag
- integer value that can be used to mark a flow of messages belonging to
the same type. The value has to be >0.sPriority
- used to assign a priority different than the default one (higher or lower).
The value has to be >0. Note that the priority of a message will grow every
time it is skipped in favor of a higher priority messages that gets sent first.
This mechanism is implemented to avoid message starvation. The range of priority values is 0-255.
0
if the message is successfully enqueued to be sent;-1
if the connection is not in the state ESTABLISHED,
it is not established yet or one of the peers called close
;-2
if adding the data chunk to a packet fails;-3
if inserting into pendingPacketQueue
fails;-10
if the parameters iTag
or sPriority
are illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
replace
and cancel
to take advantage of iTag
.",
Mocket.getSender(boolean, boolean)
public int send(byte[] buffer, int offset, int length, int iTag, short sPriority) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
length
bytes starting at
offset
and enqueues the data for transmission. This send function allows to
specify a tag and a priority for the data to be sent.
Data will be delivered using the type of flow defined in the constructor of class Sender
.
Several communication parameter are not specified, the default value is going to be used
for the following parameters:
enqueue timeout = 0 or a value set using the method setDefaultEnqueueTimeout
,
retry timeout = 0 or a value set using the method setDefaultRetryTimeout
.
buffer
- the buffer to be sent.offset
- the position in the buffer we start to send from.
E.g. offset=10, we send buffer starting at the 10th byte in the arraylength
- the length for which we send.
E.g. length=50 we send 50 bytes of the buffer, starting at offset.
If offset=10, length=50 we send bytes from position 10 in the
buffer through position 60.iTag
- integer value that can be used to mark a flow of messages belonging to
the same type. The value has to be >0.sPriority
- used to assign a priority different than the default one (higher or lower).
The value has to be >0. Note that the priority of a message will grow every
time it is skipped in favor of a higher priority messages that gets sent first.
This mechanism is implemented to avoid message starvation. The range of priority values is 0-255.
0
if the message is successfully enqueued to be sent;-1
if the connection is not in the state ESTABLISHED,
it is not established yet or one of the peers called close
;-2
if adding the data chunk to a packet fails;-3
if inserting into pendingPacketQueue
fails;-10
if the parameters iTag
or sPriority
are illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
- if the parameters offset
or
length
are illegal for buffer
.replace
and cancel
to take advantage of iTag
.",
Mocket.getSender(boolean, boolean)
public int send(byte[] buffer, Params pParams) throws java.io.IOException, java.lang.IllegalArgumentException
buffer
for transmission, and allows to specify
a parameter of type Param
that will contain information about tag, priority, enqueueTimeout
and retryTimeout.
buffer
- the buffer to be sent. The buffer is going to be sent entirely.pParams
- an instance of class Param
that contains: tag, priority, enqueueTimeout, retryTimeout.
0
if the message is successfully enqueued to be sent;-1
if the connection is not in the state ESTABLISHED,
it is not established yet or one of the peers called close
;-2
if add the data chunk to a packet failed;-3
if insert into pendingPacketQueue
failed;-10
if MessageSender
is not initialized, MessageSender
is null;-11
if the parameter buffer
is invalid, buffer
is null;-12
if the parameter pParams
is invalid, pParams
is null.java.io.IOException
java.lang.IllegalArgumentException
Params
,
Mocket.getSender(boolean, boolean)
public int send(byte[] buffer, int offset, int length, Params pParams) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
length
bytes starting at offset
and enqueues the data for transmission. This send function allows to specify a parameter of type
Param
that will contain information about tag, priority, enqueueTimeout and retryTimeout.
buffer
- the buffer to be sent.offset
- the position in the buffer we start to send from.
E.g. offset=10, we send buffer starting at the 10th byte in the arraylength
- the length for which we send.
E.g. length=50 we send 50 bytes of the buffer, starting at offset.
If offset=10, length=50 we send bytes from position 10 in the
buffer through position 60.pParams
- an instance of class Param
that contains: tag, priority, enqueueTimeout, retryTimeout.
0
if the message is successfully enqueued to be sent;-1
if the connection is not in the state ESTABLISHED,
it is not established yet or one of the peers called close
;-2
if add the data chunk to a packet failed;-3
if insert into pendingPacketQueue
failed;-10
if MessageSender
is not initialized, MessageSender
is null;-11
if the parameter buffer
is invalid, buffer
is null;-12
if the parameter pParams
is invalid, pParams
is null.java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
- if the parameters offset
or
length
are illegal for buffer
.Params
,
Mocket.getSender(boolean, boolean)
public int send(byte[] buffer, int iTag, short sPriority, long lEnqueueTimeout, long lRetryTimeout) throws java.io.IOException, java.lang.IllegalArgumentException
buffer
for transmission allowing to specify
a tag, a priority, the enqueue timeout and the retry timeout for the data to be sent.
Given a byte array to be sent this function delivers the data using the type of flow defined in the
constructor of class Sender
.
buffer
- the buffer to be sent. The buffer is going to be sent entirely.iTag
- integer value that can be used to mark a flow of messages belonging to
the same type. The value has to be >0.sPriority
- used to assign a priority different than the default one (higher or lower).
The value has to be >0. Note that the priority of a message will grow every
time it is skipped in favor of a higher priority messages that gets sent first.
This mechanism is implemented to avoid message starvation. The range of priority
values is 0-255.lEnqueueTimeout
- indicates the length of time in milliseconds for which the method will wait
if there is no room in the outgoing buffer. A zero value indicates wait forever.lRetryTimeout
- indicates the length of time for which the transmitter will retransmit the packet
to ensure successful delivery. A zero value indicates retry with no time limit.
Note that this parameter makes sense only if the flow is reliable, otherwise the
behavior is to transmit and forget about the packet.
0
if the message is successfully enqueued to be sent;-1
if the connection is not in the state ESTABLISHED,
it is not established yet or one of the peers called close
;-2
if add the data chunk to a packet failed;-3
if insert into pendingPacketQueue
failed;-10
if the parameters are illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
setDefaultEnqueueTimeout(long)
,
setDefaultRetryTimeout(long)
,
"replace
and cancel
to take advantage of iTag
.",
Mocket.getSender(boolean, boolean)
public int send(byte[] buffer, int offset, int length, int iTag, short Priority, long EnqueueTimeout, long RetryTimeout) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
length
bytes starting at
offset
and enqueues the data for transmission. This send function also allows to specify
a tag, a priority, the enqueue timeout and the retry timeout for the data to be sent.
The data to be sent will be delivered using the type of flow defined in the constructor of class Sender
.
buffer
- the buffer to be sent.offset
- the position in the buffer we start to send from.
E.g. offset=10, we send buffer starting at the 10th byte in the arraylength
- the length for which we send.
E.g. length=50 we send 50 bytes of the buffer, starting at offset.
If offset=10, length=50 we send bytes from position 10 in the
buffer through position 60.iTag
- integer value that can be used to mark a flow of messages belonging to
the same type. The value has to be >0.Priority
- used to assign a priority different than the default one (higher or lower).
The value has to be >0. Note that the priority of a message will grow every
time it is skipped in favor of a higher priority messages that gets sent first.
This mechanism is implemented to avoid message starvation. The range of priority
values is 0-255.EnqueueTimeout
- indicates the length of time in milliseconds for which the method will wait
if there is no room in the outgoing buffer. A zero value indicates wait forever.RetryTimeout
- indicates the length of time for which the transmitter will retransmit the packet
to ensure successful delivery. A zero value indicates retry with no time limit.
Note that this parameter makes sense only if the flow is reliable, otherwise the
behavior is to transmit and forget about the packet.
0
if the message is successfully enqueued to be sent;-1
if the connection is not in the state ESTABLISHED,
it is not established yet or one of the peers called close
;-2
if add the data chunk to a packet failed;-3
if insert into pendingPacketQueue
failed;-10
if the parameters are illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
- if the parameters offset
or
length
are illegal for buffer
.setDefaultEnqueueTimeout(long)
,
setDefaultRetryTimeout(long)
,
"replace
and cancel
to take advantage of iTag
.",
Mocket.getSender(boolean, boolean)
public int gsend(byte[] buf1, byte[] buf2) throws java.io.IOException, java.lang.IllegalArgumentException
java.io.IOException
java.lang.IllegalArgumentException
public int gsend(byte[] buf1, int offset1, int length1, byte[] buf2, int offset2, int length2) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
public int gsend(byte[] buf1, byte[] buf2, byte[] buf3) throws java.io.IOException, java.lang.IllegalArgumentException
java.io.IOException
java.lang.IllegalArgumentException
public int gsend(byte[] buf1, int offset1, int length1, byte[] buf2, int offset2, int length2, byte[] buf3, int offset3, int length3) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
public int gsend(byte[] buf1, byte[] buf2, byte[] buf3, byte[] buf4) throws java.io.IOException, java.lang.IllegalArgumentException
java.io.IOException
java.lang.IllegalArgumentException
public int gsend(byte[] buf1, int offset1, int length1, byte[] buf2, int offset2, int length2, byte[] buf3, int offset3, int length3, byte[] buf4, int offset4, int length4) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
public int replace(byte[] buffer, int oldTag, int newTag) throws java.io.IOException, java.lang.IllegalArgumentException
OldTag
value and then transmits the new message using the specified parameters. Note that there may be no old
messages to cancel, in which case this call behaves just like a send
.
Several communication parameter are not specified, the default value is going to be used
for the following parameters:
priority = 5,
enqueue timeout = 0 or a value set using the method setDefaultEnqueueTimeout
,
retry timeout = 0 or a value set using the method setDefaultRetryTimeout
.
buffer
- the buffer to be sent. The buffer is going to be sent entirely.oldTag
- the tag of the messages to be replaced.newTag
- tag of the new message to be enqueued. The values has to be >0.
0
if the message is successfully enqueued to be sent and any messages tagged
with oldTag
is successfully removed from the queues.-1
if the retrieve of the instance of Transmitter
did not work,
the value is null.-2
if the cancellation of messages marked with oldTag
did not work.-3
if the send operation on the new message did not work.-10
if the parameters are illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
Mocket.cancel(boolean, boolean, int)
,
Mocket.send(boolean, boolean, byte[], int, int, int, short, long, long)
,
Mocket.getSender(boolean, boolean)
public int replace(byte[] buffer, int offset, int length, int oldTag, int newTag) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
OldTag
value and then transmits the new message using the specified parameters. Note that there may be no old
messages to cancel, in which case this call behaves just like a send
.
Several communication parameter are not specified, the default value is going to be used
for the following parameters:
priority = 5,
enqueue timeout = 0 or a value set using the method setDefaultEnqueueTimeout
,
retry timeout = 0 or a value set using the method setDefaultRetryTimeout
.
buffer
- the buffer to be sent.offset
- the position in the buffer we start to send from.
E.g. offset=10, we send buffer starting at the 10th byte in the arraylength
- the length for which we send.
E.g. length=50 we send 50 bytes of the buffer, starting at offset.
If offset=10, length=50 we send bytes from position 10 in the
buffer through position 60.oldTag
- tag of the messages to replace. Messages tagged with oldTag
will be canceled.newTag
- tag of the new message to be enqueued. The value has to be >0.
0
if the message is successfully enqueued to be sent and any messages tagged
with oldTag
is successfully removed from the queues;-1
if the retrieve of the instance of Transmitter
did not work,
the value is null;-2
if the cancellation of messages marked with oldTag
did not work;-3
if the send operation on the new message did not work;-10
if the parameters are illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
- if the parameters offset
or
length
are illegal for buffer
.Mocket.cancel(boolean, boolean, int)
,
Mocket.send(boolean, boolean, byte[], int, int, int, short, long, long)
,
Mocket.getSender(boolean, boolean)
public int replace(byte[] buffer, int oldTag, Params params) throws java.io.IOException, java.lang.IllegalArgumentException
OldTag
value and then transmits the new message using the specified parameters. Note that there may be no old
messages to cancel, in which case this call behaves just like a send
.
buffer
- the buffer to be sent. The buffer is going to be sent entirely.oldTag
- the tag of the messages to be replaced.params
- an instance of class Param
that contains: tag, priority, enqueueTimeout, retryTimeout.
0
if the message is successfully enqueued to be sent and any messages tagged
with oldTag
is successfully removed from the queues;-1
if the retrieve of the instance of Transmitter
did not work,
the value is null;-2
if the cancellation of messages marked with oldTag
did not work;-3
if the send operation on the new message did not work;-10
if the parameter oldTag
is illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null;-13
if the parameter params
is invalid, params
is null.java.io.IOException
java.lang.IllegalArgumentException
Mocket.cancel(boolean, boolean, int)
,
Mocket.send(boolean, boolean, byte[], int, int, int, short, long, long)
,
Mocket.getSender(boolean, boolean)
public int replace(byte[] buffer, int offset, int length, int oldTag, Params params) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
OldTag
value and then transmits the new message using the specified parameters. Note that there may be no old
messages to cancel, in which case this call behaves just like a send
.
buffer
- the buffer to be sent.offset
- the position in the buffer we start to send from.
E.g. offset=10, we send buffer starting at the 10th byte in the array.length
- the length for which we send.
E.g. length=50 we send 50 bytes of the buffer, starting at offset.
If offset=10, length=50 we send bytes from position 10 in the buffer through position 60.oldTag
- the tag of the messages to be replaced.params
- an instance of class Param
that contains: tag, priority, enqueueTimeout, retryTimeout.
0
if the message is successfully enqueued to be sent and any messages tagged
with oldTag
is successfully removed from the queues;-1
if the retrieve of the instance of Transmitter
did not work,
the value is null;-2
if the cancellation of messages marked with oldTag
did not work;-3
if the send operation on the new message did not work;-10
if the parameter oldTag
is illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null;-13
if the parameter params
is invalid, params
is null.java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
- if the parameters offset
or
length
are illegal for buffer
.Mocket.cancel(boolean, boolean, int)
,
Mocket.send(boolean, boolean, byte[], int, int, int, short, long, long)
,
Mocket.getSender(boolean, boolean)
public int replace(byte[] buffer, int oldTag, int newTag, short priority, long enqueueTimeout, long retryTimeout) throws java.io.IOException, java.lang.IllegalArgumentException
OldTag
value and then transmits the new message using the specified parameters. Note that there may be no old
messages to cancel, in which case this call behaves just like a send
.
buffer
- the buffer to be sent. The buffer is going to be sent entirely.oldTag
- the tag of the messages to be replaced.newTag
- tag of the new message to be enqueued. The value has to be >0.priority
- used to assign a priority different than the default one (higher or lower).
The value has to be >0. Note that the priority of a message will grow every
time it is skipped in favor of a higher priority messages that gets sent first.
This mechanism is implemented to avoid message starvation. The range of priority
values is 0-255.enqueueTimeout
- indicates the length of time in milliseconds for which the method will wait
if there is no room in the outgoing buffer. A zero value indicates wait forever.retryTimeout
- indicates the length of time for which the transmitter will retransmit the packet
to ensure successful delivery. A zero value indicates retry with no time limit.
Note that this parameter makes sense only if the flow is reliable, otherwise the
behavior is to transmit and forget about the packet.
0
if the message is successfully enqueued to be sent and any messages tagged
with oldTag
is successfully removed from the queues;-1
if the retrieve of the instance of Transmitter
did not work,
the value is null;-2
if the cancellation of messages marked with oldTag
did not work;-3
if the send operation on the new message did not work;-10
if the parameters are illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
Mocket.cancel(boolean, boolean, int)
,
Mocket.send(boolean, boolean, byte[], int, int, int, short, long, long)
,
setDefaultEnqueueTimeout(long)
,
setDefaultRetryTimeout(long)
,
Mocket.getSender(boolean, boolean)
public int replace(byte[] buffer, int offset, int length, int oldTag, int newTag, short priority, long enqueueTimeout, long retryTimeout) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException
OldTag
value and then transmits the new message using the specified parameters. Note that there may be no old
messages to cancel, in which case this call behaves just like a send
.
buffer
- the buffer to be sent.offset
- the position in the buffer we start to send from.
E.g. offset=10, we send buffer starting at the 10th byte in the array.length
- the length for which we send.
E.g. length=50 we send 50 bytes of the buffer, starting at offset.
If offset=10, length=50 we send bytes from position 10 in the buffer through position 60.oldTag
- the tag of the messages to be replaced.newTag
- tag of the new message to be enqueued. The value has to be >0.priority
- used to assign a priority different than the default one (higher or lower).
The value has to be >0. Note that the priority of a message will grow every
time it is skipped in favor of a higher priority messages that gets sent first.
This mechanism is implemented to avoid message starvation. The range of priority
values is 0-255.enqueueTimeout
- indicates the length of time in milliseconds for which the method will wait
if there is no room in the outgoing buffer. A zero value indicates wait forever.retryTimeout
- indicates the length of time for which the transmitter will retransmit the packet
to ensure successful delivery. A zero value indicates retry with no time limit.
Note that this parameter makes sense only if the flow is reliable, otherwise the
behavior is to transmit and forget about the packet.
0
if the message is successfully enqueued to be sent and any messages tagged
with oldTag
is successfully removed from the queues;-1
if the retrieve of the instance of Transmitter
did not work,
the value is null;-2
if the cancellation of messages marked with oldTag
did not work;-3
if the send operation on the new message did not work;-10
if the parameters are illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null;-12
if the parameter buffer
is invalid, buffer
is null.java.io.IOException
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
Mocket.cancel(boolean, boolean, int)
,
Mocket.send(boolean, boolean, byte[], int, int, int, short, long, long)
,
setDefaultEnqueueTimeout(long)
,
setDefaultRetryTimeout(long)
,
Mocket.getSender(boolean, boolean)
public int cancel(int tagId) throws java.io.IOException, java.lang.IllegalArgumentException
tagId
- the tag of the messages to be removed.
-1
if cancel on pending packet queue (queue of messages waiting to be sent) fails;-2
if cancel on unacknowledged packet queue fails (only for reliable flow);-10
if the parameter tagId
is illegal (less then zero);-11
if MessageSender
is not initialized, MessageSender
is null.java.io.IOException
java.lang.IllegalArgumentException
Mocket.getSender(boolean, boolean)
public void setDefaultEnqueueTimeout(long enqueueTimeout) throws java.io.IOException, java.lang.IllegalArgumentException
enqueueTimeout
- time in milliseconds the message will wait in the outgoing queue.
java.io.IOException
java.lang.IllegalArgumentException
Mocket.getSender(boolean, boolean)
public void setDefaultRetryTimeout(long retryTimeout) throws java.io.IOException, java.lang.IllegalArgumentException
retryTimeout
- time in milliseconds the message will wait in the unacknowledged packet queue.
java.io.IOException
java.lang.IllegalArgumentException
Mocket.getSender(boolean, boolean)
protected void finalize()
mocket
object.
finalize
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |