@Override public void onDataReceived(final EventCOMObject eventCOMObject) { // Make sure that it is indeed a Close App event for us! final Identifier name = (Identifier) eventCOMObject.getBody(); if (!provider.providerName.equals(name.getValue())) { Logger.getLogger(CloseAppEventListener.class.getName()).log(Level.FINE, "This Event is not for us! App Directory Id: " + provider.getAppDirectoryId() + " , Related: " + eventCOMObject.getRelated() + " name: " + name.getValue()); return; // If not, get out.. } Logger.getLogger(CloseAppEventListener.class.getName()).log(Level.FINE, "This Event is for us! App Directory Id: " + provider.getAppDirectoryId() + " , Related: " + eventCOMObject.getRelated() + " name: " + name.getValue()); // Even though the subscription will guarantee that... // It is better to double-check if it is a Close App Event request... if (!eventCOMObject.getObjType().equals(AppsLauncherHelper.STOPAPP_OBJECT_TYPE)) { return; // If not, get out.. } Logger.getLogger(CloseAppEventListener.class.getName()).log(Level.INFO, "New StopApp Event Received! " + "For provider: '" + name.getValue() + "' (Related link: " + eventCOMObject.getRelated() + ")"); final ObjectId source = eventCOMObject.getObjectId(); this.provider.closeGracefully(source); }
Long eventId = this.getCOMServices().getEventService().generateAndStoreEvent( AppsLauncherHelper.STOPPING_OBJECT_TYPE, ConfigurationProviderSingleton.getDomain(), null); final URI uri = this.getCOMServices().getEventService().getConnectionProvider().getIPCConnectionDetails().getProviderURI(); this.getCOMServices().getEventService().publishEvent(uri, eventId, AppsLauncherHelper.STOPPING_OBJECT_TYPE, null, source, null); } catch (IOException ex) { final URI centralDirectoryURI = this.readCentralDirectoryServiceURI(); directoryServiceConsumer.getDirectoryStub().withdrawProvider(this.getAppDirectoryId()); directoryServiceConsumer.closeConnection(); } catch (MALException ex) { Long eventId2 = this.getCOMServices().getEventService().generateAndStoreEvent( AppsLauncherHelper.STOPPED_OBJECT_TYPE, ConfigurationProviderSingleton.getDomain(), this.getCOMServices().getEventService().publishEvent(uri, eventId2, AppsLauncherHelper.STOPPED_OBJECT_TYPE, null, source, null); } catch (IOException ex) { this.getCOMServices().closeAll();
URI centralDirectoryURI = this.readCentralDirectoryServiceURI(); serviceCOMEvent.addEventReceivedListener(subscription, new CloseAppEventListener(this)); final ProviderSummary filteredConnections = NanoSatMOConnectorImpl.selectBestIPCTransport(supervisorConnections.get(0)); final ConnectionConsumer supervisorCCPlat = HelperCommon.providerSummaryToConnectionConsumer(filteredConnections); this.startMCServices(mcAdapter); directoryService.init(comServices); heartbeatService.init(); this.initAdditionalServices();