本文整理汇总了Java中backtype.storm.generated.DRPCRequest类的典型用法代码示例。如果您正苦于以下问题:Java DRPCRequest类的具体用法?Java DRPCRequest怎么用?Java DRPCRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DRPCRequest类属于backtype.storm.generated包,在下文中一共展示了DRPCRequest类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: run
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public void run() {
for (Entry<String, Integer> e : drpcService.getIdToStart().entrySet()) {
if (TimeUtils.time_delta(e.getValue()) > REQUEST_TIMEOUT_SECS) {
String id = e.getKey();
LOG.warn("DRPC request timed out, id: {} start at {}", id, e.getValue());
ConcurrentLinkedQueue<DRPCRequest> queue = drpcService.acquireQueue(drpcService.getIdToFunction().get(id));
queue.remove(drpcService.getIdToRequest().get(id)); //remove timeout request
Semaphore s = drpcService.getIdToSem().get(id);
if (s != null) {
s.release();
}
drpcService.cleanup(id);
LOG.info("Clear request " + id);
}
}
JStormUtils.sleepMs(10);
}
开发者ID:alibaba,项目名称:jstorm,代码行数:20,代码来源:ClearThread.java
示例2: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public DRPCRequest fetchRequest(String functionName) throws TException {
ConcurrentLinkedQueue<DRPCRequest> queue = acquireQueue(functionName);
DRPCRequest req = queue.poll();
if (req != null) {
LOG.info("Fetched request for " + functionName + " at "
+ (System.currentTimeMillis()));
return req;
}else {
return new DRPCRequest("", "");
}
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:16,代码来源:Drpc.java
示例3: acquireQueue
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
private ConcurrentLinkedQueue<DRPCRequest> acquireQueue(String function) {
ConcurrentLinkedQueue<DRPCRequest> reqQueue = requestQueues.get(function);
if (reqQueue == null) {
reqQueue = new ConcurrentLinkedQueue<DRPCRequest>();
requestQueues.put(function, reqQueue);
}
return reqQueue;
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:9,代码来源:Drpc.java
示例4: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public DRPCRequest fetchRequest(String func) throws TException {
try {
if (client == null)
connect();
return client.fetchRequest(func);
} catch (TException e) {
client = null;
throw e;
}
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:12,代码来源:DRPCInvocationsClient.java
示例5: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
public DRPCRequest fetchRequest(String func) throws TException {
try {
if (client == null)
connect();
return client.fetchRequest(func);
} catch (TException e) {
client = null;
throw e;
}
}
开发者ID:songtk,项目名称:learn_jstorm,代码行数:11,代码来源:DRPCInvocationsClient.java
示例6: execute
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public String execute(String function, String args) throws DRPCExecutionException, TException {
LOG.info("Received DRPC request for " + function + " " + args + " at " + (System.currentTimeMillis()));
int idinc = this.ctr.incrementAndGet();
int maxvalue = 1000000000;
int newid = idinc % maxvalue;
if (idinc != newid) {
this.ctr.compareAndSet(idinc, newid);
}
String strid = String.valueOf(newid);
Semaphore sem = new Semaphore(0);
DRPCRequest req = new DRPCRequest(args, strid);
this.idtoStart.put(strid, TimeUtils.current_time_secs());
this.idtoSem.put(strid, sem);
ConcurrentLinkedQueue<DRPCRequest> queue = acquireQueue(function);
queue.add(req);
LOG.info("Waiting for DRPC request for " + function + " " + args + " at " + (System.currentTimeMillis()));
try {
sem.acquire();
} catch (InterruptedException e) {
LOG.error("acquire fail ", e);
}
LOG.info("Acquired for DRPC request for " + function + " " + args + " at " + (System.currentTimeMillis()));
Object result = this.idtoResult.get(strid);
LOG.info("Returning for DRPC request for " + function + " " + args + " at " + (System.currentTimeMillis()));
this.cleanup(strid);
if (result instanceof DRPCExecutionException) {
throw (DRPCExecutionException) result;
}
return String.valueOf(result);
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:37,代码来源:Drpc.java
示例7: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public DRPCRequest fetchRequest(String functionName) throws TException {
ConcurrentLinkedQueue<DRPCRequest> queue = acquireQueue(functionName);
DRPCRequest req = queue.poll();
if (req != null) {
LOG.info("Fetched request for " + functionName + " at " + (System.currentTimeMillis()));
return req;
} else {
return new DRPCRequest("", "");
}
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:14,代码来源:Drpc.java
示例8: acquireQueue
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
private ConcurrentLinkedQueue<DRPCRequest> acquireQueue(String function) {
ConcurrentLinkedQueue<DRPCRequest> reqQueue = requestQueues.get(function);
if (reqQueue == null) {
reqQueue = new ConcurrentLinkedQueue<DRPCRequest>();
requestQueues.put(function, reqQueue);
}
return reqQueue;
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:9,代码来源:Drpc.java
示例9: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
public DRPCRequest fetchRequest(String func) throws TException, AuthorizationException {
DistributedRPCInvocations.Client c = client.get();
try {
if (c == null) {
throw new TException("Client is not connected...");
}
return c.fetchRequest(func);
} catch (AuthorizationException aze) {
throw aze;
} catch (TException e) {
client.compareAndSet(c, null);
throw e;
}
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:15,代码来源:DRPCInvocationsClient.java
示例10: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
public DRPCRequest fetchRequest(String func) throws TException {
try {
if(client==null) connect();
return client.fetchRequest(func);
} catch(TException e) {
client = null;
throw e;
}
}
开发者ID:metamx,项目名称:incubator-storm,代码行数:10,代码来源:DRPCInvocationsClient.java
示例11: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public DRPCRequest fetchRequest(String functionName) throws TException {
ConcurrentLinkedQueue<DRPCRequest> queue = acquireQueue(functionName);
DRPCRequest req = queue.poll();
if (req != null) {
LOG.info("Fetched request for " + functionName + " at " + (System.currentTimeMillis()));
return req;
} else {
return new DRPCRequest("", "");
}
}
开发者ID:alibaba,项目名称:jstorm,代码行数:12,代码来源:Drpc.java
示例12: acquireQueue
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
protected ConcurrentLinkedQueue<DRPCRequest> acquireQueue(String function) {
ConcurrentLinkedQueue<DRPCRequest> reqQueue = requestQueues.get(function);
if (reqQueue == null) {
reqQueue = new ConcurrentLinkedQueue<>();
ConcurrentLinkedQueue<DRPCRequest> tmp = requestQueues.putIfAbsent(function, reqQueue);
if (tmp != null) {
reqQueue = tmp;
}
}
return reqQueue;
}
开发者ID:alibaba,项目名称:jstorm,代码行数:12,代码来源:Drpc.java
示例13: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
public DRPCRequest fetchRequest(String func) throws TException {
DistributedRPCInvocations.Client c = client.get();
try {
if (c == null) {
throw new TException("Client is not connected...");
}
return c.fetchRequest(func);
} catch (AuthorizationException aze) {
throw aze;
} catch (TException e) {
client.compareAndSet(c, null);
throw e;
}
}
开发者ID:alibaba,项目名称:jstorm,代码行数:15,代码来源:DRPCInvocationsClient.java
示例14: execute
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public String execute(String function, String args)
throws DRPCExecutionException, TException {
LOG.info("Received DRPC request for " + function + " " + args + " at "
+ (System.currentTimeMillis()));
int idinc = this.ctr.incrementAndGet();
int maxvalue = 1000000000;
int newid = idinc % maxvalue;
if (idinc != newid) {
this.ctr.compareAndSet(idinc, newid);
}
String strid = String.valueOf(newid);
Semaphore sem = new Semaphore(0);
DRPCRequest req = new DRPCRequest(args, strid);
this.idtoStart.put(strid, TimeUtils.current_time_secs());
this.idtoSem.put(strid, sem);
ConcurrentLinkedQueue<DRPCRequest> queue = acquireQueue(function);
queue.add(req);
LOG.info("Waiting for DRPC request for " + function + " " + args
+ " at " + (System.currentTimeMillis()));
try {
sem.acquire();
} catch (InterruptedException e) {
LOG.error("acquire fail ", e);
}
LOG.info("Acquired for DRPC request for " + function + " " + args
+ " at " + (System.currentTimeMillis()));
Object result = this.idtoResult.get(strid);
LOG.info("Returning for DRPC request for " + function + " " + args
+ " at " + (System.currentTimeMillis()));
this.cleanup(strid);
if (result instanceof DRPCExecutionException) {
throw (DRPCExecutionException) result;
}
return String.valueOf(result);
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:42,代码来源:Drpc.java
示例15: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public DRPCRequest fetchRequest(String functionName) throws TException {
return handler.fetchRequest(functionName);
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:6,代码来源:LocalDRPC.java
示例16: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public DRPCRequest fetchRequest(String functionName) throws TException {
// TODO Auto-generated method stub
return handler.fetchRequest(functionName);
}
开发者ID:songtk,项目名称:learn_jstorm,代码行数:6,代码来源:LocalDRPC.java
示例17: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public DRPCRequest fetchRequest(String functionName) throws TException {
// TODO Auto-generated method stub
return handler.fetchRequest(functionName);
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:6,代码来源:LocalDRPC.java
示例18: getIdToRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
public ConcurrentHashMap<String, DRPCRequest> getIdToRequest() {
return idToRequest;
}
开发者ID:alibaba,项目名称:jstorm,代码行数:4,代码来源:Drpc.java
示例19: fetchRequest
import backtype.storm.generated.DRPCRequest; //导入依赖的package包/类
@Override
public DRPCRequest fetchRequest(String functionName) throws TException {
return handler.fetchRequest(functionName);
}
开发者ID:alibaba,项目名称:jstorm,代码行数:5,代码来源:LocalDRPC.java
注:本文中的backtype.storm.generated.DRPCRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论