// connections within the network. The manager is the only element of the
// network left running, so we can go ahead and undeploy it.
if (event.value() != null && event.value().equals("")) {
// First, stop watching the status key so this handler doesn't accidentally
// get called again for some reason.
data.unwatch(context.status(), MapEvent.Type.CHANGE, this, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
// Now undeploy the manager from the context cluster. Once the manager
// has been undeployed the undeployment of the network is complete.
platform.undeployVerticle(managers.remove(context.address()), new Handler<AsyncResult<Void>>() {