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

io.ray.api.concurrencygroup.ConcurrencyGroupBuilder Maven / Gradle / Ivy

There is a newer version: 2.36.0
Show newest version
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;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy