当前位置: 首页>>代码示例>>Java>>正文


Java RPCCall类代码示例

本文整理汇总了Java中water.RPC.RPCCall的典型用法代码示例。如果您正苦于以下问题:Java RPCCall类的具体用法?Java RPCCall怎么用?Java RPCCall使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RPCCall类属于water.RPC包,在下文中一共展示了RPCCall类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: record_task

import water.RPC.RPCCall; //导入依赖的package包/类
RPC.RPCCall record_task( RPC.RPCCall rpc ) {
  // Task removal (and roll-up) suffers from classic race-condition, which we
  // fix by a classic Dekker's algo; a task# is always in either the _work
  // HashMap, or rolled-up in the _removed_task_ids counter, or both (for
  // short intervals during the handoff).  We can never has a cycle where
  // it's in neither or else a late UDP may attempt to "resurrect" the
  // already completed task.  Hence we must always check the "removed ids"
  // AFTER we insert in the HashMap (we can check before also, but that's a
  // simple optimization and not sufficient for correctness).
  final RPC.RPCCall x = _work.putIfAbsent(rpc._tsknum,rpc);
  if( x != null ) return x;   // Return pre-existing work
  // If this RPC task# is very old, we just return a Golden Completed task.
  // The task is not just completed, but also we have already received
  // verification that the client got the answer.  So this is just a really
  // old attempt to restart a long-completed task.
  if( rpc._tsknum > _removed_task_ids.get() ) return null; // Task is new
  _work.remove(rpc._tsknum); // Bogus insert, need to remove it
  return _removed_task;      // And return a generic Golden Completed object
}
 
开发者ID:kyoren,项目名称:https-github.com-h2oai-h2o-3,代码行数:20,代码来源:H2ONode.java

示例2: currentTasksInfo

import water.RPC.RPCCall; //导入依赖的package包/类
public TaskInfo [] currentTasksInfo() {
  Set<Entry<Long,RPCCall>> s = _work.entrySet();
  TaskInfo [] res = new TaskInfo[s.size()];
  int i = 0;
  for(Entry<Long,RPCCall> e:s){
    RPCCall rpc = e.getValue();
    if(rpc._dt instanceof GetTaskInfo)
      continue;
    if(i < res.length) {
      DTask dt = rpc._dt;
      if(dt != null) // else we got ackack -> not interested!
        res[i++] = new TaskInfo(rpc._dt, e.getKey(), _unique_idx, rpc._computedAndReplied ? (dt._repliedTcp ? task_status.RTCP : task_status.RUDP) : rpc._computed ? task_status.DONE : rpc._cmpStarted > 0 ? task_status.CMP : task_status.INIT,(rpc._callCnt+rpc._ackResendCnt));
    }
  }
  return Arrays.copyOf(res,i);
}
 
开发者ID:h2oai,项目名称:h2o-2,代码行数:17,代码来源:H2ONode.java

示例3: run

import water.RPC.RPCCall; //导入依赖的package包/类
@Override public void run() {
  Thread.currentThread().setPriority(Thread.MAX_PRIORITY-1);
  while( true ) {
    RPC.RPCCall r;
    long currenTime = System.currentTimeMillis();
    for(H2ONode h2o:H2O.CLOUD._memary) {
      if(h2o != H2O.SELF) {
        for(RPCCall rpc:h2o._work.values()) {
          if((rpc._started + rpc._retry) < currenTime) {
            // RPC from somebody who dropped out of cloud?
            if( (!H2O.CLOUD.contains(rpc._client) && !rpc._client._heartbeat._client) ||
              // Timedout client?
              (rpc._client._heartbeat._client && rpc._retry >= HeartBeatThread.CLIENT_TIMEOUT) ) {
              rpc._client.remove_task_tracking(rpc._tsknum);
            } else  {
              if (rpc._computed) {
                if (rpc._computedAndReplied) {
                  DTask dt = rpc._dt;
                  if(dt != null) {
                    if (++rpc._ackResendCnt % 5 == 0)
                      Log.warn("Got " + rpc._ackResendCnt + " resends on ack for task # " + rpc._tsknum + ", class = " + dt.getClass().getSimpleName());
                    rpc.resend_ack();
                  }
                }
              } else if(rpc._nackResendCnt == 0) { // else send nack
                ++rpc._nackResendCnt;
                rpc.send_nack();
              }
            }
          }
        }
      }
    }
    long timeElapsed = System.currentTimeMillis()-currenTime;
    if(timeElapsed < 1000)
      try {Thread.sleep(1000-timeElapsed);} catch (InterruptedException e) {}
  }
}
 
开发者ID:kyoren,项目名称:https-github.com-h2oai-h2o-3,代码行数:39,代码来源:H2ONode.java

示例4: run

import water.RPC.RPCCall; //导入依赖的package包/类
@Override public void run() {
  Thread.currentThread().setPriority(Thread.MAX_PRIORITY-1);
  while( true ) {
    long currenTime = System.currentTimeMillis();
    for(H2ONode h2o:H2O.CLOUD._memary) {
      if(h2o != H2O.SELF) {
        for(RPCCall rpc:h2o._work.values()) {
          if((rpc._started + rpc._retry) < currenTime) {
            // RPC from somebody who dropped out of cloud?
            if( (!H2O.CLOUD.contains(rpc._client) && !rpc._client._heartbeat._client) ||
              // Timedout client?
              (rpc._client._heartbeat._client && rpc._retry >= HeartBeatThread.CLIENT_TIMEOUT) ) {
              rpc._client.remove_task_tracking(rpc._tsknum);
            } else  {
              if (rpc._computed) {
                if (rpc._computedAndReplied) {
                  DTask dt = rpc._dt;
                  if(dt != null) {
                    if (++rpc._ackResendCnt % 5 == 0)
                      Log.warn("Got " + rpc._ackResendCnt + " resends on ack for task # " + rpc._tsknum + ", class = " + dt.getClass().getSimpleName());
                    rpc.resend_ack();
                  }
                }
              } else if(rpc._nackResendCnt == 0) { // else send nack
                ++rpc._nackResendCnt;
                rpc.send_nack();
              }
            }
          }
        }
      }
    }
    long timeElapsed = System.currentTimeMillis()-currenTime;
    if(timeElapsed < 1000)
      try {Thread.sleep(1000-timeElapsed);} catch (InterruptedException e) {/*comment to stop ideaj warning*/}
  }
}
 
开发者ID:h2oai,项目名称:h2o-3,代码行数:38,代码来源:H2ONode.java

示例5: has_task

import water.RPC.RPCCall; //导入依赖的package包/类
RPC.RPCCall has_task( int tnum ) {
  if( tnum <= _removed_task_ids.get() ) return _removed_task;
  return _work.get(tnum);
}
 
开发者ID:kyoren,项目名称:https-github.com-h2oai-h2o-3,代码行数:5,代码来源:H2ONode.java

示例6: record_task_answer

import water.RPC.RPCCall; //导入依赖的package包/类
void record_task_answer( RPC.RPCCall rpcall ) {
//    assert rpcall._started == 0 || rpcall._dt.hasException();
    rpcall._started = System.currentTimeMillis();
    rpcall._retry = RPC.RETRY_MS; // Start the timer on when to resend
//    AckAckTimeOutThread.PENDING.add(rpcall);
  }
 
开发者ID:kyoren,项目名称:https-github.com-h2oai-h2o-3,代码行数:7,代码来源:H2ONode.java

示例7: record_task_answer

import water.RPC.RPCCall; //导入依赖的package包/类
void record_task_answer( RPC.RPCCall rpcall ) {
  assert rpcall._started == 0 || rpcall._dt.hasException();
  rpcall._started = System.currentTimeMillis();
  rpcall._retry = RPC.RETRY_MS; // Start the timer on when to resend
  AckAckTimeOutThread.PENDING.add(rpcall);
}
 
开发者ID:h2oai,项目名称:h2o-2,代码行数:7,代码来源:H2ONode.java


注:本文中的water.RPC.RPCCall类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。