Package com.sun.xml.ws.rx.rm.runtime.sequence

Examples of com.sun.xml.ws.rx.rm.runtime.sequence.Sequence


                // Our communication channel has been closed - let the task die
                return;
            }

            if (rc.sequenceManager().isValid(outboundSequenceId)) {
                final Sequence sequence = rc.sequenceManager().getOutboundSequence(outboundSequenceId);
                if (!sequence.isClosed() && !sequence.isExpired()) {
                    try {
                        if (sequence.isStandaloneAcknowledgementRequestSchedulable(acknowledgementRequestInterval)) {
                            requestAcknowledgement();
                            sequence.updateLastAcknowledgementRequestTime();
                        }
                    } finally {
                        LOGGER.finer(String.format("Scheduling next run for an outbound sequence with id [ %s ]", outboundSequenceId));
                        manager.register(this, getExecutionDelay(), getExecutionDelayTimeUnit());
                    }
View Full Code Here


            String seqId = request.getSequenceId();
            long messageNumber = request.getMessageNumber();
            OutboundDelivered outboundDelivered = retrieveOutboundDelivered(seqId, messageNumber);

            if (outboundDelivered != null) {
                Sequence outboundSequence = rc.sequenceManager().getOutboundSequence(seqId);
                boolean isRequestAcked = outboundSequence.isAcknowledged(messageNumber);
                if (isRequestAcked) {
                    if (LOGGER.isLoggable(Level.FINE)) {
                        LOGGER.fine("Invoking outboundDelivered.setDelivered(true) for " +
                                "seq id:"+outboundSequence.getId()+" and " +
                                "message number:"+messageNumber);
                    }
                    outboundDelivered.setDelivered(Boolean.TRUE);
                    rc.outboundDeliveredHandler.remove(seqId, messageNumber);
                } else {
View Full Code Here

        final String inboundSequenceId = inMessage.getSequenceId();
        if (inboundSequenceId == null) {
            throw new WsrmRequiredException();
        }
        final Sequence inboundSequence = sequenceManager.getInboundSequence(inboundSequenceId);
       
        // register and possibly store message in the unacked message sequence queue
        inboundSequence.registerMessage(inMessage, storeMessage);

        inboundSequence.setAckRequestedFlag(); // simulate acknowledgement request for new each message
    }
View Full Code Here

        }

        if (acknowledgementData.getAcknowledgedSequenceId() != null) { // process outbound sequence acknowledgements          
            final List<AckRange> acknowledgedRanges = acknowledgementData.getAcknowledgedRanges();
            if (!acknowledgedRanges.isEmpty()) {
                Sequence outboundSequence = sequenceManager.getOutboundSequence(acknowledgementData.getAcknowledgedSequenceId());
                if (!outboundSequence.isClosed()) { // we ignore acknowledgments on closed sequences
                    outboundSequence.acknowledgeMessageNumbers(acknowledgedRanges);
                }
            }
        }

        if (acknowledgementData.getAckReqestedSequenceId() != null && !doNotSetAckRequestedFlag) { // process inbound sequence ack requested flag
            final Sequence inboundSequence = sequenceManager.getInboundSequence(acknowledgementData.getAckReqestedSequenceId());
            inboundSequence.setAckRequestedFlag();
        }
    }
View Full Code Here

    AcknowledgementData getAcknowledgementData(String inboundSequenceId, boolean isRespondingToAckRequested, boolean doNotClearAckRequestedFlag) throws UnknownSequenceException {
        assert sequenceManager != null;

        AcknowledgementData.Builder ackDataBuilder = AcknowledgementData.getBuilder();
        final Sequence inboundSequence = sequenceManager.getInboundSequence(inboundSequenceId);
        if (isRespondingToAckRequested || inboundSequence.isAckRequested() || inboundSequence.isClosed()) {
            ackDataBuilder.acknowledgements(inboundSequence.getId(), inboundSequence.getAcknowledgedMessageNumbers(), inboundSequence.isClosed());
            if (!doNotClearAckRequestedFlag) {
                inboundSequence.clearAckRequestedFlag();
            }
        }

        // outbound sequence ack requested flag
        Sequence outboundSequence = sequenceManager.getBoundSequence(inboundSequenceId);
        if (outboundSequence != null && outboundSequence.hasUnacknowledgedMessages()) {
            ackDataBuilder.ackReqestedSequenceId(outboundSequence.getId());
            outboundSequence.updateLastAcknowledgementRequestTime();
        }
       
        return ackDataBuilder.build();
    }
View Full Code Here

        }
    }

    private NextAction handleDuplicateMessageException(final JaxwsApplicationMessage message, Packet request) throws UnknownSequenceException, RxRuntimeException {
        // Is failed over during request processing?
        final Sequence inboundSequence = rc.sequenceManager().getInboundSequence(message.getSequenceId());
        if (inboundSequence.isFailedOver(message.getMessageNumber())) {
            synchronized (message.getCorrelationId()) {
                // this synchronization is needed so that all 3 operations occur before
                // AbstractResponseHandler.getParentFiber() is invoked on the response thread
                rc.suspendedFiberStorage.register(message.getCorrelationId(), Fiber.current());
                return doSuspend(new Runnable() {
                    @Override
                    public void run() {
                        rc.destinationMessageHandler.putToDeliveryQueue(message);
                    }
                });
            }
        }

        // Microsoft replay model behavior where a request is sent only to give a ride to a
        // previously generated and retained response
        final Sequence outboundSequence = rc.sequenceManager().getBoundSequence(message.getSequenceId());
        if (outboundSequence != null) {
            final ApplicationMessage _responseMessage = outboundSequence.retrieveMessage(message.getCorrelationId());
            if (_responseMessage == null) {
                return doReturnWith(rc.protocolHandler.createEmptyAcknowledgementResponse(
                        rc.destinationMessageHandler.getAcknowledgementData(message.getSequenceId()),
                        request));
            }
View Full Code Here

                        LocalizationMessages.WSRM_1131_SECURITY_TOKEN_AUTHORIZATION_ERROR(receivedSctId, activeSctId),
                        Code.Sender);
            }
        }

        Sequence inboundSequence = rc.sequenceManager().createInboundSequence(
                rc.sequenceManager().generateSequenceUID(),
                receivedSctId,
                calculateSequenceExpirationTime(requestData.getDuration()));

        final CreateSequenceResponseData.Builder responseBuilder = CreateSequenceResponseData.getBuilder(inboundSequence.getId());
        // TODO P2 set expiration time, incomplete sequence behavior

        if (requestData.getOfferedSequenceId() != null && rc.configuration.requestResponseOperationsDetected()) {
            // there is an offered sequence and this endpoint does contain some 2-way operations
            // if this is a oneway-only endpoint, we simply ignore the offered sequence (WS-I RSP R0011)
            Sequence outboundSequence = rc.sequenceManager().createOutboundSequence(
                    requestData.getOfferedSequenceId(),
                    receivedSctId,
                    calculateSequenceExpirationTime(requestData.getOfferedSequenceExpiry()));
            rc.sequenceManager().bindSequences(inboundSequence.getId(), outboundSequence.getId());
            rc.sequenceManager().bindSequences(outboundSequence.getId(), inboundSequence.getId());

            responseBuilder.acceptedSequenceAcksTo(requestDestination);
        }

        if (!hasSession(request)) { // security did not start session - we must do it
View Full Code Here

    private Packet handleCloseSequenceAction(Packet request) {
        CloseSequenceData requestData = rc.protocolHandler.toCloseSequenceData(request);

        rc.destinationMessageHandler.processAcknowledgements(requestData.getAcknowledgementData());

        Sequence inboundSequence = rc.sequenceManager().getInboundSequence(requestData.getSequenceId());

        // TODO handle last message number - pass it to the sequence so that it can allocate new unacked messages if necessary
        // int lastMessageNumber = closeSeqElement.getLastMsgNumber();

        String boundSequenceId = rc.getBoundSequenceId(inboundSequence.getId());

        try {
            rc.sequenceManager().closeSequence(inboundSequence.getId());

            final CloseSequenceResponseData.Builder responseBuilder = CloseSequenceResponseData.getBuilder(inboundSequence.getId());
            // override the final sequence acknowledgement data as this sequence is not closed yet, but is closing already
            Builder ackDataBuilder = AcknowledgementData.getBuilder(rc.destinationMessageHandler.getAcknowledgementData(inboundSequence.getId()));

            ackDataBuilder.acknowledgements(inboundSequence.getId(), inboundSequence.getAcknowledgedMessageNumbers(), true);
            inboundSequence.clearAckRequestedFlag();

            responseBuilder.acknowledgementData(ackDataBuilder.build());

            return rc.protocolHandler.toPacket(responseBuilder.build(), request, false);
        } finally {
View Full Code Here

    private Packet handleTerminateSequenceAction(Packet request) {
        TerminateSequenceData requestData = rc.protocolHandler.toTerminateSequenceData(request);

        rc.destinationMessageHandler.processAcknowledgements(requestData.getAcknowledgementData());

        Sequence inboundSequence = rc.sequenceManager().getInboundSequence(requestData.getSequenceId());
        Sequence outboundSeqence = rc.sequenceManager().getBoundSequence(requestData.getSequenceId());
        try {
            final TerminateSequenceResponseData.Builder responseBuilder = TerminateSequenceResponseData.getBuilder(inboundSequence.getId());
            responseBuilder.acknowledgementData(rc.destinationMessageHandler.getAcknowledgementData(inboundSequence.getId()));

            if (outboundSeqence != null) {
                responseBuilder.boundSequenceData(outboundSeqence.getId(), outboundSeqence.getLastMessageNumber());
            }

            return rc.protocolHandler.toPacket(responseBuilder.build(), request, false);
        } finally {
            Utilities.endSessionIfExists(request.endpoint, inboundSequence.getId());
            try {
                rc.sequenceManager().terminateSequence(inboundSequence.getId());
            } finally {
                if (outboundSeqence != null) {
                    rc.sequenceManager().terminateSequence(outboundSeqence.getId());
                }
            }
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Sequence closeSequence(String sequenceId) throws UnknownSequenceException {
        Sequence sequence = getSequence(sequenceId);
        sequence.close();
        return sequence;
    }
View Full Code Here

TOP

Related Classes of com.sun.xml.ws.rx.rm.runtime.sequence.Sequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.