Search in sources :

Example 1 with AsyncSnapshotPersistor

use of io.siddhi.core.util.snapshot.AsyncSnapshotPersistor in project siddhi by wso2.

the class PersistenceHelper method persist.

public static PersistenceReference persist(byte[] serializeObj, SiddhiAppContext siddhiAppContext) {
    long revisionTime = System.currentTimeMillis();
    // start the snapshot persisting task asynchronously
    AsyncSnapshotPersistor asyncSnapshotPersistor = new AsyncSnapshotPersistor(serializeObj, siddhiAppContext.getSiddhiContext().getPersistenceStore(), siddhiAppContext.getName(), revisionTime);
    Future future = siddhiAppContext.getExecutorService().submit(asyncSnapshotPersistor);
    return new PersistenceReference(future, asyncSnapshotPersistor.getRevision());
}
Also used : AsyncSnapshotPersistor(io.siddhi.core.util.snapshot.AsyncSnapshotPersistor) Future(java.util.concurrent.Future) PersistenceReference(io.siddhi.core.util.snapshot.PersistenceReference)

Aggregations

AsyncSnapshotPersistor (io.siddhi.core.util.snapshot.AsyncSnapshotPersistor)1 PersistenceReference (io.siddhi.core.util.snapshot.PersistenceReference)1 Future (java.util.concurrent.Future)1