Package org.objectweb.celtix.bus.configuration.wsrm

Examples of org.objectweb.celtix.bus.configuration.wsrm.SequenceTerminationPolicyType


        SourceSequence seq = null;
        SourcePolicyType sp = RMUtils.getWSRMConfFactory().createSourcePolicyType();
       
        // default termination policy
       
        SequenceTerminationPolicyType stp =
            RMUtils.getWSRMConfFactory().createSequenceTerminationPolicyType();       
        sp.setSequenceTerminationPolicy(stp);
       
        seq = new SourceSequence(id)
        seq.setSource(source);
        assertTrue(!nextSequences(seq, sp, 10));
       
        // termination policy max length = 1
       
        seq = new SourceSequence(id);
        seq.setSource(source);
        stp.setMaxLength(BigInteger.ONE);
        assertTrue(nextSequences(seq, sp, 10));
        assertEquals(BigInteger.ONE, seq.getCurrentMessageNr());
       
        // termination policy max length = 5
        seq = new SourceSequence(id);
        seq.setSource(source);
        stp.setMaxLength(new BigInteger("5"));
        assertTrue(!nextSequences(seq, sp, 2));
       
        // termination policy max range exceeded
       
        seq = new SourceSequence(id);
        seq.setSource(source);
        stp.setMaxLength(null);
        stp.setMaxRanges(new Integer(3));
        acknowledge(seq, 1, 2, 4, 5, 6, 8, 9, 10);
        assertTrue(nextSequences(seq, sp, 10));
        assertEquals(BigInteger.ONE, seq.getCurrentMessageNr());
       
        // termination policy max range not exceeded
       
        seq = new SourceSequence(id);
        seq.setSource(source);
        stp.setMaxLength(null);
        stp.setMaxRanges(new Integer(4));
        acknowledge(seq, 1, 2, 4, 5, 6, 8, 9, 10);
        assertTrue(!nextSequences(seq, sp, 10));
       
        // termination policy max unacknowledged
    }
View Full Code Here


    }

    public SequenceTerminationPolicyType getSequenceTerminationPolicy() {
        SourcePolicyType sp = getSourcePolicies();
        assert null != sp;
        SequenceTerminationPolicyType stp = sp.getSequenceTerminationPolicy();
        if (null == stp) {
            stp = RMUtils.getWSRMConfFactory().createSequenceTerminationPolicyType();
        }
        return stp;
    }
View Full Code Here

        terminateSequences();
    }
   
    private void terminateSequences() {
       
        SequenceTerminationPolicyType st = source.getSequenceTerminationPolicy();
        if (!st.isTerminateOnShutdown()) {
            LOG.fine("No need to terminate sequences on shutdown");
            return;
        }
       
        Collection<SourceSequence> seqs = source.getAllUnacknowledgedSequences();
View Full Code Here

                lastMessage = true;    
            }
        }
       
        if (!lastMessage) {
            SequenceTerminationPolicyType stp = source.getSequenceTerminationPolicy();
            assert null != stp;

            if ((!stp.getMaxLength().equals(BigInteger.ZERO) && stp.getMaxLength()
                .compareTo(currentMessageNumber) <= 0)
                || (stp.getMaxRanges() > 0 && acked.getAcknowledgementRange().size() >= stp.getMaxRanges())
                || (stp.getMaxUnacknowledged() > 0 && source.getRetransmissionQueue()
                    .countUnacknowledged(this) >= stp.getMaxUnacknowledged())) {
                lastMessage = true;
            }
        }
       
        if (LOG.isLoggable(Level.FINE) && lastMessage) {
View Full Code Here

TOP

Related Classes of org.objectweb.celtix.bus.configuration.wsrm.SequenceTerminationPolicyType

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.