HibernateUtil.close();
    public void destroy() {        Log.info("unloading asterisk-im plugin resources");        try {            Log.info("Unregistering asterisk-im plugin as a component");            // Unregister this component. When unregistering the isComponentReady variable            // will be set to false so new phone calls won't be processed.            ComponentManagerFactory.getComponentManager().removeComponent(NAME);        }        catch (Exception e) {            Log.error(e.getMessage(), e);            // Do nothing. Should never happen.            ComponentManagerFactory.getComponentManager().getLog().error(e);        }        // Revert user presences to what it was before the phone call and send a hang_up        // message to the user        CallSessionFactory callSessionFactory = CallSessionFactory.getCallSessionFactory();        for (String username : UserPresenceUtil.getUsernames()) {            for (CallSession session : callSessionFactory.getUserCallSessions(username)) {                eventHandler.sendHangupMessage(session.getId(), AsteriskUtil.getDevice(session.getChannel()), username);            }            eventHandler.restoreUserPresence(username);        }        // Remove the packet interceptor        InterceptorManager.getInstance().removeInterceptor(onPhoneInterceptor);        // Remove OnPhonePacketInterceptor as a session event listener        SessionEventDispatcher.removeListener(onPhoneInterceptor);        try {            closeManagerConnection();            Log.info("Shutting down Asterisk-IM Thread Pool");            ThreadPool.shutdown();            Log.info("Shutting down Hibernate for Asterisk-IM");            HibernateUtil.close();        }        catch (Exception e) {            // Make sure we catch all exceptions show we can Log anything that might be            // going on            Log.error(e.getMessage(), e);            ComponentManagerFactory.getComponentManager().getLog().error(e);        }    }