use of com.adaptris.core.http.jetty.JettyPoolingWorkflowInterceptor in project interlok by adaptris.
the class WorkflowManagerTest method testJettyInterceptor_AlreadyHasInterceptor.
@Test
public void testJettyInterceptor_AlreadyHasInterceptor() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel channel = createChannel("c1");
ChannelManager channelManager = new ChannelManager(channel, adapterManager);
PoolingWorkflow workflow = new PoolingWorkflow("w1");
workflow.addInterceptor(new JettyPoolingWorkflowInterceptor());
workflow.setConsumer(new JettyMessageConsumer());
new WorkflowManager(workflow, channelManager);
assertEquals(3, workflow.getInterceptors().size());
// Look the order should now be swapped.
assertEquals(JettyPoolingWorkflowInterceptor.class, workflow.getInterceptors().get(0).getClass());
assertEquals(MessageMetricsInterceptor.class, workflow.getInterceptors().get(1).getClass());
assertEquals(InFlightWorkflowInterceptor.class, workflow.getInterceptors().get(2).getClass());
}
use of com.adaptris.core.http.jetty.JettyPoolingWorkflowInterceptor in project interlok by adaptris.
the class WorkflowManager method configureJettyInterceptor.
private void configureJettyInterceptor() throws CoreException, MalformedObjectNameException {
// that object monitors are in place for re-entrant servlet action.
if (PoolingWorkflow.class.isAssignableFrom(managedWorkflow.getClass()) && BasicJettyConsumer.class.isAssignableFrom(managedWorkflow.getConsumer().getClass())) {
if (!hasInterceptorOfType(managedWorkflow.getInterceptors(), JettyWorkflowInterceptorImpl.class)) {
log.trace("JettyPoolingWorkflowInterceptor added for [{}]", createObjectName());
managedWorkflow.getInterceptors().add(new JettyPoolingWorkflowInterceptor());
}
}
}
Aggregations