@Override public void addShutdownHook(Runnable runnable) { service.addShutdownHook(runnable); }
/** * Constructs the <tt>AsyncDispatcher</tt> with the specified service. The injection makes it possible to obtain * a reference to the <tt>ErraiService</tt> * * @param service the service where the bus is located */ @Inject public AsyncDispatcher(final ErraiService service) { this.service = service; this.workerFactory = new WorkerFactory(service); service.addShutdownHook(new Runnable() { @Override public void run() { workerFactory.stopPool(); } }); }
svc.addShutdownHook(new Runnable() { @Override public void run() {
@Inject private JGroupsClusteringProvider(final ServerMessageBus messageBus, final ErraiServiceConfigurator config, final ErraiService erraiService) { this.serverMessageBus = messageBus; try { jchannel = new JChannel(JGroupsConfigAttribs.JGROUPS_PROTOCOL_STACK.get(config)); jchannel.connect(ErraiConfigAttribs.CLUSTER_NAME.get(config)); // I don't think waiting for the state is necessary. // jchannel.getState(null, 2000); } catch (Exception e) { throw new RuntimeException(e); } serverMessageBus.subscribe(CLUSTER_SERVICE, this); jchannel.setReceiver(this); erraiService.addShutdownHook(new Runnable() { @Override public void run() { jchannel.close(); log.info("shut down jgroups clustering service"); } }); sessionToNodeCache = CacheBuilder.newBuilder() .maximumSize(100) .build(); log.info("starting errai clustering service."); }
@Override public void addShutdownHook(Runnable runnable) { service.addShutdownHook(runnable); }
/** * Constructs the <tt>AsyncDispatcher</tt> with the specified service. The injection makes it possible to obtain * a reference to the <tt>ErraiService</tt> * * @param service the service where the bus is located */ @Inject public AsyncDispatcher(final ErraiService service) { this.service = service; this.workerFactory = new WorkerFactory(service); service.addShutdownHook(new Runnable() { @Override public void run() { workerFactory.stopPool(); } }); }
svc.addShutdownHook(new Runnable() { @Override public void run() {
@Inject private JGroupsClusteringProvider(final ServerMessageBus messageBus, final ErraiServiceConfigurator config, final ErraiService erraiService) { this.serverMessageBus = messageBus; try { jchannel = new JChannel(JGroupsConfigAttribs.JGROUPS_PROTOCOL_STACK.get(config)); jchannel.connect(ErraiConfigAttribs.CLUSTER_NAME.get(config)); // I don't think waiting for the state is necessary. // jchannel.getState(null, 2000); } catch (Exception e) { throw new RuntimeException(e); } serverMessageBus.subscribe(CLUSTER_SERVICE, this); jchannel.setReceiver(this); erraiService.addShutdownHook(new Runnable() { @Override public void run() { jchannel.close(); log.info("shut down jgroups clustering service"); } }); sessionToNodeCache = CacheBuilder.newBuilder() .maximumSize(100) .build(); log.info("starting errai clustering service."); }