本文整理了Java中org.apache.hadoop.ipc.Server.getCurCall()
方法的一些代码示例,展示了Server.getCurCall()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getCurCall()
方法的具体详情如下:
包路径:org.apache.hadoop.ipc.Server
类名称:Server
方法名:getCurCall
[英]Get the current call
[中]获取当前通话
代码示例来源:origin: org.apache.hadoop/hadoop-hdfs
private Edit getEditInstance(FSEditLogOp op) {
final Edit edit;
final Server.Call rpcCall = Server.getCurCall().get();
// only rpc calls not explicitly sync'ed on the log will be async.
if (rpcCall != null && !Thread.holdsLock(this)) {
edit = new RpcEdit(this, op, rpcCall);
} else {
edit = new SyncEdit(this, op);
}
return edit;
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
@Override
public Integer call() throws Exception {
Server.getCurCall().set(call);
Assert.assertEquals(Server.getCurCall().get(), call);
int randomPause = pause == 0 ? pause : r.nextInt(pause);
return testServer.echo(input, failureOutput, randomPause, success);
}
};
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@Override
public Integer call() throws Exception {
Server.getCurCall().set(call);
Assert.assertEquals(Server.getCurCall().get(), call);
int randomPause = pause == 0 ? pause : r.nextInt(pause);
return testServer.echo(input, failureOutput, randomPause, success);
}
};
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@Override
public String echoPostponed(String value) {
Call call = Server.getCurCall().get();
call.postponeResponse();
postponedCalls.add(call);
return value;
}
@Override
代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs
/** Set the current Server RPC call */
public static void newCall() {
Server.Call call = new Server.Call(++callId, 1, null, null,
RpcKind.RPC_PROTOCOL_BUFFER, CLIENT_ID);
Server.getCurCall().set(call);
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@Override
public Writable call(RPC.RpcKind rpcKind, String protocol,
Writable waitCount, long receiveTime) throws IOException {
Call call = Server.getCurCall().get();
int wait = ((IntWritable)waitCount).get();
while (wait-- > 0) {
call.postponeResponse();
deferredCall.set(call);
}
return new IntWritable(count.getAndIncrement());
}
};
代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs
public static void resetCall() {
Server.Call call = new Server.Call(RpcConstants.INVALID_CALL_ID, 1, null,
null, RpcKind.RPC_PROTOCOL_BUFFER, RpcConstants.DUMMY_CLIENT_ID);
Server.getCurCall().set(call);
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@Test
public void testRetryAfterFailure() throws Exception {
// Previous operation failed
Server.Call call = newCall();
int input = r.nextInt();
Server.getCurCall().set(call);
testServer.echo(input, input + 1, 5, false);
testOperations(input, 25, 0, false, true, call);
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@Test
public void testRetryAfterSuccess() throws Exception {
// Previous operation successfully completed
Server.Call call = newCall();
int input = r.nextInt();
Server.getCurCall().set(call);
testServer.echo(input, input + 1, 5, true);
testOperations(input, 25, 0, true, true, call);
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
@Test
public void testRetryAfterSuccess() throws Exception {
// Previous operation successfully completed
Server.Call call = newCall();
int input = r.nextInt();
Server.getCurCall().set(call);
testServer.echo(input, input + 1, 5, true);
testOperations(input, 25, 0, true, true, call);
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
@Test
public void testRetryAfterFailure() throws Exception {
// Previous operation failed
Server.Call call = newCall();
int input = r.nextInt();
Server.getCurCall().set(call);
testServer.echo(input, input + 1, 5, false);
testOperations(input, 25, 0, false, true, call);
}
内容来源于网络,如有侵权,请联系作者删除!