@Override public void timeoutExpired(Request request) { try { sendAndStateLock.lock(); if (request.getApplicationId() == appId) { if (request.getCommandCode() == PushNotificationRequest.code) { handleEvent(new Event(Event.Type.TIMEOUT_EXPIRES, factory.createPushNotificationRequest(request), null)); return; } } } catch (Exception e) { logger.debug("Failed to process timeout message", e); } finally { sendAndStateLock.unlock(); } }
@Override public void run() { try { sendAndStateLock.lock(); if (request.getApplicationId() == appId) { if (request.getCommandCode() == PushNotificationRequest.code) { handleEvent(new Event(Event.Type.RECEIVE_PUSH_NOTIFICATION_ANSWER, factory.createPushNotificationRequest(request), factory.createPushNotificationAnswer(answer))); return; } else { listener.doOtherEvent(session, new AppRequestEventImpl(request), new AppAnswerEventImpl(answer)); } } else { logger.warn("Message with Application-Id {} reached Application Session with Application-Id {}. Skipping.", request.getApplicationId(), appId); } } catch (Exception e) { logger.debug("Failed to process success message", e); } finally { sendAndStateLock.unlock(); } } }
@Override public void run() { try { if (request.getApplicationId() == factory.getApplicationId()) { if (request.getCommandCode() == PushNotificationRequest.code) { handleEvent(new Event(Event.Type.RECEIVE_PUSH_NOTIFICATION_REQUEST, factory.createPushNotificationRequest(request), null)); return; } } listener.doOtherEvent(session, new AppRequestEventImpl(request), null); } catch (Exception e) { logger.debug("Failed to process request {}", request, e); } } }
@Override public void run() { try { sendAndStateLock.lock(); if (request.getApplicationId() == factory.getApplicationId()) { if (request.getCommandCode() == ProfileUpdateRequest.code) { handleEvent( new Event(Event.Type.RECEIVE_PROFILE_UPDATE_ANSWER, factory.createProfileUpdateRequest(request), factory.createProfileUpdateAnswer(answer))); return; } else if (request.getCommandCode() == UserDataRequest.code) { handleEvent(new Event(Event.Type.RECEIVE_USER_DATA_ANSWER, factory.createUserDataRequest(request), factory.createUserDataAnswer(answer))); return; } else if (request.getCommandCode() == SubscribeNotificationsRequest.code) { handleEvent(new Event(Event.Type.RECEIVE_SUBSCRIBE_NOTIFICATIONS_ANSWER, factory.createSubscribeNotificationsRequest(request), factory .createSubscribeNotificationsAnswer(answer))); return; } } listener.doOtherEvent(session, new AppRequestEventImpl(request), new AppAnswerEventImpl(answer)); } catch (Exception e) { logger.debug("Failed to process success message", e); } finally { sendAndStateLock.unlock(); } } }
@Override public void timeoutExpired(Request request) { try { if (request.getApplicationId() == factory.getApplicationId()) { if (request.getCommandCode() == ProfileUpdateRequest.code) { handleEvent(new Event(Event.Type.TIMEOUT_EXPIRES, factory.createProfileUpdateRequest(request), null)); return; } else if (request.getCommandCode() == UserDataRequest.code) { handleEvent(new Event(Event.Type.TIMEOUT_EXPIRES, factory.createUserDataRequest(request), null)); return; } else if (request.getCommandCode() == SubscribeNotificationsRequest.code) { handleEvent(new Event(Event.Type.TIMEOUT_EXPIRES, factory.createSubscribeNotificationsRequest(request), null)); return; } } } catch (Exception e) { logger.debug("Failed to process timeout message", e); } }
@Override public void run() { try { if (request.getApplicationId() == appId) { if (request.getCommandCode() == SubscribeNotificationsRequest.code) { handleEvent(new Event(Event.Type.RECEIVE_SUBSCRIBE_NOTIFICATIONS_REQUEST, factory.createSubscribeNotificationsRequest(request), null)); } else if (request.getCommandCode() == UserDataRequest.code) { handleEvent(new Event(Event.Type.RECEIVE_USER_DATA_REQUEST, factory.createUserDataRequest(request), null)); } else if (request.getCommandCode() == ProfileUpdateRequest.code) { handleEvent(new Event(Event.Type.RECEIVE_PROFILE_UPDATE_REQUEST, factory.createProfileUpdateRequest(request), null)); } else { listener.doOtherEvent(session, new AppRequestEventImpl(request), null); } } } catch (Exception e) { logger.debug("Failed to process request message", e); } } }