io.ray.api.concurrencygroup.ConcurrencyGroupBuilder Maven / Gradle / Ivy
package io.ray.api.concurrencygroup;
import io.ray.api.Ray;
import io.ray.api.function.RayFunc;
import java.util.ArrayList;
import java.util.List;
public class ConcurrencyGroupBuilder extends BaseConcurrencyGroupBuilder {
private String name;
private int maxConcurrency;
private List funcs = new ArrayList<>();
public ConcurrencyGroupBuilder setName(String name) {
this.name = name;
return this;
}
public ConcurrencyGroupBuilder setMaxConcurrency(int maxConcurrency) {
this.maxConcurrency = maxConcurrency;
return this;
}
public ConcurrencyGroup build() {
return Ray.internal().createConcurrencyGroup(this.name, this.maxConcurrency, funcs);
}
@Override
protected ConcurrencyGroupBuilder internalAddMethod(RayFunc func) {
funcs.add(func);
return this;
}
}