Search in sources :

Example 1 with ShutdownHandler

use of de.janrufmonitor.service.server.request.handler.ShutdownHandler in project janrufmonitor by tbrandt77.

the class Server method shutdown.

public void shutdown() {
    super.shutdown();
    IHttpRequest request = new ShutdownHandler();
    this.sendRequest(getRuntime().getEventBroker().createEvent(-1), request);
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
        this.m_logger.severe(e.getMessage());
    }
    IEventBroker eventBroker = this.getRuntime().getEventBroker();
    eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_INCOMINGCALL));
    eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLACCEPTED));
    eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLCLEARED));
    eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLREJECTED));
    eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_MANUALCALLACCEPTED));
    eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_APPLICATION_READY));
    eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
    eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_OUTGOING_CALL));
    eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_OUTGOINGCALL));
    // stop HTTP Server
    this.m_httpSrv.stop();
    this.m_httpSrv = null;
    ClientRegistry.getInstance().shutdown();
    this.m_logger.info("Server is shut down ...");
}
Also used : IHttpRequest(de.janrufmonitor.service.commons.http.IHttpRequest) ShutdownHandler(de.janrufmonitor.service.server.request.handler.ShutdownHandler) IEventBroker(de.janrufmonitor.framework.event.IEventBroker)

Aggregations

IEventBroker (de.janrufmonitor.framework.event.IEventBroker)1 IHttpRequest (de.janrufmonitor.service.commons.http.IHttpRequest)1 ShutdownHandler (de.janrufmonitor.service.server.request.handler.ShutdownHandler)1