Hi,
I am using JPPF in Version 5.0.3. to scale an application to a few virtual machines.
My setup is just the following:
Driver 1: 7 Nodes
Driver 2: 7 Nodes
Driver 3: 7 Nodes
The drivers are configured to work as peers. Each node executes one task, which will take a lot of time until it completes.
For this reason I've registred a ClientTaskListener on my executing client assuming, that it will catch all notifications from every node.
However it seems, that only the notifications from Driver 1 are retrieved on my client.
The relevant piece of code should be this one:
try (JPPFClient jppfClient = new JPPFClient()) {
JMXDriverConnectionWrapper jmxDriver = waitForJMXConnection(jppfClient);
String listenerID = registerJMXListener(jmxDriver);
executeNonBlockingJob(jppfClient);
jmxDriver.unregisterForwardingNotificationListener(listenerID);
} catch (Exception e) {
throw new RuntimeException("Starting failed", e);
}
}
private String registerJMXListener(JMXDriverConnectionWrapper jmxDriver) throws Exception {
// this selector selects all nodes attached to the driver
NodeSelector selector = new AllNodesSelector();
// create a JMX notification listener
NotificationListener clientTaskListener = new ClientTaskListener(clientTaskListenerHandler);
// register the notification listener with the JPPFNodeTaskMonitorMBean
// on the selected nodes
return jmxDriver.registerForwardingNotificationListener(
selector, JPPFNodeTaskMonitorMBean.MBEAN_NAME, clientTaskListener, null, null);
}
private JMXDriverConnectionWrapper waitForJMXConnection(JPPFClient jppfClient) throws InterruptedException {
// wait until a JMX connection to the driver is established
while (!jppfClient.hasAvailableConnection()) {
sleep();
}
JMXDriverConnectionWrapper jmxDriver;
while ((jmxDriver = jppfClient.getClientConnection().getConnectionPool().getJmxConnection()) == null) {
sleep();
}
while (!jmxDriver.isConnected()) {
sleep();
}
return jmxDriver;
}
private void sleep() throws InterruptedException {
Thread.sleep(10L);
}
How can I achieve, that notifications from all nodes (even if they are connected via Driver 2 or Driver 3) are received by my client?
//EDIT: Currently i manually connect to each driver to register my client task listener. Is this the intended way or is there any possibility to do this automatically?
Thanks in advance,
rzo