FileDocCategorySizeDatePackage
ServerInboundSequence.javaAPI DocExample8896Tue May 29 16:56:42 BST 2007com.sun.xml.ws.rm.jaxws.runtime.server

ServerInboundSequence

public class ServerInboundSequence extends com.sun.xml.ws.rm.jaxws.runtime.InboundSequence implements com.sun.xml.ws.api.rm.server.ServerSequence
An ServerInboundSequence represents a sequence of incoming messages. For an RMDestination, an InboundSequnce consists of all the requests to a service from a particular proxy.

Fields Summary
private static final Logger
logger
Session associated with this sequence.
private com.sun.xml.ws.runtime.util.Session
session
Constructors Summary
public ServerInboundSequence(URI acksTo, String inboundId, String outboundId, com.sun.xml.ws.rm.jaxws.runtime.SequenceConfig config)

    
      
                             
                             
                              
        
        super(acksTo, config);
        this.outboundSequence = new ServerOutboundSequence(this, outboundId, config);
        
        if (inboundId == null) {
            String newid = "uuid:" + UUID.randomUUID();
            setId(newid);
        } else {
            setId(inboundId);
        }
        
         //if flow control is enabled, set buffer size
        if (config.flowControl) {
            maxMessages = config.bufferSize;
        } else {
            maxMessages = -1;
        }
        
        allowDuplicates = config.allowDuplicates;
    
Methods Summary
public com.sun.xml.ws.rm.MessagegetOriginalMessage(com.sun.xml.ws.rm.Message duplicate)
Gets the original message in a the Sequence with a given message number.

param
duplicate Subsequent message with same number.
return
the original message.

        
        int number = duplicate.getMessageNumber();
        return get(number);       
    
public com.sun.xml.ws.api.rm.SequenceSettingsgetSequenceSettings()
Implementation of ServerSequence.getSequenceSettings..

        SequenceSettings settings = getSequenceConfig();
        settings.sequenceId = getId();
        
        OutboundSequence oseq = getOutboundSequence();
        
        settings.companionSequenceId = (oseq != null) ?
                                       oseq.getId() :
                                       null;
        return settings;
    
public com.sun.xml.ws.runtime.util.SessiongetSession()
Accessor for the session field.

return
The value of the session field.

        return session;
    
public voidholdIfUndeliverable(com.sun.xml.ws.rm.Message message)
If ordered delivery is required, resume processing the next Message in the Sequence if it is waiting for this message to be delivered. This method is called after ServerPipe.process returns for this message. while waiting for gaps in the sequence to fill that can now be processed.

param
message The message to be processed

          if (!config.ordered) {
             return;
         }
          
         try {
            int num = message.getMessageNumber();
       
            //if immediate predecessor has not been processed, wait fcor it
            if (num > 1) {
                Message mess = get(num - 1);
                if (mess == null || !mess.isComplete()) {
                    message.block();
                }
            }
        } catch (InvalidMessageNumberException e) {}
    
public booleanisExpired()
Return value determines whether the interval since last activity exceeds the inactivity timeout setting.

return
true if sequence has expired. false otherwise.

        
        return System.currentTimeMillis() - this.getLastActivityTime()  >
                config.getInactivityTimeout();
    
public voidreleaseNextMessage(com.sun.xml.ws.rm.Message message)
If ordered delivery is required, resume processing the next Message in the Sequence if it is waiting for this message to be delivered. This method is called after ServerPipe.process returns for this message. while waiting for gaps in the sequence to fill that can now be processed.

param
message The message to be processed


        /**
         * Flow Control can be enabled without ordered delivery in which case
         * we want the storedmessages to be decremented 
         */
       /* if (!config.ordered) {
           return;
       }*/
        
       message.complete();
       --storedMessages;
       
       //notify immediate successor if it is waiting 
       int num = message.getMessageNumber();
    
       if (num < nextIndex - 1 && get(num + 1) != null) {
           get(num + 1).resume();
        }
    
public voidresetMessage(int index, com.sun.xml.ws.api.message.Message message, boolean complete)
Used to re-populate a sequence with persisted messages after a restart. Do not use for other purposes.

param
index The index to add message at.
param
message The JAX-WS message to add
param
complete Indicates whether to mark the message as complete.

        
        try {
        com.sun.xml.ws.rm.Message mess = new com.sun.xml.ws.rm.Message(message);
        set(index, mess);
        
        if (complete) {
            mess.complete();
        }
        
        } catch (RMException e) {
            String m = Messages.COULD_NOT_RESET_MESSAGE.format(index, getId());
            logger.log(Level.SEVERE, m, e);
        }
        
    
public voidsetSession(com.sun.xml.ws.runtime.util.Session s)
Mutator for the session field.

        session = s;