/** * Handles the events ClientConnectionCloseNotificationEvent * * @param fermatEvent */ @Override public void handleClientConnectionCloseNotificationEvent(FermatEvent fermatEvent) { if (fermatEvent instanceof ClientConnectionCloseNotificationEvent) { // // try { // // List<CryptoPaymentRequest> cryptoAddressRequestList = // cryptoPaymentRequestNetworkServiceDao.listRequestsByProtocolState(RequestProtocolState.WAITING_RESPONSE); // // for(CryptoPaymentRequest record : cryptoAddressRequestList) { // // // cryptoPaymentRequestNetworkServiceDao.changeProtocolState(record.getRequestId(),RequestProtocolState.PROCESSING_SEND); // } // } // catch(CantListRequestsException | CantChangeRequestProtocolStateException // |RequestNotFoundException e) // { // System.out.print("EXCEPCION REPROCESANDO WAIT MESSAGE"); // e.printStackTrace(); // } this.register = false; if (communicationNetworkServiceConnectionManager != null) communicationNetworkServiceConnectionManager.closeAllConnection(); } }
@Override public void stop() { // remove all listeners from the event manager and from the plugin. for (FermatEventListener listener : listenersAdded) eventManager.removeListener(listener); listenersAdded.clear(); // close all connections. communicationNetworkServiceConnectionManager.closeAllConnection(); // interrupt the registration agent execution communicationRegistrationProcessNetworkServiceAgent.stop(); // interrupt the executor agent execution cryptoPaymentRequestExecutorAgent.stop(); // set to not registered. register = Boolean.FALSE; this.serviceStatus = ServiceStatus.STOPPED; }