Tabnine Logo
me.hao0.antares.client.core
Code IndexAdd Tabnine to your IDE (free)

How to use me.hao0.antares.client.core

Best Java code snippets using me.hao0.antares.client.core (Showing top 20 results out of 315)

origin: ihaolin/antares

@Override
public void afterPropertiesSet() throws Exception {
  // start the client
  client.start();
  // register the jobs
  registerJobs();
}
origin: ihaolin/antares

  @Override
  public ShardOperateResp call() throws Exception {
    return client.getHttp().finishJobInstanceShard(shardFinishDto);
  }
}
origin: ihaolin/antares

  @Override
  public ShardPullResp call() throws Exception {
    return client.getHttp().pullJobInstanceShard(jobInstanceId);
  }
}
origin: ihaolin/antares

@Override
public void doStart(){
  // mk app clients path
  zk.mkdirs(ZkPaths.pathOfAppClients(client.getAppName()));
  // register client self
  clientRegister = new ClientRegister(client);
  clientRegister.start();
  // get servers once
  getServersOnce();
  // listen servers
  listenOnServerChanged();
}
origin: ihaolin/antares

/**
 * Shutdown the client
 */
@Override
public void doShutdown(){
  zk.shutdown();
  http.shutdown();
  jobManager.shutdown();
  jobExecutor.shutdown();
  afterShutdown();
  log.info("Antares client shutdown finished.");
}
origin: ihaolin/antares

@Override
public void doStart(){
  zk.start();
  http.start();
  jobExecutor.start();
  jobManager.start();
  afterStart();
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override
    public void run() {
      shutdown();
    }
  });
  log.info("Antares client started successfully.");
}
origin: ihaolin/antares

  @Override
  public ShardOperateResp call() throws Exception {
    return client.getHttp().returnJobInstanceShard(instanceId, shardId);
  }
}
origin: ihaolin/antares

@Override
public void doStart() {
  // select a server
  selectServer();
  // init header
  initHttpHeaders();
}
origin: ihaolin/antares

public SpringAntaresClient(String appName, String appSecret, String zkServers, String zkNamespace){
  client = new SimpleAntaresClient(appName, appSecret, zkServers, zkNamespace);
}
origin: ihaolin/antares

public void setExecutorThreadCount(Integer executorThreadCount) {
  client.setExecutorThreadCount(executorThreadCount);
}
origin: ihaolin/antares

private Map<String, Object> doPostAsMap(String uri, Map<String, String> headers, Map<String, Object> params, int readTimeout){
  return doPostAsMap(currentServer, uri, headers, params, readTimeout);
}
origin: ihaolin/antares

  @Override
  public void destroy() throws Exception {
    client.shutdown();
  }
}
origin: ihaolin/antares

  @Override
  public void run() {
    shutdown();
  }
});
origin: ihaolin/antares

public ZkClient getZk() {
  return zk.client();
}
origin: ihaolin/antares

public AbstractAntaresClient(String appName, String appSecret, String zkServers, String zkNamespace) {
  this.appName = appName;
  this.appSecret = appSecret;
  this.zkServers = zkServers;
  this.zkNamespace = Strings.isNullOrEmpty(zkNamespace) ? ZkPaths.DEFAULT_NS : zkNamespace;
  zk = new AntaresZkAgent(this, zkServers, this.zkNamespace);
}
origin: ihaolin/antares

  @Override
  public void doShutdown(){
    if (zk != null){
      zk.shutdown();
    }
    clientRegister.shutdown();
  }
}
origin: ihaolin/antares

@Override
public void doStart() {
  executor = Executors.newExecutor(client.getExecutorThreadCount(), 10000, "JOB-EXECUTOR-");
}
origin: ihaolin/antares

  @Override
  protected void onDelete(String path) {
    String server = ZkPaths.lastNode(path);
    client.removeHttpServer(server);
    log.info("The server({}) left.", server);
  }
});
origin: ihaolin/antares

  @Override
  protected Boolean finishShard(ShardFinishDto shardFinishDto, ZkJob zkJob) {

    ShardOperateResp finishResp = client.getHttp().finishJobInstanceShard(shardFinishDto);

    if (finishResp.getSuccess()){
      return Boolean.TRUE;
    }

    if (ShardOperateRespCode.needFinishAgain(finishResp.getCode())){
      // TODO need retry to finish again
    }

    return Boolean.TRUE;
  }
}
origin: ihaolin/antares

private <T> T doPost(String server, String uri, Map<String, String> headers, Map<String, Object> params, int readTimeout, Class<T> targetType){
  Map<String, Object> respMap = doPostAsMap(server, uri, headers, params, readTimeout);
  if (respMap == null || respMap.isEmpty()){
    return null;
  }
  return MapUtil.fromMap(respMap, targetType);
}
me.hao0.antares.client.core

Most used classes

  • SimpleAntaresClient
    Author: haolin Email: haolin.h0@gmail.com
  • AbstractAntaresClient
    Author: haolin Email: haolin.h0@gmail.com
  • AntaresClient
    Author: haolin Email: haolin.h0@gmail.com
  • AntaresHttpAgent
    Author: haolin Email: haolin.h0@gmail.com
  • AntaresZkAgent
    Author: haolin Email: haolin.h0@gmail.com
  • SpringAntaresClient
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