Tabnine Logo
LoadBalance
Code IndexAdd Tabnine to your IDE (free)

How to use
LoadBalance
in
me.hao0.antares.common.balance

Best Java code snippets using me.hao0.antares.common.balance.LoadBalance (Showing top 3 results out of 315)

origin: ihaolin/antares

private Boolean selectServer() {
  List<String> servers = client.getHttpServers();
  if (servers.isEmpty()){
    log.warn("There are no available server, please check the environment.");
    return Boolean.FALSE;
  }
  currentServer = balancer.balance(servers);
  return Boolean.TRUE;
}
origin: ihaolin/antares

/**
 * Schedule the job to one of the servers
 * @param jobId the job id
 * @param servers the alive servers
 */
public Response<Boolean> scheduleJob(Long jobId, List<String> servers){
  try {
    String targetServer = balancer.balance(servers);
    return Response.ok(doScheduleJob(jobId, targetServer));
  } catch (Exception e) {
    Logs.error("failed to schedule job(jobId={}, servers={})", jobId, servers);
    return Response.notOk("job.schedule.failed");
  }
}
origin: ihaolin/antares

@Override
public Response<Boolean> scheduleJob(Long jobId) {
  try {
    // get current server list
    Response<List<String>> listResp = clusterService.listSimpleServers();
    if (!listResp.isSuccess()){
      return Response.notOk(listResp.getErr());
    }
    List<String> servers = listResp.getData();
    if (CollectionUtil.isNullOrEmpty(servers)){
      // no available server, don't need schedule
      Logs.warn("There are no available servers when schedule job(id={}).", jobId);
      return Response.notOk("server.no.available");
    }
    String targetServer = balancer.balance(servers);
    return Response.ok(doScheduleJob(jobId, targetServer));
  } catch (Exception e) {
    Logs.error("failed to schedule job(jobId={})", jobId);
    return Response.notOk("job.schedule.failed");
  }
}
me.hao0.antares.common.balanceLoadBalance

Javadoc

Author: haolin Email: haolin.h0@gmail.com

Most used methods

  • balance
    Balance a resource

Popular in Java

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now