/** * Method blocks until the registry is not handling any tasks and is currently consistent. * * Note: If you have just modified the registry this method can maybe return immediately if the task is not yet received by the registry controller. So you should prefer the futures of the modification methods for synchronization tasks. * * @throws InterruptedException is thrown in case the thread was externally interrupted. * @throws org.openbase.jul.exception.CouldNotPerformException is thrown if the wait could not be performed. */ public static void waitUntilReady() throws InterruptedException, CouldNotPerformException { getRegistry().waitUntilReady(); }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} */ @Override public List<UnitConfig> getUnitConfigsByLocation(final String locationId) throws CouldNotPerformException { return getUnitConfigsByLocation(locationId, true); }
@Override protected void registerRemoteRegistries() throws CouldNotPerformException { registerRemoteRegistry(locationUnitConfigRemoteRegistry); registerRemoteRegistry(connectionUnitConfigRemoteRegistry); }
public static void waitForData() throws InterruptedException, CouldNotPerformException { getRegistry().waitForData(); }
public List<LocationRemote> getNeighborLocationList(final boolean waitForData) throws CouldNotPerformException { final List<LocationRemote> neighborList = new ArrayList<>(); try { for (UnitConfig locationUnitConfig : CachedLocationRegistryRemote.getRegistry().getNeighborLocations(getId())) { neighborList.add(Units.getUnit(locationUnitConfig, waitForData, LOCATION)); } } catch (InterruptedException ex) { throw new CouldNotPerformException("Could not get all neighbors!", ex); } return neighborList; }
public synchronized static void reinitialize() throws InterruptedException, CouldNotPerformException { try { getRegistry().reinit(REMOTE_LOCK); getRegistry().requestData().get(10, TimeUnit.SECONDS); } catch (ExecutionException | TimeoutException | CouldNotPerformException | CancellationException ex) { throw new CouldNotPerformException("Could not reinitialize " + CachedLocationRegistryRemote.class.getSimpleName() + "!", ex); } }
/** * Returns an initialized and activated remote registry. * * @return the remote registry instance. * @throws NotAvailableException * @throws InterruptedException is thrown if thread is externally interrupted. */ public static LocationRegistryRemote getLocationRegistry() throws NotAvailableException, InterruptedException { return CachedLocationRegistryRemote.getRegistry(); }
@Override public void activate() throws InterruptedException, CouldNotPerformException { // TODO is this wait for data realy needed? blocking activation method is some kind of bad behaviour. CachedLocationRegistryRemote.waitForData(); serviceRemoteManager.activate(); super.activate(); }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} * @throws org.openbase.jul.exception.NotAvailableException {@inheritDoc} */ @Override public List<UnitConfig> getLocationConfigs() throws CouldNotPerformException, NotAvailableException { validateData(); return locationUnitConfigRemoteRegistry.getMessages(); }
@Override public Boolean isConsistent() throws CouldNotPerformException { return isLocationConfigRegistryConsistent() && isConnectionConfigRegistryConsistent(); } }
@Override protected void bindRegistryRemoteToRemoteRegistries() { try { bindRegistryRemoteToRemoteRegistry(locationUnitConfigRemoteRegistry, unitRegistry, UnitRegistryData.LOCATION_UNIT_CONFIG_FIELD_NUMBER); bindRegistryRemoteToRemoteRegistry(connectionUnitConfigRemoteRegistry, unitRegistry, UnitRegistryData.CONNECTION_UNIT_CONFIG_FIELD_NUMBER); } catch (CouldNotPerformException ex) { new FatalImplementationErrorException("Could not bind registries", this, ex); } }
/** * Returns an initialized and activated remote registry. * * @param waitForData defines if this call should block until the registry data is available. * @return the remote registry instance. * @throws NotAvailableException * @throws InterruptedException is thrown if thread is externally interrupted. */ public static LocationRegistryRemote getLocationRegistry(final boolean waitForData) throws CouldNotPerformException, InterruptedException { if (waitForData) { CachedLocationRegistryRemote.getRegistry().waitForData(); } return CachedLocationRegistryRemote.getRegistry(); }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} */ @Override public Boolean containsLocationConfig(final UnitConfig locationConfig) throws CouldNotPerformException { validateData(); return locationUnitConfigRemoteRegistry.contains(locationConfig); }
public static void waitForData(long timeout, TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException { getRegistry().waitForData(timeout, timeUnit); }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} */ @Override public Boolean containsConnectionConfig(UnitConfig connectionConfig) throws CouldNotPerformException { validateData(); return connectionUnitConfigRemoteRegistry.contains(connectionConfig); }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} */ @Override public Boolean containsLocationConfigById(final String locationId) throws CouldNotPerformException { validateData(); return locationUnitConfigRemoteRegistry.contains(locationId); }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} */ @Override public UnitConfig getConnectionConfigById(String connectionId) throws CouldNotPerformException { validateData(); return connectionUnitConfigRemoteRegistry.getMessage(connectionId); }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} */ @Override public UnitConfig getLocationConfigById(final String locationId) throws CouldNotPerformException { validateData(); return locationUnitConfigRemoteRegistry.getMessage(locationId); }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} */ @Override public Boolean containsConnectionConfigById(String connectionId) throws CouldNotPerformException { validateData(); return connectionUnitConfigRemoteRegistry.contains(connectionId); }
/** * {@inheritDoc} * * @throws org.openbase.jul.exception.CouldNotPerformException {@inheritDoc} * @throws org.openbase.jul.exception.NotAvailableException {@inheritDoc} */ @Override public List<UnitConfig> getConnectionConfigs() throws CouldNotPerformException { validateData(); List<UnitConfig> messages = connectionUnitConfigRemoteRegistry.getMessages(); return messages; }