@Override public void activate() throws InterruptedException, CouldNotPerformException { super.activate(); getRemoteRegistries().forEach((remoteRegistry) -> { remoteRegistry.addObserver(synchronisationObserver); }); // initial check synchronized (virtualRegistrySyncLock) { virtualRegistrySyncLock.notifyAll(); } }
@Override public void deactivate() throws InterruptedException, CouldNotPerformException { getRemoteRegistries().forEach((remoteRegistry) -> { remoteRegistry.removeObserver(synchronisationObserver); }); super.deactivate(); }
/** * {@inheritDoc} * * @return {@inheritDoc} * @throws InterruptedException {@inheritDoc} */ @Override public Boolean isReady() throws InterruptedException { // todo release: "is" method should not block and return an InterruptedException try { if (!isConnected()) { return false; } ping().get(); return RPCHelper.callRemoteMethod(this, Boolean.class).get(30000, TimeUnit.MILLISECONDS); } catch (CouldNotPerformException | ExecutionException | TimeoutException ex) { ExceptionPrinter.printHistory("Could not check if registry is ready!", ex, logger); return false; } }
/** * {@inheritDoc} * * @throws InterruptedException {@inheritDoc} * @throws CouldNotPerformException {@inheritDoc} */ @Override public void waitUntilReady() throws InterruptedException, CouldNotPerformException { try { waitForData(); RPCHelper.callRemoteMethod(this, Void.class).get(); } catch (final CouldNotPerformException | ExecutionException | CancellationException ex) { throw new CouldNotPerformException("Could not wait until " + this + " is ready!", ex); } }
@Override public Boolean isReady() throws InterruptedException { return isDataAvailable() && super.isReady(); }
@Override protected void postInit() throws InitializationException, InterruptedException { super.postInit(); registryRemotes.clear(); registerRegistryRemotes(); bindRegistryRemoteToRemoteRegistries(); }
@Override public boolean isDataAvailable() { for (RegistryRemote registryRemote : registryRemotes) { if (!registryRemote.isDataAvailable()) { return false; } } // TODO release: // workaround, should be removed in release scrab virtualRegistryInitiallySynchronized = virtualRegistryInitiallySynchronized || isVirtualRegistrySynchronized(); return super.isDataAvailable() && virtualRegistryInitiallySynchronized; }
@Override protected void postInit() throws InitializationException, InterruptedException { super.postInit(); try { try { remoteRegistries.clear(); registerRemoteRegistries(); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not activate version control for all internal registries!", ex); } } catch (CouldNotPerformException ex) { throw new InitializationException(this, ex); } }
@Override public void waitForData() throws CouldNotPerformException, InterruptedException { for (RegistryRemote registryRemote : registryRemotes) { registryRemote.waitForData(); } super.waitForData(); waitForVirtualRegistrySync(); }
@Override public void activate() throws InterruptedException, CouldNotPerformException { authorizationFilter.setAuthorizationGroups(authorizationGroupUnitConfigRemoteRegistry.getEntryMap()); authorizationFilter.setLocations(locationUnitConfigRemoteRegistry.getEntryMap()); super.activate(); }