synchronized void runPendingExecutions(boolean async) { if (log.isLoggable(Level.FINEST)) log.finest("Executing pending operations: " + pendingExecutions.size()); for (Runnable pendingExecution : pendingExecutions) { if (async) getConfiguration().getAsyncProtocolExecutor().execute(pendingExecution); else pendingExecution.run(); } if (pendingExecutions.size() > 0) { pendingExecutions.clear(); } }
/** * Starts background maintenance immediately. */ @Inject public RegistryImpl(UpnpService upnpService) { log.fine("Creating Registry: " + getClass().getName()); this.upnpService = upnpService; log.fine("Starting registry background maintenance..."); registryMaintainer = createRegistryMaintainer(); if (registryMaintainer != null) { getConfiguration().getRegistryMaintainerExecutor().execute(registryMaintainer); } }
synchronized public void notifyDiscoveryFailure(final RemoteDevice device, final Exception ex) { for (final RegistryListener listener : getListeners()) { getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { listener.remoteDeviceDiscoveryFailed(RegistryImpl.this, device, ex); } } ); } }
protected RegistryMaintainer createRegistryMaintainer() { return new RegistryMaintainer( this, getConfiguration().getRegistryMaintenanceIntervalMillis() ); }
synchronized public void resume() { if (registryMaintainer == null) { log.fine("Resuming registry maintenance"); remoteItems.resume(); registryMaintainer = createRegistryMaintainer(); if (registryMaintainer != null) { getConfiguration().getRegistryMaintainerExecutor().execute(registryMaintainer); } } }
Resource[] getResources(Device device) throws RegistrationException { try { return registry.getConfiguration().getNamespace().getResources(device); } catch (ValidationException ex) { throw new RegistrationException("Resource discover error: " + ex.toString(), ex); } } }
synchronized public boolean notifyDiscoveryStart(final RemoteDevice device) { // Exit if we have it already, this is atomic inside this method, finally if (getUpnpService().getRegistry().getRemoteDevice(device.getIdentity().getUdn(), true) != null) { log.finer("Not notifying listeners, already registered: " + device); return false; } for (final RegistryListener listener : getListeners()) { getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { listener.remoteDeviceDiscoveryStarted(RegistryImpl.this, device); } } ); } return true; }
registeredRemoteDevice.getIdentity().getUdn(), registeredRemoteDevice, registry.getConfiguration().getRemoteDeviceMaxAgeSeconds() != null ? registry.getConfiguration().getRemoteDeviceMaxAgeSeconds() : rdIdentity.getMaxAgeSeconds() ); registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() {
device.getIdentity().getUdn(), device, registry.getConfiguration().getRemoteDeviceMaxAgeSeconds() != null ? registry.getConfiguration().getRemoteDeviceMaxAgeSeconds() : device.getIdentity().getMaxAgeSeconds() ); registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() {
it.remove(); if (!shuttingDown) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() {
int aliveIntervalMillis = registry.getConfiguration().getAliveIntervalMillis(); if(aliveIntervalMillis > 0) { long now = System.currentTimeMillis();
it.remove(); if (!shuttingDown) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() {
registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() {
synchronized void runPendingExecutions(boolean async) { if (log.isLoggable(Level.FINEST)) log.finest("Executing pending operations: " + pendingExecutions.size()); for (Runnable pendingExecution : pendingExecutions) { if (async) getConfiguration().getAsyncProtocolExecutor().execute(pendingExecution); else pendingExecution.run(); } if (pendingExecutions.size() > 0) { pendingExecutions.clear(); } }
/** * Starts background maintenance immediately. */ @Inject public RegistryImpl(UpnpService upnpService) { log.fine("Creating Registry: " + getClass().getName()); this.upnpService = upnpService; log.fine("Starting registry background maintenance..."); registryMaintainer = createRegistryMaintainer(); if (registryMaintainer != null) { getConfiguration().getRegistryMaintainerExecutor().execute(registryMaintainer); } }
synchronized public void notifyDiscoveryFailure(final RemoteDevice device, final Exception ex) { for (final RegistryListener listener : getListeners()) { getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { listener.remoteDeviceDiscoveryFailed(RegistryImpl.this, device, ex); } } ); } }
protected RegistryMaintainer createRegistryMaintainer() { return new RegistryMaintainer( this, getConfiguration().getRegistryMaintenanceIntervalMillis() ); }
synchronized public void resume() { if (registryMaintainer == null) { log.fine("Resuming registry maintenance"); remoteItems.resume(); registryMaintainer = createRegistryMaintainer(); if (registryMaintainer != null) { getConfiguration().getRegistryMaintainerExecutor().execute(registryMaintainer); } } }
Resource[] getResources(Device device) throws RegistrationException { try { return registry.getConfiguration().getNamespace().getResources(device); } catch (ValidationException ex) { throw new RegistrationException("Resource discover error: " + ex.toString(), ex); } } }
synchronized public boolean notifyDiscoveryStart(final RemoteDevice device) { // Exit if we have it already, this is atomic inside this method, finally if (getUpnpService().getRegistry().getRemoteDevice(device.getIdentity().getUdn(), true) != null) { log.finer("Not notifying listeners, already registered: " + device); return false; } for (final RegistryListener listener : getListeners()) { getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { listener.remoteDeviceDiscoveryStarted(RegistryImpl.this, device); } } ); } return true; }