001/*
002 * JPPF.
003 * Copyright (C) 2005-2018 JPPF Team.
004 * http://www.jppf.org
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.jppf.load.balancer.spi;
020
021import org.jppf.load.balancer.Bundler;
022import org.jppf.load.balancer.impl.*;
023import org.jppf.utils.TypedProperties;
024
025/**
026 * Provider implementation for the reinforcement learning load-balancing algorithm.
027 * @author Laurent Cohen
028 */
029public class RL2BundlerProvider implements JPPFBundlerProvider<RL2Profile> {
030  /**
031   * Create a bundler instance using the specified parameters profile.
032   * @param profile encapsulates the parameters of this algorithm.
033   * @return an instance of the bundler implementation defined by this provider.
034   */
035  @Override
036  public Bundler<RL2Profile> createBundler(final RL2Profile profile) {
037    return new RL2Bundler(profile);
038  }
039
040  /**
041   * Create a bundler profile containing the parameters of the algorithm.
042   * @param configuration a set of properties defining the algorithm's parameters.
043   * @return an {@link RL2Profile} instance.
044   */
045  @Override
046  public RL2Profile createProfile(final TypedProperties configuration) {
047    return new RL2Profile(configuration);
048  }
049
050  /**
051   * Get the name of the algorithm defined by this provider.
052   * @return the algorithm's name as a string.
053   */
054  @Override
055  public String getAlgorithmName() {
056    return "rl2";
057  }
058}