Java Code Examples for it.unimi.dsi.fastutil.longs.LongArrayList#toLongArray()

The following examples show how to use it.unimi.dsi.fastutil.longs.LongArrayList#toLongArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransactionManager.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new Transaction. This method only get called from start transaction, which is already
 * synchronized.
 */
private Transaction createTransaction(long writePointer, TransactionType type) {
  // For holding the first in progress short transaction Id (with timeout >= 0).
  long firstShortTx = Transaction.NO_TX_IN_PROGRESS;
  LongArrayList inProgressIds = new LongArrayList(inProgress.size());
  for (Map.Entry<Long, InProgressTx> entry : inProgress.entrySet()) {
    long txId = entry.getKey();
    inProgressIds.add(txId);
    if (firstShortTx == Transaction.NO_TX_IN_PROGRESS && !entry.getValue().isLongRunning()) {
      firstShortTx = txId;
    }
  }
  return new Transaction(readPointer, writePointer, invalidTxList.toSortedArray(),
                         inProgressIds.toLongArray(), firstShortTx, type);
}
 
Example 2
Source File: DetachedTxSystemClient.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
@Override
public Transaction checkpoint(Transaction tx) {
  long newWritePointer = getWritePointer();
  LongArrayList newCheckpointPointers = new LongArrayList(tx.getCheckpointWritePointers());
  newCheckpointPointers.add(newWritePointer);
  return new Transaction(tx, newWritePointer, newCheckpointPointers.toLongArray());
}
 
Example 3
Source File: J7FileStatsStorage.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public long[] getAllUpdateTimes(String sessionID, String typeID, String workerID) {
    String sql = "SELECT Timestamp FROM " + TABLE_NAME_UPDATES + " WHERE SessionID = '" + sessionID + "'  "
            + "AND TypeID = '" + typeID + "' AND workerID = '" + workerID + "';";
    try (Statement statement = connection.createStatement()) {
        ResultSet rs = statement.executeQuery(sql);
        LongArrayList list = new LongArrayList();
        while (rs.next()) {
            list.add(rs.getLong(1));
        }
        return list.toLongArray();
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
}