private void reset() { // disabled related to #44 synchronized (manageableLock) { // clear init flag initialized = false; // clear existing instances. if (informerWatchDog != null) { informerWatchDog.shutdown(); informerWatchDog = null; informer = new NotInitializedRSBInformer<>(); } if (serverWatchDog != null) { serverWatchDog.shutdown(); serverWatchDog = null; server = new NotInitializedRSBLocalServer(); } } }
/** * Create a communication service. * * @param builder the initial data builder * @throws InstantiationException if the creation fails */ public RSBCommunicationService(final MB builder) throws InstantiationException { logger.debug("Create RSBCommunicationService for component " + getClass().getSimpleName() + "."); this.dataBuilder = builder; try { if (builder == null) { throw new NotAvailableException("builder"); } this.controllerAvailabilityState = ControllerAvailabilityState.OFFLINE; this.dataLock = new ReentrantReadWriteLock(); this.dataBuilderReadLock = dataLock.readLock(); this.dataBuilderWriteLock = dataLock.writeLock(); this.messageClass = detectDataClass(); this.server = new NotInitializedRSBLocalServer(); this.informer = new NotInitializedRSBInformer<>(); this.dataObserver = new MessageObservable(this); this.dataObserver.setExecutorService(GlobalCachedExecutorService.getInstance().getExecutorService()); this.initialized = false; this.destroyed = false; this.shutdownDeamon = registerShutdownHook(this); } catch (CouldNotPerformException ex) { throw new InstantiationException(this, ex); } }