Search in sources :

Example 11 with RMStore

use of org.apache.cxf.ws.rm.persistence.RMStore in project cxf by apache.

the class Destination method removeSequence.

public void removeSequence(DestinationSequence seq) {
    DestinationSequence o;
    o = map.remove(seq.getIdentifier().getValue());
    RMStore store = getReliableEndpoint().getManager().getStore();
    if (null != store) {
        store.removeDestinationSequence(seq.getIdentifier());
    }
    if (o != null) {
        processingSequenceCount.decrementAndGet();
        completedSequenceCount.incrementAndGet();
    }
}
Also used : RMStore(org.apache.cxf.ws.rm.persistence.RMStore)

Example 12 with RMStore

use of org.apache.cxf.ws.rm.persistence.RMStore in project cxf by apache.

the class Destination method addSequence.

public void addSequence(DestinationSequence seq, boolean persist) {
    seq.setDestination(this);
    map.put(seq.getIdentifier().getValue(), seq);
    if (persist) {
        RMStore store = getReliableEndpoint().getManager().getStore();
        if (null != store) {
            store.createDestinationSequence(seq);
        }
    }
    processingSequenceCount.incrementAndGet();
}
Also used : RMStore(org.apache.cxf.ws.rm.persistence.RMStore)

Example 13 with RMStore

use of org.apache.cxf.ws.rm.persistence.RMStore in project cxf by apache.

the class DestinationSequence method purgeAcknowledged.

void purgeAcknowledged(long messageNr) {
    RMStore store = destination.getManager().getStore();
    if (null == store) {
        return;
    }
    store.removeMessages(getIdentifier(), Collections.singleton(messageNr), false);
}
Also used : RMStore(org.apache.cxf.ws.rm.persistence.RMStore)

Example 14 with RMStore

use of org.apache.cxf.ws.rm.persistence.RMStore in project cxf by apache.

the class RedeliveryQueueImpl method purgeAll.

public void purgeAll(DestinationSequence seq) {
    Collection<Long> purged = new ArrayList<>();
    synchronized (this) {
        LOG.fine("Start purging redeliver candidates.");
        List<RedeliverCandidate> sequenceCandidates = getSequenceCandidates(seq);
        if (null != sequenceCandidates) {
            for (int i = sequenceCandidates.size() - 1; i >= 0; i--) {
                RedeliverCandidate candidate = sequenceCandidates.get(i);
                long m = candidate.getNumber();
                sequenceCandidates.remove(i);
                candidate.resolved();
                undeliveredCount--;
                purged.add(m);
            }
            if (sequenceCandidates.isEmpty()) {
                candidates.remove(seq.getIdentifier().getValue());
            }
        }
        LOG.fine("Completed purging redeliver candidates.");
    }
    if (!purged.isEmpty()) {
        RMStore store = manager.getStore();
        if (null != store) {
            store.removeMessages(seq.getIdentifier(), purged, false);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) Endpoint(org.apache.cxf.endpoint.Endpoint)

Example 15 with RMStore

use of org.apache.cxf.ws.rm.persistence.RMStore in project cxf by apache.

the class RetransmissionQueueImpl method purgeCandidates.

private void purgeCandidates(SourceSequence seq, boolean any) {
    Collection<Long> purged = new ArrayList<>();
    Collection<ResendCandidate> resends = new ArrayList<>();
    Identifier sid = seq.getIdentifier();
    synchronized (this) {
        LOG.fine("Start purging resend candidates.");
        List<ResendCandidate> sequenceCandidates = getSequenceCandidates(seq);
        if (null != sequenceCandidates) {
            for (int i = sequenceCandidates.size() - 1; i >= 0; i--) {
                ResendCandidate candidate = sequenceCandidates.get(i);
                long m = candidate.getNumber();
                if (any || seq.isAcknowledged(m)) {
                    sequenceCandidates.remove(i);
                    candidate.resolved();
                    unacknowledgedCount--;
                    purged.add(m);
                    resends.add(candidate);
                }
            }
            if (sequenceCandidates.isEmpty()) {
                candidates.remove(sid.getValue());
            }
        }
        LOG.fine("Completed purging resend candidates.");
    }
    if (!purged.isEmpty()) {
        RMStore store = manager.getStore();
        if (null != store) {
            store.removeMessages(sid, purged, true);
        }
        RMEndpoint rmEndpoint = seq.getSource().getReliableEndpoint();
        for (ResendCandidate resend : resends) {
            rmEndpoint.handleAcknowledgment(sid.getValue(), resend.getNumber(), resend.getMessage());
        }
    }
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) ArrayList(java.util.ArrayList) RMStore(org.apache.cxf.ws.rm.persistence.RMStore) RMEndpoint(org.apache.cxf.ws.rm.RMEndpoint) RMEndpoint(org.apache.cxf.ws.rm.RMEndpoint) Endpoint(org.apache.cxf.endpoint.Endpoint)

Aggregations

RMStore (org.apache.cxf.ws.rm.persistence.RMStore)19 Identifier (org.apache.cxf.ws.rm.v200702.Identifier)6 ArrayList (java.util.ArrayList)4 RMMessage (org.apache.cxf.ws.rm.persistence.RMMessage)4 Test (org.junit.Test)4 Endpoint (org.apache.cxf.endpoint.Endpoint)3 CachedOutputStream (org.apache.cxf.io.CachedOutputStream)3 SourceSequence (org.apache.cxf.ws.rm.SourceSequence)3 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 Binding (org.apache.cxf.binding.Binding)2 SoapBinding (org.apache.cxf.binding.soap.SoapBinding)2 Client (org.apache.cxf.endpoint.Client)2 Service (org.apache.cxf.service.Service)2 DestinationSequence (org.apache.cxf.ws.rm.DestinationSequence)2 RMEndpoint (org.apache.cxf.ws.rm.RMEndpoint)2 RMManager (org.apache.cxf.ws.rm.RMManager)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 OutputStream (java.io.OutputStream)1 Map (java.util.Map)1