Search in sources :

Example 51 with JetException

use of com.hazelcast.jet.JetException in project hazelcast-jet by hazelcast.

the class SnapshotOperation method doRun.

@Override
protected void doRun() throws Exception {
    JetService service = getService();
    ExecutionContext ctx = service.getJobExecutionService().assertExecutionContext(getCallerAddress(), jobId(), executionId, this);
    ctx.beginSnapshot(snapshotId).thenAccept(r -> {
        logFine(getLogger(), "Snapshot %s for job %s finished successfully on member", snapshotId, idToString(jobId()));
        doSendResponse(null);
    }).exceptionally(e -> {
        getLogger().warning(String.format("Snapshot %d for job %s finished with error on member", snapshotId, idToString(jobId())), e);
        doSendResponse(new JetException("Exception during snapshot: " + e, e));
        return null;
    });
}
Also used : JetException(com.hazelcast.jet.JetException) Util.idToString(com.hazelcast.jet.impl.util.Util.idToString) ExecutionContext(com.hazelcast.jet.impl.execution.ExecutionContext) JetService(com.hazelcast.jet.impl.JetService) LoggingUtil.logFine(com.hazelcast.jet.impl.util.LoggingUtil.logFine) ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput) IOException(java.io.IOException) ObjectDataInput(com.hazelcast.nio.ObjectDataInput) JetInitDataSerializerHook(com.hazelcast.jet.impl.execution.init.JetInitDataSerializerHook) JetService(com.hazelcast.jet.impl.JetService) ExecutionContext(com.hazelcast.jet.impl.execution.ExecutionContext) JetException(com.hazelcast.jet.JetException)

Example 52 with JetException

use of com.hazelcast.jet.JetException in project hazelcast-jet by hazelcast.

the class SessionWindowP method restoreFromSnapshot.

@Override
@SuppressWarnings("unchecked")
protected void restoreFromSnapshot(@Nonnull Object key, @Nonnull Object value) {
    if (key instanceof BroadcastKey) {
        BroadcastKey bcastKey = (BroadcastKey) key;
        if (!Keys.CURRENT_WATERMARK.equals(bcastKey.key())) {
            throw new JetException("Unexpected broadcast key: " + bcastKey.key());
        }
        long newCurrentWatermark = (long) value;
        assert processingGuarantee != EXACTLY_ONCE || minRestoredCurrentWatermark == Long.MAX_VALUE || minRestoredCurrentWatermark == newCurrentWatermark : "different values for currentWatermark restored, before=" + minRestoredCurrentWatermark + ", new=" + newCurrentWatermark;
        minRestoredCurrentWatermark = Math.min(newCurrentWatermark, minRestoredCurrentWatermark);
        return;
    }
    keyToWindows.put((K) key, (Windows) value);
}
Also used : BroadcastKey(com.hazelcast.jet.core.BroadcastKey) JetException(com.hazelcast.jet.JetException)

Aggregations

JetException (com.hazelcast.jet.JetException)52 IOException (java.io.IOException)8 Nonnull (javax.annotation.Nonnull)8 ILogger (com.hazelcast.logging.ILogger)7 List (java.util.List)7 Map (java.util.Map)6 Util.idToString (com.hazelcast.jet.Util.idToString)5 JobConfig (com.hazelcast.jet.config.JobConfig)5 CompletableFuture (java.util.concurrent.CompletableFuture)5 BroadcastKey (com.hazelcast.jet.core.BroadcastKey)4 JobStatus (com.hazelcast.jet.core.JobStatus)4 Path (java.nio.file.Path)4 HashMap (java.util.HashMap)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 FunctionEx (com.hazelcast.function.FunctionEx)3 Job (com.hazelcast.jet.Job)3 DAG (com.hazelcast.jet.core.DAG)3 Watermark (com.hazelcast.jet.core.Watermark)3 Tuple2 (com.hazelcast.jet.datamodel.Tuple2)3 Pipeline (com.hazelcast.jet.pipeline.Pipeline)3