All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.linkedin.parseq.batching.BatchingSupport Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
package com.linkedin.parseq.batching;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

import com.linkedin.parseq.EngineBuilder;
import com.linkedin.parseq.internal.PlanContext;
import com.linkedin.parseq.internal.PlanDeactivationListener;

/**
 * This class allows registering instances of {@link BatchingStrategy}.
 * 

* Please note that BatchingSupport must be registered with an {@link EngineBuilder} e.g. *

 *  BatchingSupport batchingSupport = new BatchingSupport();
 *  engineBuilder.setPlanDeactivationListener(batchingSupport);
 *  (...)
 *  batchingSupport.registerStrategy(batchingStrategy);
 * 
* * @author Jaroslaw Odzga ([email protected]) */ public class BatchingSupport implements PlanDeactivationListener { private final List> _strategies = new CopyOnWriteArrayList<>(); /** * Register an instance of {@link BatchingStrategy}. * @param strategy strategy to be registered */ public void registerStrategy(BatchingStrategy strategy) { _strategies.add(strategy); } @Override public void onPlanDeactivated(final PlanContext planContext) { _strategies.forEach(strategy -> strategy.handleBatch(planContext)); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy