private Scope detectScope() throws NotAvailableException { synchronized (CONFIG_LOCK) { return detectScope(getConfig()); } }
protected final Object getConfigField(String name) throws CouldNotPerformException { synchronized (CONFIG_LOCK) { return getConfigField(name, getConfig()); } }
if (isActive() && !currentScope.equals(detectScope(config))) { currentScope = detectScope(); reinit(currentScope); notifyConfigUpdate(config); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify config update!", ex), logger);
throw new NotAvailableException("config"); currentScope = detectScope(config); try { applyConfigUpdate(config); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory("Could not apply config update for " + this, ex, logger);
return super.applyConfigUpdate(config);
private Scope detectScope(final CONFIG config) throws NotAvailableException { try { return (Scope) getConfigField(FIELD_SCOPE, config); } catch (CouldNotPerformException ex) { throw new NotAvailableException("scope"); } }
/** * {@inheritDoc} * * @throws InterruptedException {@inheritDoc} * @throws CouldNotPerformException {@inheritDoc} */ @Override public void activate() throws InterruptedException, CouldNotPerformException { if (!isEnabled()) { throw new InvalidStateException("The activation of an remote is not allowed if the referred unit is disabled!"); } if (!Units.contains(this)) { logger.warn("You are using a unit remote which is not maintained by the global unit remote pool! This is extremely inefficient! Please use \"Units.getUnit(...)\" instead creating your own instances!"); } super.activate(); }
for (ServiceTempus serviceTempus : ServiceTempus.values()) { this.unitDataObservableMap.put(serviceTempus, new UnitDataFilteredObservable<>(this, serviceTempus)); super.addDataObserver((Observable<D> source, D data1) -> { unitDataObservableMap.get(serviceTempus).notifyObservers(data1); });
@Override protected Future<Event> internalRequestStatus() throws CouldNotPerformException { if (SessionManager.getInstance().isLoggedIn()) { Event event = new Event(TicketAuthenticatorWrapper.class, SessionManager.getInstance().initializeServiceServerRequest()); return getRemoteServer().callAsync(AuthenticatedRequestable.REQUEST_DATA_AUTHENTICATED_METHOD, event); } else { return super.internalRequestStatus(); } }
/** * {@inheritDoc} * * @throws InitializationException {@inheritDoc} * @throws InterruptedException {@inheritDoc} */ @Override protected void postInit() throws InitializationException, InterruptedException { super.postInit(); try { this.setMessageProcessor(new GenericMessageProcessor<>(getDataClass())); if (!initialized) { Registries.getUnitRegistry().addDataObserver(unitRegistryObserver); initialized = true; } } catch (CouldNotPerformException ex) { throw new InitializationException(this, ex); } }
/** * {@inheritDoc} * * @return {@inheritDoc} * @throws NotAvailableException {@inheritDoc} */ @Override public String getId() throws NotAvailableException { try { String tmpId = (String) getConfigField(TYPE_FIELD_ID); if (tmpId.isEmpty()) { throw new InvalidStateException("config.id is empty!"); } return tmpId; } catch (CouldNotPerformException ex) { logger.debug("Config does not contain the remote id!"); } return super.getId(); }