The replication is an asynchronous process by default. But you can force it to be synchronous by providing a proper ReplicationOption. ReplicationOptions opts = new ReplicationOptions();
opts.setSynchronous(true);
replicator.replicate(session, ReplicationActionType.DEACTIVATE, pagePath, opts);When ...