Search in sources :

Example 1 with RoundRobin

use of com.adobe.acs.commons.functions.RoundRobin in project acs-aem-commons by Adobe-Consulting-Services.

the class ReplicationActions method activateAllWithRoundRobin.

/**
 * Activate all nodes using provided options NOTE: If using large batch
 * publishing it is highly recommended to set synchronous to true on the
 * replication options
 *
 * @param options
 * @return
 */
public static final CheckedBiConsumer<ResourceResolver, String> activateAllWithRoundRobin(final Replicator replicator, final ReplicationOptions... options) {
    final List<ReplicationOptions> allTheOptions = Arrays.asList(options);
    final Iterator<ReplicationOptions> roundRobin = new RoundRobin(allTheOptions).iterator();
    return (ResourceResolver r, String path) -> {
        nameThread(PREFIX_ACTIVATE + path);
        replicator.replicate(r.adaptTo(Session.class), ReplicationActionType.ACTIVATE, path, roundRobin.next());
    };
}
Also used : ReplicationOptions(com.day.cq.replication.ReplicationOptions) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) RoundRobin(com.adobe.acs.commons.functions.RoundRobin)

Aggregations

RoundRobin (com.adobe.acs.commons.functions.RoundRobin)1 ReplicationOptions (com.day.cq.replication.ReplicationOptions)1 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)1