public ProtocolFactory getProtocolFactory() { return getUpnpService().getProtocolFactory(); }
public void eventReceived() { // The only thing we are interested in, sending an event when the state changes getUpnpService().getConfiguration().getSyncProtocolExecutorService().execute( getUpnpService().getProtocolFactory().createSendingEvent(this) ); } };
@Override public void responseSent(StreamResponseMessage responseMessage) { if (subscription == null) return; // Preconditions failed very early on if (responseMessage != null && !responseMessage.getOperation().isFailed() && subscription.getCurrentSequence().getValue() == 0) { // Note that renewals should not have 0 // This is a minor concurrency issue: If we now register on the service and henceforth send a new // event message whenever the state of the service changes, there is still a chance that the initial // event message arrives later than the first on-change event message. Shouldn't be a problem as the // subscriber is supposed to figure out what to do with out-of-sequence messages. I would be // surprised though if actual implementations won't crash! log.fine("Establishing subscription"); subscription.registerOnService(); subscription.establish(); log.fine("Response to subscription sent successfully, now sending initial event asynchronously"); getUpnpService().getConfiguration().getAsyncProtocolExecutor().execute( getUpnpService().getProtocolFactory().createSendingEvent(subscription) ); } else if (subscription.getCurrentSequence().getValue() == 0) { log.fine("Subscription request's response aborted, not sending initial event"); if (responseMessage == null) { log.fine("Reason: No response at all from subscriber"); } else { log.fine("Reason: " + responseMessage.getOperation()); } log.fine("Removing subscription from registry: " + subscription); getUpnpService().getRegistry().removeLocalSubscription(subscription); } }
public ProtocolFactory getProtocolFactory() { return getUpnpService().getProtocolFactory(); }
public void eventReceived() { // The only thing we are interested in, sending an event when the state changes getUpnpService().getConfiguration().getSyncProtocolExecutorService().execute( getUpnpService().getProtocolFactory().createSendingEvent(this) ); } };
@Override public void responseSent(StreamResponseMessage responseMessage) { if (subscription == null) return; // Preconditions failed very early on if (responseMessage != null && !responseMessage.getOperation().isFailed() && subscription.getCurrentSequence().getValue() == 0) { // Note that renewals should not have 0 // This is a minor concurrency issue: If we now register on the service and henceforth send a new // event message whenever the state of the service changes, there is still a chance that the initial // event message arrives later than the first on-change event message. Shouldn't be a problem as the // subscriber is supposed to figure out what to do with out-of-sequence messages. I would be // surprised though if actual implementations won't crash! log.fine("Establishing subscription"); subscription.registerOnService(); subscription.establish(); log.fine("Response to subscription sent successfully, now sending initial event asynchronously"); getUpnpService().getConfiguration().getAsyncProtocolExecutor().execute( getUpnpService().getProtocolFactory().createSendingEvent(subscription) ); } else if (subscription.getCurrentSequence().getValue() == 0) { log.fine("Subscription request's response aborted, not sending initial event"); if (responseMessage == null) { log.fine("Reason: No response at all from subscriber"); } else { log.fine("Reason: " + responseMessage.getOperation()); } log.fine("Removing subscription from registry: " + subscription); getUpnpService().getRegistry().removeLocalSubscription(subscription); } }
public ProtocolFactory getProtocolFactory() { return getUpnpService().getProtocolFactory(); }
public void eventReceived() { // The only thing we are interested in, sending an event when the state changes getUpnpService().getConfiguration().getSyncProtocolExecutorService().execute( getUpnpService().getProtocolFactory().createSendingEvent(this) ); } };
@Override public void responseSent(StreamResponseMessage responseMessage) { if (subscription == null) return; // Preconditions failed very early on if (responseMessage != null && !responseMessage.getOperation().isFailed() && subscription.getCurrentSequence().getValue() == 0) { // Note that renewals should not have 0 // This is a minor concurrency issue: If we now register on the service and henceforth send a new // event message whenever the state of the service changes, there is still a chance that the initial // event message arrives later than the first on-change event message. Shouldn't be a problem as the // subscriber is supposed to figure out what to do with out-of-sequence messages. I would be // surprised though if actual implementations won't crash! log.fine("Establishing subscription"); subscription.registerOnService(); subscription.establish(); log.fine("Response to subscription sent successfully, now sending initial event asynchronously"); getUpnpService().getConfiguration().getAsyncProtocolExecutor().execute( getUpnpService().getProtocolFactory().createSendingEvent(subscription) ); } else if (subscription.getCurrentSequence().getValue() == 0) { log.fine("Subscription request's response aborted, not sending initial event"); if (responseMessage == null) { log.fine("Reason: No response at all from subscriber"); } else { log.fine("Reason: " + responseMessage.getOperation()); } log.fine("Removing subscription from registry: " + subscription); getUpnpService().getRegistry().removeLocalSubscription(subscription); } }