Fields Summary |
---|
private static final Logger | logger |
protected URI | destinationCommon destination for all application messages in the sequence. |
protected URI | acksToEndpoint for protocol responses. May be the WS-Addressing anonymous endpoint.
There are several variations depending on whether this EPR is the same as
the one used by application messages in the companion InboundSequence |
protected InboundSequence | inboundSequenceCompanion InboundSequence |
protected com.sun.xml.ws.rm.protocol.SequenceAcknowledgementElement | sequenceAcknowledgementSequence acknowledgement to be sent back to client on next
available message to the AcksTo endpoint. |
protected SequenceConfig | configConfiguration for this sequence. |
protected com.sun.xml.ws.rm.protocol.AcknowledgementHandler | ackHandlerInstance of helper class that processes SequnceAcknowledgement headers. |
public boolean | saveMessagesFlag determines whether messages will be saved. Will only be
false in the case of companions to ServerInboundSequences for
endpoints with no two-way operations. |
private com.sun.xml.ws.rm.jaxws.util.ProcessingFilter | filterProcessing filter whose handleRequestHeaders method
can access headers before they are marshalled. |
protected int | bufferRemainingSpace available in receiving buffer at destination, if
this can be determined. |
Methods Summary |
---|
public synchronized void | acknowledge(int i)Sets the state of the message at the specified index to complete, and discards
a com.sun.xml.ws.api.message.Message.
Message mess;
if (i >= nextIndex || (null == (mess = get(i)))) {
throw new InvalidMessageNumberException();
}
if (!mess.isComplete()) {
--storedMessages;
if (storedMessages == 0) {
//A thread on which waitForAcks() has been called
//may be waiting for all the acks to arrive.
notifyAll();
}
mess.complete();
}
|
protected com.sun.xml.ws.api.message.Header | createHeader(java.lang.Object obj)
return Headers.create(
config.getRMConstants().getJAXBRIContextHeaders(),
obj);
|
public void | ensureAckRequested(Message mess, javax.xml.bind.Marshaller marshaller)Add AckRequested element to an existing message if one is not already
present. This is used to ensure that an AckRequested header is included
on every resend.
if (mess.getAckRequestedElement() == null) {
AckRequestedElement ack = new AckRequestedElement();
ack.setId(this.getId());
mess.setAckRequestedElement(ack);
/*
mess.addHeader(Headers.create(getVersion(),
marshaller,
mess.getAckRequestedElement()));
*/
mess.addHeader(createHeader(mess.getAckRequestedElement()));
}
|
public java.net.URI | getAcksTo()Accessor for the value of the Destination URI.
return acksTo;
|
public int | getBufferRemaining()Accessor for bufferRemaining field.
return bufferRemaining;
|
public java.net.URI | getDestination()Accessor for the value of the Destination URI.
return destination;
|
public InboundSequence | getInboundSequence()Accessor for the inboundSequence field.
return inboundSequence;
|
private com.sun.xml.ws.api.SOAPVersion | getVersion()
return config.getSoapVersion();
|
public void | handleAckResponse(com.sun.xml.ws.rm.protocol.SequenceAcknowledgementElement element)Removes acked messages from list.
(For anonymous client, need to widen definition of acked to include the
requirement that responses have arrived.)
if (ackHandler == null) {
ackHandler = new AcknowledgementHandler(config);
}
ackHandler.handleAcknowledgement(this, element);
|
protected boolean | isAckRequested()
//For oneway messages it does not make sense to send
// AckRequestedElement on the ServerOutbound messages
//saveMessages will be true in case of two way messages
// for AckRequestedElement will be generated then
//otherwise it will return false
return saveMessages;
|
protected boolean | isResendDue()
return true;
|
public synchronized void | processAcknowledgement(Message mess, javax.xml.bind.Marshaller marshaller)Add a pending acknowledgement to a message without adding message to sequence. Used
for sending final ack on a TerminateSequence message if necessary.
//if companion Inbound sequence is returning an acknowledgement, add the
//SequenceAcknowledgement header
if (sequenceAcknowledgement != null) {
//mess.addHeader(Headers.create(getVersion(), marshaller,sequenceAcknowledgement));
mess.addHeader(createHeader(sequenceAcknowledgement));
sequenceAcknowledgement = null;
}
|
public void | processOutboundMessage(Message mess, javax.xml.bind.Marshaller marshaller)Handles an OutboundMessage .
- Store the message
- If ackRequested flag is set, add an
AckRequestedElement
header to the message.
- If complanion
ClientInboundSequence has queued an acknowledgement,
add a SequenceAcknowledgementElement header to the
message.
if (saveMessages && !mess.isOneWayResponse ) {
//Add the message to the sequence unless this has been done previously
int messageNumber = mess.getMessageNumber();
if (messageNumber == 0) {
messageNumber = set(getNextIndex(), mess);
} else {
set(messageNumber, mess);
}
SequenceElement element = new SequenceElement();
element.setNumber(messageNumber);
element.setId(this.getId());
//mess.addHeader(Headers.create(getVersion(),marshaller,element));
mess.setSequenceElement(element);
//if it is time to request an ack for this sequence, add AckRequestedHeader
if (isAckRequested()) {
AckRequestedElement ack = new AckRequestedElement();
ack.setId(this.getId());
mess.setAckRequestedElement(ack);
}
}
//if companion Inbound sequence is returning an acknowledgement, add the
//SequenceAcknowledgement header
if (sequenceAcknowledgement != null) {
//mess.addHeader(Headers.create(getVersion(), marshaller,sequenceAcknowledgement));
mess.setSequenceAcknowledgementElement(sequenceAcknowledgement);
sequenceAcknowledgement = null;
}
if (filter != null) {
filter.handleOutboundHeaders(mess);
}
if (mess.getSequenceElement() != null) {
/*
mess.addHeader(Headers.create(getVersion(),
marshaller,
mess.getSequenceElement()));
*/
mess.addHeader(createHeader(mess.getSequenceElement()));
}
if (mess.getAckRequestedElement() != null) {
/*
mess.addHeader(Headers.create(getVersion(),
marshaller,
mess.getAckRequestedElement()));
*/
mess.addHeader(createHeader(mess.getAckRequestedElement()));
}
if (mess.getSequenceAcknowledgementElement() != null) {
/*
mess.addHeader(Headers.create(getVersion(),
marshaller,
mess.getSequenceAcknowledgementElement()));
*/
mess.addHeader( createHeader(mess.getSequenceAcknowledgementElement()));
}
|
public void | setBufferRemaining(int value)Mutator for bufferRemaining field.
bufferRemaining = value;
|
public void | setProcessingFilter(com.sun.xml.ws.rm.jaxws.util.ProcessingFilter filter)
this.filter = filter;
|
public void | setSequenceAcknowledgement(com.sun.xml.ws.rm.protocol.SequenceAcknowledgementElement element)Invoked by Incoming message processor to post Sequence Acknowledgement
from companion Incoming Sequence for transmission on next OutboundMessage.l
this.sequenceAcknowledgement = element;
|
public synchronized void | waitForAcks()Called by disconnect before sending Last and Terminate sequence. Blocks until all messages
have been acked. The notifyAll method is called by OutboundSequence.acknowledge when
stored message count reaches 0.
while (storedMessages != 0) {
try {
//wait for the specified timeout or a notify(), which is called
//whenever a message is acked.
long timeout = config.getCloseTimeout();
wait(timeout);
if (storedMessages > 0) {
logger.severe(Messages.TIMEOUT_IN_WAITFORACKS_STRING
.format(timeout / 1000 , storedMessages));
break;
}
} catch (InterruptedException e) {
//allow preDestroy to continue
break;
}
}
|