private synchronized void maybeComplete() { if (!coordinator.hasActiveSessions()) { StreamState finalState = getCurrentState(); if (finalState.hasFailedSession()) { logger.warn("[Stream #{}] Stream failed", planId); setException(new StreamException(finalState, "Stream failed")); } else { logger.info("[Stream #{}] All sessions completed", planId); set(finalState); } } } }
/** * Create new StreamResult of given {@code planId} and type. * * Constructor is package private. You need to use {@link StreamPlan#execute()} to get the instance. * * @param planId Stream plan ID * @param description Stream description */ private StreamResultFuture(UUID planId, String description, StreamCoordinator coordinator) { this.planId = planId; this.description = description; this.coordinator = coordinator; // if there is no session to listen to, we immediately set result for returning if (!coordinator.isReceiving() && !coordinator.hasActiveSessions()) set(getCurrentState()); }
private synchronized void maybeComplete() { if (!coordinator.hasActiveSessions()) { StreamState finalState = getCurrentState(); if (finalState.hasFailedSession()) { logger.warn("[Stream #{}] Stream failed", planId); setException(new StreamException(finalState, "Stream failed")); } else { logger.info("[Stream #{}] All sessions completed", planId); set(finalState); } } } }
/** * Create new StreamResult of given {@code planId} and type. * * Constructor is package private. You need to use {@link StreamPlan#execute()} to get the instance. * * @param planId Stream plan ID * @param description Stream description */ private StreamResultFuture(UUID planId, String description, StreamCoordinator coordinator) { this.planId = planId; this.description = description; this.coordinator = coordinator; // if there is no session to listen to, we immediately set result for returning if (!coordinator.isReceiving() && !coordinator.hasActiveSessions()) set(getCurrentState()); }
private synchronized void maybeComplete() { if (!coordinator.hasActiveSessions()) { StreamState finalState = getCurrentState(); if (finalState.hasFailedSession()) { logger.warn("[Stream #{}] Stream failed", planId); setException(new StreamException(finalState, "Stream failed")); } else { logger.info("[Stream #{}] All sessions completed", planId); set(finalState); } } } }
/** * Create new StreamResult of given {@code planId} and type. * * Constructor is package private. You need to use {@link StreamPlan#execute()} to get the instance. * * @param planId Stream plan ID * @param description Stream description */ private StreamResultFuture(UUID planId, String description, StreamCoordinator coordinator) { this.planId = planId; this.description = description; this.coordinator = coordinator; // if there is no session to listen to, we immediately set result for returning if (!coordinator.isReceiving() && !coordinator.hasActiveSessions()) set(getCurrentState()); }
private synchronized void maybeComplete() { if (!coordinator.hasActiveSessions()) { StreamState finalState = getCurrentState(); if (finalState.hasFailedSession()) { logger.warn("[Stream #{}] Stream failed", planId); setException(new StreamException(finalState, "Stream failed")); } else { logger.info("[Stream #{}] All sessions completed", planId); set(finalState); } } } }
/** * Create new StreamResult of given {@code planId} and type. * * Constructor is package private. You need to use {@link StreamPlan#execute()} to get the instance. * * @param planId Stream plan ID * @param description Stream description */ private StreamResultFuture(UUID planId, String description, StreamCoordinator coordinator) { this.planId = planId; this.description = description; this.coordinator = coordinator; // if there is no session to listen to, we immediately set result for returning if (!coordinator.isReceiving() && !coordinator.hasActiveSessions()) set(getCurrentState()); }