private void resync(final ShardId shardId, final String primaryAllocationId, final long primaryTerm, final Translog.Snapshot snapshot, long startingSeqNo, long maxSeqNo, long maxSeenAutoIdTimestamp, ActionListener<ResyncTask> listener) { ResyncRequest request = new ResyncRequest(shardId, primaryAllocationId); ResyncTask resyncTask = (ResyncTask) taskManager.register("transport", "resync", request); // it's not transport :-) ActionListener<Void> wrappedListener = new ActionListener<Void>() { @Override public void onResponse(Void ignore) { resyncTask.setPhase("finished"); taskManager.unregister(resyncTask); listener.onResponse(resyncTask); } @Override public void onFailure(Exception e) { resyncTask.setPhase("finished"); taskManager.unregister(resyncTask); listener.onFailure(e); } }; try { new SnapshotSender(logger, syncAction, resyncTask, shardId, primaryAllocationId, primaryTerm, snapshot, chunkSize.bytesAsInt(), startingSeqNo, maxSeqNo, maxSeenAutoIdTimestamp, wrappedListener).run(); } catch (Exception e) { wrappedListener.onFailure(e); } }
private void resync(final ShardId shardId, final String primaryAllocationId, final long primaryTerm, final Translog.Snapshot snapshot, long startingSeqNo, long maxSeqNo, ActionListener<ResyncTask> listener) { ResyncRequest request = new ResyncRequest(shardId, primaryAllocationId); ResyncTask resyncTask = (ResyncTask) taskManager.register("transport", "resync", request); // it's not transport :-) ActionListener<Void> wrappedListener = new ActionListener<Void>() { @Override public void onResponse(Void ignore) { resyncTask.setPhase("finished"); taskManager.unregister(resyncTask); listener.onResponse(resyncTask); } @Override public void onFailure(Exception e) { resyncTask.setPhase("finished"); taskManager.unregister(resyncTask); listener.onFailure(e); } }; try { new SnapshotSender(logger, syncAction, resyncTask, shardId, primaryAllocationId, primaryTerm, snapshot, chunkSize.bytesAsInt(), startingSeqNo, maxSeqNo, wrappedListener).run(); } catch (Exception e) { wrappedListener.onFailure(e); } }
private void resync(final ShardId shardId, final String primaryAllocationId, final long primaryTerm, final Translog.Snapshot snapshot, long startingSeqNo, long maxSeqNo, long maxSeenAutoIdTimestamp, ActionListener<ResyncTask> listener) { ResyncRequest request = new ResyncRequest(shardId, primaryAllocationId); ResyncTask resyncTask = (ResyncTask) taskManager.register("transport", "resync", request); // it's not transport :-) ActionListener<Void> wrappedListener = new ActionListener<Void>() { @Override public void onResponse(Void ignore) { resyncTask.setPhase("finished"); taskManager.unregister(resyncTask); listener.onResponse(resyncTask); } @Override public void onFailure(Exception e) { resyncTask.setPhase("finished"); taskManager.unregister(resyncTask); listener.onFailure(e); } }; try { new SnapshotSender(logger, syncAction, resyncTask, shardId, primaryAllocationId, primaryTerm, snapshot, chunkSize.bytesAsInt(), startingSeqNo, maxSeqNo, maxSeenAutoIdTimestamp, wrappedListener).run(); } catch (Exception e) { wrappedListener.onFailure(e); } }