private void processSeqNumber(EventClientSync request, SyncContext responseHolder) { if (request.isSeqNumberRequest()) { EventServerSync response = responseHolder.getResponse().getEventSync(); if (response == null) { response = new EventServerSync(); responseHolder.getResponse().setEventSync(response); } response.setEventSequenceNumberResponse(new EventSequenceNumberResponse( Math.max(state.getEventSeqNumber(), 0))); } }
return true; if (response.getEventSync() != null) { if (response.getEventSync().getEventSequenceNumberResponse() != null) { return true; if (response.getEventSync().getEvents() != null && !response.getEventSync().getEvents().isEmpty()) { return true; if (response.getEventSync().getEventListenersResponses() != null && !response.getEventSync().getEventListenersResponses().isEmpty()) { return true;
extensionCount++; if (sync.getEventSync() != null) { encode(buf, sync.getEventSync()); extensionCount++;
private void addEventsAndReply(ActorContext context, ChannelMetaData channel, EndpointEventReceiveMessage message) { SyncRequestMessage pendingRequest = channel.getRequestMessage(); SyncContext pendingResponse = channel.getResponseHolder(); EventServerSync eventResponse = pendingResponse.getResponse().getEventSync(); if (eventResponse == null) { eventResponse = new EventServerSync(); pendingResponse.getResponse().setEventSync(eventResponse); } eventResponse.setEvents(message.getEvents()); sendReply(context, pendingRequest, pendingResponse.getResponse()); if (!channel.getType().isAsync()) { state.removeChannel(channel); } }
/** * make deep copy of <code>ServerSync</code> instance. * * @param source is source for copping * @return deep copy of <code>ServerSync</code> instance */ public static ServerSync deepCopy(ServerSync source) { if (source == null) { return null; } ServerSync copy = new ServerSync(); copy.setRequestId(source.getRequestId()); copy.setStatus(source.getStatus()); copy.setUserSync(deepCopy(source.getUserSync())); copy.setRedirectSync(deepCopy(source.getRedirectSync())); copy.setProfileSync(deepCopy(source.getProfileSync())); copy.setNotificationSync(deepCopy(source.getNotificationSync())); copy.setLogSync(deepCopy(source.getLogSync())); copy.setEventSync(deepCopy(source.getEventSync())); copy.setConfigurationSync(deepCopy(source.getConfigurationSync())); return copy; }
/** * Converts {@link ServerSync} to Avro {@link SyncResponse}. * * @param source the server sync * @return the Avro sync response */ public static SyncResponse convert(ServerSync source) { SyncResponse sync = new SyncResponse(); sync.setRequestId(source.getRequestId()); sync.setStatus(convert(source.getStatus())); sync.setBootstrapSyncResponse(convert(source.getBootstrapSync())); sync.setRedirectSyncResponse(convert(source.getRedirectSync())); sync.setProfileSyncResponse(convert(source.getProfileSync())); sync.setConfigurationSyncResponse(convert(source.getConfigurationSync())); sync.setNotificationSyncResponse(convert(source.getNotificationSync())); sync.setEventSyncResponse(convert(source.getEventSync())); sync.setUserSyncResponse(convert(source.getUserSync())); sync.setLogSyncResponse(convert(source.getLogSync())); return sync; }