Fields Summary |
---|
protected String | idThe sequence identifier. |
protected ArrayList | listThe underlying list of messages |
protected int | nextIndexThe smallest unfilled index. |
protected boolean | lastFlag indicates that message with Sequence header containing
Last element has been sent/received. If this is the case,
SequenceAcknowledgements for the sequence may contain acks
for a message is one greater than the index for the last
message in the sequence. |
protected int | maxMessagesMaximum number of stored messages. Used for server-side sequences
for which flow control is enabled. The value -1 indicates that
there is no limit. |
protected int | storedMessagesNumber of messages currently being stored awaiting completion. |
protected long | lastActivityTimeLast accesse time. |
protected boolean | allowDuplicates |
protected RMConstants | rmConstantsRMConstants associated with each Sequence which
will give information regarding addressing version, JAXBContext etc |
protected int | firstKnownGap |
Methods Summary |
---|
public synchronized Message | get(int index)Gets the Message at the specified index.
if (index >= nextIndex) {
throw new InvalidMessageNumberException(
Messages.INVALID_INDEX_MESSAGE.format(index));
}
return list.get(index);
|
public java.lang.String | getId()Gets the sequence identifier
return id;
|
protected long | getLastActivityTime()Accessor for lastActivityTime field.
return lastActivityTime;
|
public synchronized int | getNextIndex()Accessor for the nextIndex field.
return nextIndex;
|
protected boolean | isGettingClose(long elapsedTime, long timeLimit)Return value determines whether elapsed time is close enough to
time limit to pull the trigger and send an ackRequested to keep the
sequence alive.
//for now
return elapsedTime > timeLimit / 2;
|
public synchronized boolean | isLast()
return last;
|
public void | resetLastActivityTime()Resets lastActivityTime field to current time.
lastActivityTime = System.currentTimeMillis();
|
public synchronized int | set(int i, Message m)Adds a Message to the Sequence at a specified indes. The index must be
positive. If the index is larger than the nextIndex field, nulls are inserted
between the largest index used and the index, and the index becomes the new
value of the nextIndex field
//record the index and sequence in the message
m.setMessageNumber(i);
m.setSequence(this);
if (i <= 0) {
throw new InvalidMessageNumberException();
}
if (storedMessages == maxMessages) {
throw new BufferFullException(this);
}
if (i < nextIndex) {
Message mess = null;
if (null != (mess = list.get(i)) && !allowDuplicates) {
//Store the original message in the exception so
//that exception handling can use it.
throw new DuplicateMessageException(mess);
}
list.set(i, m);
} else if (i == nextIndex) {
list.add( m);
nextIndex++;
} else {
//fill in nulls between nextIndex an new nextIndex.
for (int j = nextIndex; j < i; j++) {
list.add(null);
}
list.add( m);
nextIndex = i + 1;
}
storedMessages++;
return i;
|
public void | setId(java.lang.String id)Sets the sequence identifier.
this.id = id;
|
public synchronized void | setLast()Sets the last flag.
last = true;
|