@Override public void deactivate() throws InterruptedException, CouldNotPerformException { super.deactivate(); for (final RemoteRegistry remoteRegistry : remoteRegistries) { if (remoteRegistry instanceof SynchronizedRemoteRegistry) { ((SynchronizedRemoteRegistry) remoteRegistry).deactivate(); } } }
/** * Atomic deactivate which makes sure that the maintainer stays the same. * * @param maintainer the current maintainer of this remote * @throws InterruptedException if deactivation is interrupted * @throws CouldNotPerformException if deactivation fails * @throws VerificationFailedException is thrown if the given maintainer does not match the current one */ public void deactivate(final Object maintainer) throws InterruptedException, CouldNotPerformException, VerificationFailedException { if (this.maintainer.equals(maintainer)) { synchronized (maintainerLock) { unlock(maintainer); deactivate(); lock(maintainer); } } else { throw new VerificationFailedException("[" + maintainer + "] is not the current maintainer of this remote"); } }
/** * This method deactivates the remote and cleans all resources. */ @Override public void shutdown() { try { verifyMaintainability(); } catch (VerificationFailedException ex) { throw new RuntimeException("Can not shutdown " + this + "!", ex); } this.shutdownInitiated = true; try { dataObservable.shutdown(); } finally { try { deactivate(); } catch (CouldNotPerformException | InterruptedException ex) { ExceptionPrinter.printHistory("Could not shutdown " + this + "!", ex, logger); } } }
super.deactivate(); } catch (InterruptedException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Unable to deactivate openhab remote!", ex), logger, LogLevel.WARN);