use of net.dempsy.monitoring.basic.BasicNodeStatsCollector in project Dempsy by Dempsy.
the class TestContainer method addOutputCatchStage.
public NodeManager addOutputCatchStage() throws InterruptedException {
// =======================================================
// configure an output catcher tier
final Node out = new Node.Builder("test-app").defaultRoutingStrategyId("net.dempsy.router.simple").receiver(new BlockingQueueReceiver(new ArrayBlockingQueue<>(16))).nodeStatsCollector(new BasicNodeStatsCollector()).cluster("output-catch").mp(new MessageProcessor<OutputCatcher>(new OutputCatcher())).build();
out.validate();
final NodeManager nman = track(new NodeManager()).node(out).collaborator(track(sessionFactory.createSession())).start();
// wait until we can actually reach the output-catch cluster from the main node
assertTrue(poll(o -> {
try {
return canReach(getRouter(manager), "output-catch", new KeyExtractor().extract(new OutputMessage("foo", 1, 1)).iterator().next());
} catch (final Exception e) {
return false;
}
}));
// =======================================================
return nman;
}
use of net.dempsy.monitoring.basic.BasicNodeStatsCollector in project Dempsy by Dempsy.
the class TestInstanceManager method setupContainer.
@SuppressWarnings("resource")
public Container setupContainer(final MessageProcessorLifecycle<?> prototype) throws ContainerException {
dispatcher = new DummyDispatcher();
statsCollector = new BasicClusterStatsCollector();
manager = new NonLockingAltContainer().setMessageProcessor(prototype).setClusterId(new ClusterId("test", "test"));
manager.setDispatcher(dispatcher);
manager.setInbound(new DummyInbound());
tm = new DefaultThreadingModel(TestInstanceManager.class.getName());
tm.start(TestInstanceManager.class.getName());
manager.start(new TestInfrastructure(tm) {
BasicNodeStatsCollector nStats = new BasicNodeStatsCollector();
@Override
public ClusterStatsCollector getClusterStatsCollector(final ClusterId clusterId) {
return statsCollector;
}
@Override
public NodeStatsCollector getNodeStatsCollector() {
return nStats;
}
});
return manager;
}
use of net.dempsy.monitoring.basic.BasicNodeStatsCollector in project Dempsy by Dempsy.
the class TestContainerLoadHandling method setUp.
@Before
public void setUp() throws Exception {
final ClusterId cid = new ClusterId("TestContainerLoadHandling", "test" + sequence++);
dispatcher = new MockDispatcher();
final BasicClusterStatsCollector sc = new BasicClusterStatsCollector();
clusterStats = sc;
nodeStats = new BasicNodeStatsCollector();
container = tr.track(new Manager<Container>(Container.class).getAssociatedInstance(containerId)).setMessageProcessor(new MessageProcessor<TestMessageProcessor>(new TestMessageProcessor())).setClusterId(cid);
container.setDispatcher(dispatcher);
container.setInbound(new DummyInbound());
container.start(new TestInfrastructure(null, null) {
@Override
public ClusterStatsCollector getClusterStatsCollector(final ClusterId clusterId) {
return sc;
}
@Override
public NodeStatsCollector getNodeStatsCollector() {
return nodeStats;
}
});
forceOutputException = false;
stillRunning = true;
}
use of net.dempsy.monitoring.basic.BasicNodeStatsCollector in project Dempsy by Dempsy.
the class TestInstanceManager method setupContainer.
@SuppressWarnings("resource")
public LockingContainer setupContainer(final MessageProcessorLifecycle<?> prototype) throws ContainerException {
dispatcher = new DummyDispatcher();
statsCollector = new BasicClusterStatsCollector();
nodeStats = new BasicNodeStatsCollector();
container = (LockingContainer) new LockingContainer().setMessageProcessor(prototype).setClusterId(new ClusterId("test", "test"));
container.setDispatcher(dispatcher);
container.setInbound(new DummyInbound());
tm = new DefaultThreadingModel(TestInstanceManager.class.getName());
tm.start(TestInstanceManager.class.getName());
container.start(new TestInfrastructure(tm) {
@Override
public BasicClusterStatsCollector getClusterStatsCollector(final ClusterId clusterId) {
return statsCollector;
}
@Override
public NodeStatsCollector getNodeStatsCollector() {
return nodeStats;
}
});
return container;
}
Aggregations