/** * Issues the subscription failures. * * @param gseResponse The GetStreamingEvents response. */ private void issueSubscriptionFailures(GetStreamingEventsResponse gseResponse) { ServiceResponseException exception = new ServiceResponseException(gseResponse); for (String id : gseResponse.getErrorSubscriptionIds()) { StreamingSubscription subscription = null; synchronized (this) { // Client can do any good or bad things in the below event // handler if (this.subscriptions != null && this.subscriptions.containsKey(id)) { subscription = this.subscriptions.get(id); } } if (subscription != null) { SubscriptionErrorEventArgs eventArgs = new SubscriptionErrorEventArgs(subscription, exception); if (!onSubscriptionError.isEmpty()) { for (ISubscriptionErrorDelegate subError : onSubscriptionError) { subError.subscriptionErrorDelegate(this, eventArgs); } } } if (gseResponse.getErrorCode() != ServiceError.ErrorMissedNotificationEvents) { // Client can do any good or bad things in the above event // handler synchronized (this) { if (this.subscriptions != null && this.subscriptions.containsKey(id)) { // We are no longer servicing the subscription. this.subscriptions.remove(id); } } } } }