use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class RMInInterceptor method processAcknowledgments.
void processAcknowledgments(RMEndpoint rme, RMProperties rmps, ProtocolVariation protocol) throws SequenceFault, RMException {
Collection<SequenceAcknowledgement> acks = rmps.getAcks();
Source source = rme.getSource();
if (null != acks) {
for (SequenceAcknowledgement ack : acks) {
Identifier id = ack.getIdentifier();
SourceSequence ss = source.getSequence(id);
if (null != ss) {
ss.setAcknowledged(ack);
} else {
RMConstants consts = protocol.getConstants();
SequenceFaultFactory sff = new SequenceFaultFactory(consts);
throw sff.createUnknownSequenceFault(id);
}
}
}
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier 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());
}
}
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class DestinationSequenceTest method testConstructors.
@Test
public void testConstructors() {
Identifier otherId = factory.createIdentifier();
otherId.setValue("otherSeq");
DestinationSequence seq = new DestinationSequence(id, ref, destination, ProtocolVariation.RM10WSA200408);
assertEquals(id, seq.getIdentifier());
assertEquals(0L, seq.getLastMessageNumber());
assertSame(ref, seq.getAcksTo());
assertNotNull(seq.getAcknowledgment());
assertNotNull(seq.getMonitor());
SequenceAcknowledgement ack = new SequenceAcknowledgement();
seq = new DestinationSequence(id, ref, 10L, ack, ProtocolVariation.RM10WSA200408);
assertEquals(id, seq.getIdentifier());
assertEquals(10L, seq.getLastMessageNumber());
assertSame(ref, seq.getAcksTo());
assertSame(ack, seq.getAcknowledgment());
assertNotNull(seq.getMonitor());
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class ManagedRMManagerTest method createTestDestinationSequence.
private DestinationSequence createTestDestinationSequence(Destination destination, String sid, EndpointReferenceType to, ProtocolVariation protocol, long[] acked) {
Identifier identifier = RMUtils.getWSRMFactory().createIdentifier();
identifier.setValue(sid);
DestinationSequence ds = new DestinationSequence(identifier, to, null, protocol);
ds.setDestination(destination);
List<SequenceAcknowledgement.AcknowledgementRange> ranges = ds.getAcknowledgment().getAcknowledgementRange();
for (int i = 0; i < acked.length; i += 2) {
ranges.add(createAcknowledgementRange(acked[i], acked[i + 1]));
}
return ds;
}
use of org.orcid.jaxb.model.record.summary_rc1.Identifier in project cxf by apache.
the class RMTxStoreTestBase method testGetSourceSequence.
@Test
public void testGetSourceSequence() throws SQLException, IOException {
Identifier sid1 = null;
Identifier sid2 = null;
SourceSequence seq = store.getSourceSequence(new Identifier());
assertNull(seq);
try {
sid1 = setupSourceSequence("sequence1");
seq = store.getSourceSequence(sid1);
assertNotNull(seq);
verifySourceSequence("sequence1", seq);
sid2 = setupSourceSequence("sequence2");
seq = store.getSourceSequence(sid2);
assertNotNull(seq);
verifySourceSequence("sequence2", seq);
} finally {
if (null != sid1) {
store.removeSourceSequence(sid1);
}
if (null != sid2) {
store.removeSourceSequence(sid2);
}
}
}
Aggregations