Examples of DRPCRequest


Examples of backtype.storm.generated.DRPCRequest

        }
       
        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=this.acquire_queue(this.requestQueues, function);
        queue.add(req);
        LOG.debug("Waiting for DRPC request for " +function+ " " +args+ " at " +(System.currentTimeMillis()));
View Full Code Here

Examples of backtype.storm.generated.DRPCRequest

    @Override
    public DRPCRequest fetchRequest(String functionName) throws TException {

        ConcurrentLinkedQueue<DRPCRequest> queue=this.acquire_queue(this.requestQueues, functionName);
        DRPCRequest req=queue.poll();
        if(req!=null)
        {
            LOG.debug("Fetched request for " +functionName+ " at " +(System.currentTimeMillis()));
            return req;
        }
        return new DRPCRequest("", "");
    }
View Full Code Here

Examples of backtype.storm.generated.DRPCRequest

        boolean gotRequest = false;
        if(_local_drpc_id==null) {
            for(int i=0; i<_clients.size(); i++) {
                DRPCInvocationsClient client = _clients.get(i);
                try {
                    DRPCRequest req = client.fetchRequest(_function);
                    if(req.get_request_id().length() > 0) {
                        Map returnInfo = new HashMap();
                        returnInfo.put("id", req.get_request_id());
                        returnInfo.put("host", client.getHost());
                        returnInfo.put("port", client.getPort());
                        gotRequest = true;
                        _collector.emit(new Values(req.get_func_args(), JSONValue.toJSONString(returnInfo)), new DRPCMessageId(req.get_request_id(), i));
                        break;
                    }
                } catch (TException e) {
                    LOG.error("Failed to fetch DRPC result from DRPC server", e);
                }
            }
        } else {
            DistributedRPCInvocations.Iface drpc = (DistributedRPCInvocations.Iface) ServiceRegistry.getService(_local_drpc_id);
            try {
                DRPCRequest req = drpc.fetchRequest(_function);
                if(req.get_request_id().length() > 0) {
                    Map returnInfo = new HashMap();
                    returnInfo.put("id", req.get_request_id());
                    returnInfo.put("host", _local_drpc_id);
                    returnInfo.put("port", 0);
                    gotRequest = true;
                    _collector.emit(new Values(req.get_func_args(), JSONValue.toJSONString(returnInfo)), new DRPCMessageId(req.get_request_id(), 0));
                }
            } catch (TException e) {
                throw new RuntimeException(e);
            }
        }
View Full Code Here

Examples of backtype.storm.generated.DRPCRequest

        boolean gotRequest = false;
        if(_local_drpc_id==null) {
            for(int i=0; i<_clients.size(); i++) {
                DRPCInvocationsClient client = _clients.get(i);
                try {
                    DRPCRequest req = client.fetchRequest(_function);
                    if(req.get_request_id().length() > 0) {
                        Map returnInfo = new HashMap();
                        returnInfo.put("id", req.get_request_id());
                        returnInfo.put("host", client.getHost());
                        returnInfo.put("port", client.getPort());
                        gotRequest = true;
                        _collector.emit(new Values(req.get_func_args(), JSONValue.toJSONString(returnInfo)), new DRPCMessageId(req.get_request_id(), i));
                        break;
                    }
                } catch (Exception e) {
                    LOG.error("Failed to fetch DRPC result from DRPC server", e);
                }
            }
        } else {
            DistributedRPCInvocations.Iface drpc = (DistributedRPCInvocations.Iface) ServiceRegistry.getService(_local_drpc_id);
            if(drpc!=null) { // can happen during shutdown of drpc while topology is still up
                try {
                    DRPCRequest req = drpc.fetchRequest(_function);
                    if(req.get_request_id().length() > 0) {
                        Map returnInfo = new HashMap();
                        returnInfo.put("id", req.get_request_id());
                        returnInfo.put("host", _local_drpc_id);
                        returnInfo.put("port", 0);
                        gotRequest = true;
                        _collector.emit(new Values(req.get_func_args(), JSONValue.toJSONString(returnInfo)), new DRPCMessageId(req.get_request_id(), 0));
                    }
                } catch (TException e) {
                    throw new RuntimeException(e);
                }
            }
View Full Code Here

Examples of backtype.storm.generated.DRPCRequest

        boolean gotRequest = false;
        if(_local_drpc_id==null) {
            for(int i=0; i<_clients.size(); i++) {
                DRPCInvocationsClient client = _clients.get(i);
                try {
                    DRPCRequest req = client.fetchRequest(_function);
                    if(req.get_request_id().length() > 0) {
                        Map returnInfo = new HashMap();
                        returnInfo.put("id", req.get_request_id());
                        returnInfo.put("host", client.getHost());
                        returnInfo.put("port", client.getPort());
                        gotRequest = true;
                        _collector.emit(new Values(req.get_func_args(), JSONValue.toJSONString(returnInfo)), new DRPCMessageId(req.get_request_id(), i));
                        break;
                    }
                } catch (TException e) {
                    LOG.error("Failed to fetch DRPC result from DRPC server", e);
                }
            }
        } else {
            DistributedRPCInvocations.Iface drpc = (DistributedRPCInvocations.Iface) ServiceRegistry.getService(_local_drpc_id);
            if(drpc!=null) { // can happen during shutdown of drpc while topology is still up
                try {
                    DRPCRequest req = drpc.fetchRequest(_function);
                    if(req.get_request_id().length() > 0) {
                        Map returnInfo = new HashMap();
                        returnInfo.put("id", req.get_request_id());
                        returnInfo.put("host", _local_drpc_id);
                        returnInfo.put("port", 0);
                        gotRequest = true;
                        _collector.emit(new Values(req.get_func_args(), JSONValue.toJSONString(returnInfo)), new DRPCMessageId(req.get_request_id(), 0));
                    }
                } catch (TException e) {
                    throw new RuntimeException(e);
                }
            }
View Full Code Here

Examples of backtype.storm.generated.DRPCRequest

    boolean gotRequest = false;
    if (_local_drpc_id == null) {
      for (int i = 0; i < _clients.size(); i++) {
        DRPCInvocationsClient client = _clients.get(i);
        try {
          DRPCRequest req = client.fetchRequest(_function);
          if (req.get_request_id().length() > 0) {
            Map returnInfo = new HashMap();
            returnInfo.put("id", req.get_request_id());
            returnInfo.put("host", client.getHost());
            returnInfo.put("port", client.getPort());
            gotRequest = true;
            _collector.emit(new Values(req.get_func_args(),
                Utils.to_json(returnInfo)),
                new DRPCMessageId(req.get_request_id(), i));
            break;
          }
        } catch (TException e) {
          LOG.error("Failed to fetch DRPC result from DRPC server", e);
        }
      }
    } else {
      DistributedRPCInvocations.Iface drpc = (DistributedRPCInvocations.Iface) ServiceRegistry
          .getService(_local_drpc_id);
      if (drpc != null) { // can happen during shutdown of drpc while
                // topology is still up
        try {
          DRPCRequest req = drpc.fetchRequest(_function);
          if (req.get_request_id().length() > 0) {
            Map returnInfo = new HashMap();
            returnInfo.put("id", req.get_request_id());
            returnInfo.put("host", _local_drpc_id);
            returnInfo.put("port", 0);
            gotRequest = true;
            _collector.emit(new Values(req.get_func_args(),
                Utils.to_json(returnInfo)),
                new DRPCMessageId(req.get_request_id(), 0));
          }
        } catch (TException e) {
          throw new RuntimeException(e);
        }
      }
View Full Code Here

Examples of backtype.storm.generated.DRPCRequest

    }

    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
View Full Code Here

Examples of backtype.storm.generated.DRPCRequest

  @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("", "");
    }
   
   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.