Skip to main content
Package com.gpudb

Class WorkerList

All Implemented Interfaces:
Direct Known Subclasses:

public class WorkerList extends ArrayList<URL>
A list of worker URLs to use for multi-head operations.
  • Constructor Details

    • WorkerList

      public WorkerList()
      Creates an empty WorkerList that can be populated manually with worker URLs to support multi-head operations. Note that worker URLs must be added in rank order, starting with rank 1, and all worker ranks must be included; otherwise operations may fail for certain data types.
    • WorkerList

      public WorkerList(List<URL> urls)
      Creates a WorkerList populated with the given URLs.
    • WorkerList

      public WorkerList(GPUdb gpudb) throws GPUdbException
      Creates a WorkerList and automatically populates it with the worker URLs from GPUdb to support multi-head operations. (If the specified GPUdb instance has multi-head operations disabled, the worker list will be empty and multi-head operations will not be used.) Note that in some cases, workers may be configured to use more than one IP address, not all of which may be accessible to the client; this constructor uses the first IP returned by the server for each worker. To override this behavior, use one of the alternate constructors that accepts an IP regex or an IP prefix.
      Parameters:
      gpudb - the GPUdb instance from which to obtain the worker URLs
      Throws:
      GPUdbException - if an error occurs during the request for worker URLs
    • WorkerList

      public WorkerList(GPUdb gpudb, Pattern ipRegex) throws GPUdbException
      Creates a WorkerList and automatically populates it with the worker URLs from GPUdb to support multi-head operations. (If the specified GPUdb instance has multi-head operations disabled, the worker list will be empty and multi-head operations will not be used.) Note that in some cases, workers may be configured to use more than one IP address, not all of which may be accessible to the client; the optional ipRegex parameter can be used in such cases to filter for an IP range that is accessible, e.g., a regex of “192\.168\..*” will use worker IP addresses in the 192.168.* range.
      Parameters:
      gpudb - the GPUdb instance from which to obtain the worker URLs
      ipRegex - optional IP regex to match
      Throws:
      GPUdbException - if an error occurs during the request for worker URLs or no IP addresses matching the IP regex could be found for one or more workers
    • WorkerList

      public WorkerList(GPUdb gpudb, String ipPrefix) throws GPUdbException
      Creates a WorkerList and automatically populates it with the worker URLs from GPUdb to support multi-head operations. (If the specified GPUdb instance has multi-head operations disabled, the worker list will be empty and multi-head operations will not be used.) Note that in some cases, workers may be configured to use more than one IP address, not all of which may be accessible to the client; the optional ipPrefix parameter can be used in such cases to filter for an IP range that is accessible, e.g., a prefix of “192.168.” will use worker IP addresses in the 192.168.* range.
      Parameters:
      gpudb - the GPUdb instance from which to obtain the worker URLs
      ipPrefix - optional IP prefix to match
      Throws:
      GPUdbException - if an error occurs during the request for worker URLs or no IP addresses matching the IP prefix could be found for one or more workers
  • Method Details

    • getIpRegex

      public Pattern getIpRegex()
      Gets the regular expression used to filter this worker list, if one were specified during creation.
      Returns:
      the regular expression used to create this worker list.
    • isMultiHeadEnabled

      public boolean isMultiHeadEnabled()
      Checks whether multi-head I/O is enabled in the server configuration.
      Returns:
      a boolean indicating whether multi-head I/O is enabled on the server.
    • isQueriedUrlList

      public boolean isQueriedUrlList()
      Checks whether this worker list was created by querying the given server for the URLs, or instead, whether they were given explicitly.
      Returns:
      a boolean indicating whether this worker list was created via a server query.