本文整理汇总了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
}
示例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);
}
示例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) {}
}
}
示例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*/}
}
}
示例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);
}
示例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);
}
示例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);
}