Methods Summary |
---|
public synchronized void | addOutboundSequence(ClientOutboundSequence seq)
logger.fine(Messages.ADDING_SEQUENCE_MESSAGE.format(seq.getId()));
boolean firstSequence = outboundMap.isEmpty();
outboundMap.put(seq.getId(), seq);
ClientInboundSequence iseq =
(ClientInboundSequence)seq.getInboundSequence();
String iseqid = null;
if (iseq != null && null != (iseqid = iseq.getId())) {
inboundMap.put(iseqid, iseq);
}
if (firstSequence) {
retryTimer.start();
}
|
public ClientOutboundSequence | createSequence(javax.xml.ws.Service service, javax.xml.namespace.QName portName)Initialize a sequence using a CreateSequence handshake. The
returned Sequence can be set in BindingProvider properies which will
result in the Sequence being used for the BindingProvider's request messages.
Dispatch<Source> disp = service.createDispatch(portName,
Source.class,
Service.Mode.PAYLOAD,
new javax.xml.ws.RespectBindingFeature());
byte[] bytes = Constants.createSequencePayload.getBytes();
ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
StreamSource source = new StreamSource(stream);
try {
disp.invoke(source);
} catch (Exception e) {
//dont care what happened processing the response message. We are only
//interested in the sequence that has been stored in the request context
//
//TODO - At the same time, it would be prettier to get something other than
//a fault
}
ClientOutboundSequence seq = (ClientOutboundSequence)disp.getRequestContext()
.get(Constants.sequenceProperty);
seq.setService(service);
return seq;
|
public ClientOutboundSequence | createSequence(javax.xml.ws.Service service, javax.xml.namespace.QName portName, java.lang.String sequenceID, java.lang.String companionSequenceID)Initialize a sequence using an existing seuence id known to an RM endpoint.
The method is designed to be used after a startup to reinitialize a
sequence from persisted data.
//this will throw and exception if the specified sequence does not exist.
//removeOutboundSequence(sequenceID);
ClientOutboundSequence seq = createSequence(service, portName);
if (seq == null ) {
return null;
}
try {
seq.disconnect(false);
} catch (Exception e) {
e.printStackTrace();
}
seq.setId(sequenceID);
ClientInboundSequence iseq =
(ClientInboundSequence)seq.getInboundSequence();
if (companionSequenceID != null) {
if (iseq == null || iseq.getId() == null) {
String message = Messages.NO_TWO_WAY_OPERATION.format();
IllegalArgumentException e = new IllegalArgumentException(message);
logger.log(Level.FINE, message, e);
throw e;
}
iseq.setId(companionSequenceID);
} else if (iseq != null && iseq.getId() != null) {
String message = Messages.NO_INBOUND_SEQUENCE_ID_SPECIFIED.format();
IllegalArgumentException e = new IllegalArgumentException(message);
logger.log(Level.FINE, message,e);
throw e;
}
if (outboundMap.get(sequenceID) != null) {
String message = Messages.SEQUENCE_ALREADY_EXISTS.format(sequenceID);
IllegalArgumentException e = new IllegalArgumentException(message);
logger.log(Level.FINE, message, e);
throw e;
}
if (companionSequenceID != null &&
inboundMap.get(companionSequenceID) != null) {
String message = Messages.SEQUENCE_ALREADY_EXISTS.format(companionSequenceID);
IllegalArgumentException e = new IllegalArgumentException(message);
logger.log(Level.FINE, message, e);
throw e;
}
addOutboundSequence(seq);
return seq;
|
public void | doMaintenanceTasks()Do the necessary maintenance tasks for each ClientInboundSequence
managed by this RMSource. This is done by calling the doMaintenanceTasks
method of each managed sequence.
for (String key : outboundMap.keySet()) {
ClientOutboundSequence seq =
getOutboundSequence(key);
synchronized(seq) {
//1. resend all incomplete messages
//2. send ackRequested messages in any sequences
// in danger of timing out.
seq.doMaintenanceTasks();
}
}
|
public static com.sun.xml.ws.rm.jaxws.runtime.client.RMSource | getRMSource()
return rmSource;
|
public long | getRetryInterval()
return retryInterval;
|
public synchronized void | removeOutboundSequence(ClientOutboundSequence seq)
logger.fine(Messages.REMOVING_SEQUENCE_MESSAGE.format( seq.getId()));
String id = seq.getId();
ClientInboundSequence iseq =
(ClientInboundSequence)seq.getInboundSequence();
String iseqid = null;
if (iseq != null && null != (iseqid = iseq.getId())) {
inboundMap.remove(iseqid);
}
outboundMap.remove(id);
if (outboundMap.isEmpty()) {
retryTimer.stop();
}
|
private void | removeOutboundSequence(java.lang.String id)
ClientOutboundSequence seq = outboundMap.get(id);
if (seq != null) {
removeOutboundSequence(seq);
} else {
String message = Messages.NO_SUCH_OUTBOUND_SEQUENCE.format(id);
IllegalArgumentException e = new IllegalArgumentException(message);
logger.log(Level.FINE, message, e);
throw e;
}
|
public void | setRetryInterval(long retryInterval)
this.retryInterval = retryInterval;
|
public synchronized void | terminateSequence(ClientOutboundSequence seq)
String id = seq.getId();
if (seq != null && outboundMap.keySet().contains(id)) {
seq.disconnect();
removeOutboundSequence(id);
}
|