001/*
002 * JPPF.
003 * Copyright (C) 2005-2016 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 autotuned, Monte Carlo-based, load-balancing algorithm.
027 * @author Laurent Cohen
028 */
029public class AutoTunedBundlerProvider implements JPPFBundlerProvider<AnnealingTuneProfile> {
030  /**
031   * Create a bundler instance using the specified parameters profile.
032   * @param profile an <code>AutoTuneProfile</code> instance.
033   * @return an instance of the bundler implementation defined by this provider.
034   */
035  @Override
036  public Bundler createBundler(final AnnealingTuneProfile profile) {
037    return new AutoTunedBundler(profile);
038    //return new AutotunedDelegatingBundler(profile);
039  }
040
041  /**
042   * Create a bundler profile containing the parameters of the algorithm.
043   * @param configuration a set of properties defining the algorithm's parameters.
044   * @return an {@link org.jppf.load.balancer.impl.AnnealingTuneProfile AnnealingTuneProfile} instance.
045   */
046  @Override
047  public AnnealingTuneProfile createProfile(final TypedProperties configuration) {
048    return new AnnealingTuneProfile(configuration);
049  }
050
051  /**
052   * Get the name of the algorithm defined by this provider.
053   * @return the algorithm's name as a string.
054   */
055  @Override
056  public String getAlgorithmName() {
057    return "autotuned";
058  }
059}