Skip to content
Snippets Groups Projects
Commit c6b60afa authored by Simon Spinner's avatar Simon Spinner
Browse files

Move registration to exchanges after agent start.

parent 05f44a76
No related branches found
No related tags found
No related merge requests found
......@@ -214,23 +214,26 @@ public class ModelExtractionService extends AgentController implements Service<M
}
});
ApplicationScope applicationScope = (ApplicationScope) getContainerScope();
addNotificationHandler(applicationScope.getRuntimeEnvironmentInputPort(), "#", new NotificationHandler() {
@Override
public void handleNotification(ModelNotification event) {
EObject instance = event.getInstance();
if (instance instanceof RuntimeEnvironment) {
RuntimeEnvironment env = (RuntimeEnvironment) instance;
if (env.getOfClass() == RuntimeEnvironmentClasses.OS_VM
&& env.getName().equalsIgnoreCase(getLocalHost().getHostName())) {
wildFlyContainer = ModelSkeletonUtil.adopt(ModelExtractionService.this, env);
}
}
}
});
try {
start().get();
ApplicationScope applicationScope = (ApplicationScope) getContainerScope();
addNotificationHandler(applicationScope.getRuntimeEnvironmentInputPort(), "#", new NotificationHandler() {
@Override
public void handleNotification(ModelNotification event) {
EObject instance = event.getInstance();
if (instance instanceof RuntimeEnvironment) {
RuntimeEnvironment env = (RuntimeEnvironment) instance;
if (env.getOfClass() == RuntimeEnvironmentClasses.OS_VM
&& env.getName().equalsIgnoreCase(getLocalHost().getHostName())) {
wildFlyContainer = ModelSkeletonUtil.adopt(ModelExtractionService.this, env);
}
}
}
});
schedule(new ModelUpdater(), 1, TimeUnit.MINUTES);
} catch (InterruptedException | ExecutionException e) {
log.error("Error stopping agent.", e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment