コード例 #1
0
 @Override
 public void setup(Context.OperatorContext context) {
   super.setup(context);
   timeIncrement =
       context.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT)
           * context.getValue(Context.DAGContext.STREAMING_WINDOW_SIZE_MILLIS);
 }
コード例 #2
0
  @Override
  public void setup(Context.OperatorContext context) {
    super.setup(context);
    LOGGER.debug("store properties {} {}", store.getDatabaseDriver(), store.getDatabaseUrl());
    LOGGER.debug("table name {}", tableName);
    windowID = context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID);
    try {
      ResultSet resultSet =
          store
              .getConnection()
              .createStatement()
              .executeQuery("SELECT col1 FROM " + tableName + " WHERE col3 >= " + windowID);
      PreparedStatement deleteStatement =
          store
              .getConnection()
              .prepareStatement(
                  "DELETE FROM " + tableName + " WHERE col3 >= " + windowID + " AND col1 = ?");

      Set<Object> deletedKeys = Sets.newHashSet();
      while (resultSet.next()) {
        Object key = resultSet.getObject(1);
        if (partitionKeys.contains((key.hashCode() & partitionMask))
            && !deletedKeys.contains(key)) {
          deletedKeys.add(key);
          deleteStatement.setObject(1, key);
          deleteStatement.executeUpdate();
        }
      }
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
  }
コード例 #3
0
 @Override
 public void setup(Context.OperatorContext context) {
   if (context != null) {
     spinningTime = context.getValue(Context.OperatorContext.SPIN_MILLIS);
   }
   execute = true;
   cause = new AtomicReference<Throwable>();
   waitingTuples.addAll(committedTuples);
   executorService =
       Executors.newSingleThreadExecutor(new NameableThreadFactory("Reconciler-Helper"));
   executorService.submit(processEnqueuedData());
 }