@Override public void shutdown(boolean poweroff) throws Exception { ShutdownCommand command = new ShutdownCommand(clusterManager.generateId()); Set<Node> nodes = clusterManager.listNodes(); command.setDestination(nodes); command.setHalt(poweroff); executionContext.execute(command); }
@Override public ShutdownResult execute(ShutdownCommand command) { try { if (command.isHalt()) { bundleContext.getBundle(0).stop(); } else { ServiceReference<FeaturesService> ref = bundleContext.getServiceReference(FeaturesService.class); FeaturesService featuresService = bundleContext.getService(ref); featuresService.uninstallFeature("cellar"); bundleContext.ungetService(ref); } } catch (Exception e) { // nothing to do } return new ShutdownResult(command.getId()); }
@Override public ShutdownResult execute(ShutdownCommand command) { try { if (command.isHalt()) { bundleContext.getBundle(0).stop(); } else { ServiceReference<FeaturesService> ref = bundleContext.getServiceReference(FeaturesService.class); FeaturesService featuresService = bundleContext.getService(ref); featuresService.uninstallFeature("cellar"); bundleContext.ungetService(ref); } } catch (Exception e) { // nothing to do } return new ShutdownResult(command.getId()); }
@Override public void shutdown(boolean poweroff) throws Exception { ShutdownCommand command = new ShutdownCommand(clusterManager.generateId()); Set<Node> nodes = clusterManager.listNodes(); command.setDestination(nodes); command.setHalt(poweroff); executionContext.execute(command); }
@Override protected Object doExecute() throws Exception { org.apache.karaf.cellar.core.control.ShutdownCommand command = new org.apache.karaf.cellar.core.control.ShutdownCommand(clusterManager.generateId()); Set<Node> recipientList = clusterManager.listNodes(); command.setDestination(recipientList); command.setHalt(halt); System.out.println("!! Cluster shutdown !!"); executionContext.execute(command); return null; }