}
}
};
nc.setDiscoveryAgent(new DiscoveryAgent() {
TaskRunnerFactory taskRunner = new TaskRunnerFactory();
DiscoveryListener listener;
@Override
public void start() throws Exception {
taskRunner.init();
taskRunner.execute(new Runnable() {
@Override
public void run() {
listener.onServiceAdd(new DiscoveryEvent(broker2
.getVmConnectorURI().toString()));
}
});
taskRunner.execute(new Runnable() {
@Override
public void run() {
listener.onServiceAdd(new DiscoveryEvent(broker2
.getVmConnectorURI().toString()));
}
});
}
@Override
public void stop() throws Exception {
taskRunner.shutdown();
}
@Override
public void setDiscoveryListener(DiscoveryListener listener) {
this.listener = listener;