Package backtype.storm.tuple

Examples of backtype.storm.tuple.Tuple


        Map<Tuple, Long> timeoutMap = tuple_start_times.rotate();

        if (ackerNum > 0) {
          // only when acker is enable
          for (Entry<Tuple, Long> entry : timeoutMap.entrySet()) {
            Tuple input = entry.getKey();
            task_stats.bolt_failed_tuple(
                input.getSourceComponent(),
                input.getSourceStreamId());
          }
        }

        return;
      }

      Tuple tuple = (Tuple) event;

      task_stats.recv_tuple(tuple.getSourceComponent(),
          tuple.getSourceStreamId());

      tuple_start_times.put(tuple, System.currentTimeMillis());

      try {
        bolt.execute(tuple);
      } catch (Throwable e) {
        error = e;
        LOG.error("bolt execute error ", e);
        report_error.report(e);
      }

      if (ackerNum == 0) {
        // only when acker is disable
        // get tuple process latency
        Long start_time = (Long) tuple_start_times.remove(tuple);
        if (start_time != null) {
          Long delta = TimeUtils.time_delta_ms(start_time);
          task_stats.bolt_acked_tuple(tuple.getSourceComponent(),
              tuple.getSourceStreamId(), delta);
        }
      }
    } finally {
      boltExeTimer.stop();
    }
View Full Code Here


          return null;
        }

        // ser_msg.length > 1
        Tuple tuple = deserializer.deserialize(ser_msg);

        if (isDebugRecv) {

          LOG.info(idStr + " receive " + tuple.toString());
        }

        // recv_tuple_queue.offer(tuple);

        return tuple;
View Full Code Here

    }

    @Override
    public void onEvent(Object event, long sequence, boolean endOfBatch)
        throws Exception {
      Tuple tuple = deserialize((byte[]) event);

      if (tuple != null) {
        exeQueue.publish(tuple);
      }
    }
View Full Code Here

      }

      Runnable runnable = null;
      if (event instanceof Tuple) {

        Tuple tuple = (Tuple) event;
        Object id = tuple.getValue(0);
        Object obj = pending.remove((Long) id);

        if (obj == null ) {
          if (isDebug) {
            LOG.info("Pending map no entry:" + id );
          }
          return;
        }

        TupleInfo tupleInfo = (TupleInfo) obj;

        String stream_id = tuple.getSourceStreamId();

        if (stream_id.equals(Acker.ACKER_ACK_STREAM_ID)) {

          runnable = new AckSpoutMsg(spout, tupleInfo, task_stats,
              isDebug);
        } else if (stream_id.equals(Acker.ACKER_FAIL_STREAM_ID)) {
          runnable = new FailSpoutMsg(id, spout, tupleInfo, task_stats,
              isDebug);
        } else {
          LOG.warn("Receive one unknow source Tuple " + idStr);
          return;
        }

        task_stats.recv_tuple(tuple.getSourceComponent(),
            tuple.getSourceStreamId());

      } else if (event instanceof TimeTick.Tick) {

        Map<Long, TupleInfo> timeoutMap = pending.rotate();
        for (java.util.Map.Entry<Long, TupleInfo> entry : timeoutMap
View Full Code Here

    } else {
      results.put(requestId, tuple);
    }

    if (returns.containsKey(requestId) && results.containsKey(requestId)) {
      Tuple result = results.remove(requestId);
      Tuple returner = returns.remove(requestId);
      LOG.debug(result.getValue(1).toString());
      List<Tuple> anchors = new ArrayList<Tuple>();
      anchors.add(result);
      anchors.add(returner);
      _collector.emit(anchors, new Values("" + result.getValue(1),
          returner.getValue(1)));
      _collector.ack(result);
      _collector.ack(returner);
    }
  }
View Full Code Here

    _inputs.clear();
  }

  private void handleAck(Map action) {
    String id = (String) action.get("id");
    Tuple acked = _inputs.remove(id);
    if (acked == null) {
      throw new RuntimeException(
          "Acked a non-existent or already acked/failed id: " + id);
    }
    _collector.ack(acked);
View Full Code Here

    _collector.ack(acked);
  }

  private void handleFail(Map action) {
    String id = (String) action.get("id");
    Tuple failed = _inputs.remove(id);
    if (failed == null) {
      throw new RuntimeException(
          "Failed a non-existent or already acked/failed id: " + id);
    }
    _collector.fail(failed);
View Full Code Here

    if (anchorObj != null) {
      if (anchorObj instanceof String) {
        anchorObj = Arrays.asList(anchorObj);
      }
      for (Object o : (List) anchorObj) {
        Tuple t = _inputs.get((String) o);
        if (t == null) {
          throw new RuntimeException("Anchored onto " + o
              + " after ack/fail");
        }
        anchors.add(t);
View Full Code Here

TOP

Related Classes of backtype.storm.tuple.Tuple

Copyright © 2018 www.massapicom. 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.