Class DefaultResourceAllocationStrategy

  • All Implemented Interfaces:
    ResourceAllocationStrategy

    public class DefaultResourceAllocationStrategy
    extends Object
    implements ResourceAllocationStrategy
    The default implementation of ResourceAllocationStrategy.

    For each requirement, this strategy tries to fulfill it with any registered or pending resources (registered is prioritized). If a requirement cannot be fulfilled by any registered or pending resources, it allocates a new pending resource, with the pre-defined total and default slot resource profiles, thus all new pending resources should have the same profiles. A requirement is considered unfulfillable if it is not fulfilled by any registered or pending resources and cannot fit into the pre-defined total resource profile.

    Note: This strategy tries to find a feasible allocation result, rather than an optimal one (in terms of resource utilization). It also does not guarantee always finding a feasible solution when exists.

    Note: The current implementation of this strategy is non-optimal, in terms of computation efficiency. In the worst case, for each distinctly profiled requirement it checks all registered and pending resources. Further optimization requires complex data structures for ordering multidimensional resource profiles. The complexity is not necessary.