@Override public String toString() { return "NotificationImpl[messageType=" + getMessageType() + ", acks=" + acks + "]"; }
@Override public NotificationMessageImpl deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final ObjectCodec oc = jp.getCodec(); final JsonNode node = oc.readTree(jp); final JsonNode updatesNode = node.get(NotificationMessage.UPDATES_FIELD); final Set<Ack> acks = new HashSet<Ack>(); if (updatesNode.isArray()) { for (JsonNode channelNode : updatesNode) { final JsonNode versionNode = channelNode.get(NotificationMessage.VERSION_FIELD); final JsonNode channelIdNode = channelNode.get(RegisterMessage.CHANNEL_ID_FIELD); acks.add(new AckImpl(channelIdNode.asText(), versionNode.asLong())); } } return new NotificationMessageImpl(acks); } }
@Override public NotificationMessageImpl deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final ObjectCodec oc = jp.getCodec(); final JsonNode node = oc.readTree(jp); final JsonNode updatesNode = node.get(NotificationMessage.UPDATES_FIELD); final Set<Ack> acks = new HashSet<Ack>(); if (updatesNode.isArray()) { for (JsonNode channelNode : updatesNode) { final JsonNode versionNode = channelNode.get(NotificationMessage.VERSION_FIELD); final JsonNode channelIdNode = channelNode.get(RegisterMessage.CHANNEL_ID_FIELD); acks.add(new AckImpl(channelIdNode.asText(), versionNode.asLong())); } } return new NotificationMessageImpl(acks); } }
@Override public void run() { final Set<Ack> unacked = simplePushServer.getUnacknowledged(uaid); logger.info("Resending " + unacked); session.send(toJson(new NotificationMessageImpl(unacked))); } },
@Override public String toString() { return "NotificationImpl[messageType=" + getMessageType() + ", acks=" + acks + "]"; }
@Override public void run() { final Set<Ack> unacked = simplePushServer.getUnacknowledged(uaid); logger.info("Resending " + unacked); session.send(toJson(new NotificationMessageImpl(unacked))); } },
@Override public Void call() throws Exception { try { final Notification notification = simplePushServer.handleNotification(endpoint, payload.toString(UTF_8)); final String uaid = notification.uaid(); final SockJsSessionContext session = userAgents.get(uaid).context(); if (logger.isDebugEnabled()) { logger.debug("Sending notification for UAID [ " + notification.uaid() + "] " + toJson(new NotificationMessageImpl(notification.ack()))); } session.send(toJson(new NotificationMessageImpl(notification.ack()))); userAgents.updateAccessedTime(uaid); } catch (final ChannelNotFoundException e) { logger.debug("Could not find channel for [" + endpoint + "]"); } catch (final VersionException e) { logger.debug(e.getMessage()); } finally { payload.release(); } return null; } }
@Override public Void call() throws Exception { try { final Notification notification = simplePushServer.handleNotification(endpoint, payload.toString(UTF_8)); final String uaid = notification.uaid(); final SockJsSessionContext session = userAgents.get(uaid).context(); if (logger.isDebugEnabled()) { logger.debug("Sending notification for UAID [ " + notification.uaid() + "] " + toJson(new NotificationMessageImpl(notification.ack()))); } session.send(toJson(new NotificationMessageImpl(notification.ack()))); userAgents.updateAccessedTime(uaid); } catch (final ChannelNotFoundException e) { logger.debug("Could not find channel for [" + endpoint + "]"); } catch (final VersionException e) { logger.debug(e.getMessage()); } finally { payload.release(); } return null; } }