use of org.jboss.modcluster.container.ContainerEventHandler in project wildfly by wildfly.
the class UndertowEventHandlerAdapter method stop.
@Override
public void stop(StopContext context) {
suspendController.getValue().unRegisterActivity(this);
this.service.getValue().unregisterListener(this);
this.executor.shutdownNow();
try {
this.executor.awaitTermination(statusInterval, TimeUnit.SECONDS);
} catch (InterruptedException ignore) {
// Move on.
}
ContainerEventHandler eventHandler = this.eventHandler.getValue();
eventHandler.stop(this.server);
}
use of org.jboss.modcluster.container.ContainerEventHandler in project wildfly by wildfly.
the class UndertowEventHandlerAdapter method start.
@Override
public void start(StartContext context) {
UndertowService service = this.service.getValue();
ContainerEventHandler eventHandler = this.eventHandler.getValue();
this.connector = new UndertowConnector(this.listener.getValue());
this.server = new UndertowServer(service, connector);
// Register ourselves as a listener to the container events
service.registerListener(this);
// Initialize mod_cluster and start it now
eventHandler.init(this.server);
eventHandler.start(this.server);
// Start the periodic STATUS thread
ThreadGroup group = new ThreadGroup(UndertowEventHandlerAdapter.class.getSimpleName());
ThreadFactory factory = doPrivileged(new PrivilegedAction<ThreadFactory>() {
public ThreadFactory run() {
return new JBossThreadFactory(group, Boolean.FALSE, null, "%G - %t", null, null);
}
});
this.executor = Executors.newScheduledThreadPool(1, factory);
this.executor.scheduleWithFixedDelay(this, 0, statusInterval, TimeUnit.SECONDS);
suspendController.getValue().registerActivity(this);
}
use of org.jboss.modcluster.container.ContainerEventHandler in project wildfly by wildfly.
the class UndertowEventHandlerAdapterService method onStop.
private synchronized void onStop(Context context) {
ContainerEventHandler handler = this.configuration.getContainerEventHandler();
handler.stop(context);
// TODO break into onDeploymentRemove once implemented in Undertow
handler.remove(context);
this.contexts.remove(context);
}
use of org.jboss.modcluster.container.ContainerEventHandler in project wildfly by wildfly.
the class UndertowEventHandlerAdapterService method onStart.
private synchronized void onStart(Context context) {
ContainerEventHandler handler = this.configuration.getContainerEventHandler();
handler.add(context);
State state = this.configuration.getSuspendController().getState();
// TODO break into onDeploymentAdd once implemented in Undertow
if (state == State.RUNNING) {
handler.start(context);
}
this.contexts.add(context);
}
use of org.jboss.modcluster.container.ContainerEventHandler in project wildfly by wildfly.
the class UndertowEventHandlerAdapterService method start.
@Override
public void start(StartContext context) {
UndertowService service = this.configuration.getUndertowService();
ContainerEventHandler eventHandler = this.configuration.getContainerEventHandler();
this.connector = new UndertowConnector(this.configuration.getListener());
this.serverName = this.configuration.getServer().getName();
this.server = new UndertowServer(this.serverName, service, this.connector);
// Register ourselves as a listener to the container events
service.registerListener(this);
// Initialize mod_cluster and start it now
eventHandler.init(this.server);
eventHandler.start(this.server);
for (Engine engine : this.server.getEngines()) {
for (org.jboss.modcluster.container.Host host : engine.getHosts()) {
host.getContexts().forEach(c -> contexts.add(c));
}
}
// Start the periodic STATUS thread
this.executor = Executors.newScheduledThreadPool(1, new DefaultThreadFactory(UndertowEventHandlerAdapterService.class));
this.executor.scheduleWithFixedDelay(this, 0, this.configuration.getStatusInterval().toMillis(), TimeUnit.MILLISECONDS);
this.configuration.getSuspendController().registerActivity(this);
}
Aggregations