Hello,
In fact, the startup classes and MBeans are started before any node or client can connect, as described in the
flow of customizations, so this won't be a problem.
Unfortunately, there is no API that will allow to invalidate node connections from a startup or mbean.
Instead, what you could do is to create a
node connection listener and throw a RuntimeException from its nodeConnected() method:
public class MyConnectionListener implements NodeConnectionListener {
@Override
public void nodeConnected(NodeConnectionEvent event) {
JPPFManagementInfo info = event.getNodeInformation();
// peer driver ?
if (info.isDriver()) {
boolean ok = true;
JPPFSystemInformation systemInfo = info.getSystemInfo();
// ... perform some checks based on the info ...
if (!ok) throw new IllegalStateException("refusing connection from peer driver");
}
}
@Override
void nodeDisconnected(NodeConnectionEvent event) {
}
}
The exception will be propagated back to the code that handles the network I/O and cause to close the connection.
Let me know if this works for you.
Sincerely,
-Laurent