use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.
the class RMManager method initialise.
@PostConstruct
void initialise() {
if (configuration == null) {
getConfiguration().setExponentialBackoff(true);
}
DeliveryAssurance da = configuration.getDeliveryAssurance();
if (da == null) {
configuration.setDeliveryAssurance(DeliveryAssurance.AT_LEAST_ONCE);
}
if (null == sourcePolicy) {
setSourcePolicy(null);
}
if (null == destinationPolicy) {
DestinationPolicyType dp = new DestinationPolicyType();
dp.setAcksPolicy(new AcksPolicyType());
setDestinationPolicy(dp);
}
if (null == retransmissionQueue) {
retransmissionQueue = new RetransmissionQueueImpl(this);
}
if (null == redeliveryQueue) {
redeliveryQueue = new RedeliveryQueueImpl(this);
}
if (null == idGenerator) {
idGenerator = new DefaultSequenceIdentifierGenerator();
}
if (null != bus) {
managedManager = new ManagedRMManager(this);
instrumentationManager = bus.getExtension(InstrumentationManager.class);
if (instrumentationManager != null) {
try {
instrumentationManager.register(managedManager);
} catch (JMException jmex) {
LOG.log(Level.WARNING, "Registering ManagedRMManager failed.", jmex);
}
}
}
}
use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.
the class SequenceTimeoutTest method testTimeout.
@Test
public void testTimeout() throws Exception {
init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true);
List<Dispatch<DOMSource>> dispatches = new ArrayList<>(5);
int count = 5;
for (int x = 0; x < count; x++) {
Dispatch<DOMSource> dispatch = initDispatch();
AcksPolicyType ap = new AcksPolicyType();
// don't send the acks to cause a memory leak - CXF-7096
ap.setImmediaAcksTimeout(500000L);
greeterBus.getExtension(RMManager.class).getDestinationPolicy().setAcksPolicy(ap);
dispatch.invoke(getDOMRequest("One"));
dispatches.add(dispatch);
}
RMEndpoint ep = rmManager.findReliableEndpoint(GREETME_SERVICE_NAME);
Assert.assertNotNull(ep);
Assert.assertEquals(count, ep.getDestination().getAllSequences().size());
Assert.assertEquals(count, ep.getSource().getAllSequences().size());
Thread.sleep(2500);
System.gc();
Assert.assertEquals(0, ep.getDestination().getAllSequences().size());
Assert.assertEquals(0, ep.getSource().getAllSequences().size());
try {
dispatches.get(0).invoke(getDOMRequest("One"));
fail("The sequence should have been terminated");
} catch (Throwable t) {
// expected
assertTrue(t.getMessage().contains("not a known Sequence identifier"));
}
rmManager.getStore();
}
use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.
the class ServantTest method verifyCreateSequenceDefault.
private void verifyCreateSequenceDefault(Servant servant, RMManager manager) throws SequenceFault {
DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
dp.setAcksPolicy(ap);
manager.setDestinationPolicy(dp);
Expires expires = new Expires();
expires.setValue(DatatypeFactory.createDuration("P0Y0M0DT0H0M0.0S"));
Message message = createTestCreateSequenceMessage(expires, null);
CreateSequenceResponseType csr = (CreateSequenceResponseType) servant.createSequence(message);
Expires expires2 = csr.getExpires();
assertNotNull(expires2);
assertEquals(DatatypeFactory.PT0S, expires2.getValue());
}
use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.
the class ServantTest method verifyCreateSequenceExpiresSetAtDestination.
private void verifyCreateSequenceExpiresSetAtDestination(Servant servant, RMManager manager) throws SequenceFault {
DestinationPolicyType dp = RMMANGER_FACTORY.createDestinationPolicyType();
AcksPolicyType ap = RMMANGER_FACTORY.createAcksPolicyType();
dp.setAcksPolicy(ap);
dp.setSequenceExpiration(DURATION_SHORT);
manager.setDestinationPolicy(dp);
Expires expires = new Expires();
expires.setValue(DURATION_DEFAULT);
Message message = createTestCreateSequenceMessage(expires, null);
CreateSequenceResponseType csr = (CreateSequenceResponseType) servant.createSequence(message);
Expires expires2 = csr.getExpires();
assertNotNull(expires2);
assertEquals(DURATION_SHORT, expires2.getValue());
}
use of org.apache.cxf.ws.rm.manager.AcksPolicyType in project cxf by apache.
the class DestinationSequence method scheduleAcknowledgement.
void scheduleAcknowledgement(long acknowledgementInterval) {
AcksPolicyType ap = destination.getManager().getDestinationPolicy().getAcksPolicy();
if (acknowledgementInterval > 0 && getMonitor().getMPM() >= (ap == null ? 10 : ap.getIntraMessageThreshold())) {
LOG.fine("Schedule deferred acknowledgment");
scheduleDeferredAcknowledgement(acknowledgementInterval);
} else {
LOG.fine("Schedule immediate acknowledgment");
scheduleImmediateAcknowledgement();
destination.getManager().getTimer().schedule(new ImmediateFallbackAcknowledgment(), ap == null ? 1000L : ap.getImmediaAcksTimeout());
}
}
Aggregations