/** * 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 UserActivityRegistryRemote getUserActivityRegistry() throws NotAvailableException, InterruptedException { return CachedUserActivityRegistryRemote.getRegistry(); }
/** * 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 UserActivityRegistryRemote getUserActivityRegistry(final boolean waitForData) throws CouldNotPerformException, InterruptedException { if (waitForData) { CachedUserActivityRegistryRemote.getRegistry().waitForData(); } return CachedUserActivityRegistryRemote.getRegistry(); }
/** * Method blocks until the registry is not handling any tasks and is currently consistent. * <p> * 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(); }
public static void waitForData() throws InterruptedException, CouldNotPerformException { getRegistry().waitForData(); }
public static void waitForData(long timeout, TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException { getRegistry().waitForData(timeout, timeUnit); }
public synchronized static void reinitialize() throws InterruptedException, CouldNotPerformException { try { if (shutdown) { throw new InvalidStateException("Remote service is shutting down!"); } getRegistry().reinit(REMOTE_LOCK); getRegistry().requestData().get(10, TimeUnit.SECONDS); } catch (ExecutionException | TimeoutException | CouldNotPerformException | CancellationException ex) { throw new CouldNotPerformException("Could not reinitialize " + CachedUserActivityRegistryRemote.class.getSimpleName() + "!", ex); } }
public static boolean isDataAvailable() { try { return CachedUnitRegistryRemote.getRegistry().isDataAvailable() && CachedAgentRegistryRemote.getRegistry().isDataAvailable() && CachedAppRegistryRemote.getRegistry().isDataAvailable() && CachedDeviceRegistryRemote.getRegistry().isDataAvailable() && CachedLocationRegistryRemote.getRegistry().isDataAvailable() && CachedSceneRegistryRemote.getRegistry().isDataAvailable() && CachedUserRegistryRemote.getRegistry().isDataAvailable() && CachedUserActivityRegistryRemote.getRegistry().isDataAvailable(); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } catch (NotAvailableException ex) { // at least one remote is not available. } return false; }