Java Code Examples for com.carrotsearch.hppc.LongArrayList#toArray()

The following examples show how to use com.carrotsearch.hppc.LongArrayList#toArray() . 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: TestingTxnStore.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
private long[] findActiveTransactions(long minTimestamp,long maxId,byte[] table){
    LongArrayList activeTxns=new LongArrayList(txnMap.size());
    for(Map.Entry<Long, TxnHolder> txnEntry : txnMap.entrySet()){
        if(isTimedOut(txnEntry.getValue())) continue;
        Txn value=txnEntry.getValue().txn;
        if(value.getEffectiveState()==Txn.State.ACTIVE && value.getTxnId()<=maxId && value.getTxnId()>=minTimestamp){
            Iterator<ByteSlice> destinationTables=value.getDestinationTables();
            while(destinationTables.hasNext()){
                ByteSlice data=destinationTables.next();
                if(data.equals(table,0,table.length))
                    activeTxns.add(txnEntry.getKey());
            }
        }
    }
    return activeTxns.toArray();
}
 
Example 2
Source File: ExhaustiveLongEncodingTest.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
@DataPoints public static long[] powersOf2(){
    LongArrayList dataPoints = new LongArrayList(100);
    long l = 1l;
    while(l>0){
        dataPoints.add(l);
        dataPoints.add(-l);
        dataPoints.add(3*l);
        dataPoints.add(-3*l);
        dataPoints.add(5*l);
        dataPoints.add(-5*l);
        dataPoints.add(7*l);
        dataPoints.add(-7*l);
        l<<=1;
    }

    return dataPoints.toArray();
}
 
Example 3
Source File: MemTxnStore.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
private long[] findActiveTransactions(long minTimestamp,long maxId,byte[] table){
    LongArrayList activeTxns=new LongArrayList(txnMap.size());
    for(Map.Entry<Long, TxnHolder> txnEntry : txnMap.entrySet()){
        if(isTimedOut(txnEntry.getValue())) continue;
        Txn value=txnEntry.getValue().txn;
        if(value.getEffectiveState()==Txn.State.ACTIVE && value.getTxnId()<=maxId && value.getTxnId()>=minTimestamp){
            Iterator<ByteSlice> destinationTables=value.getDestinationTables();
            while(destinationTables.hasNext()){
                ByteSlice data=destinationTables.next();
                if(data.equals(table,0,table.length))
                    activeTxns.add(txnEntry.getKey());
            }
        }
    }
    return activeTxns.toArray();
}
 
Example 4
Source File: TestingTxnStore.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
private long[] getAllActiveTransactions(long minTimestamp,long maxId) throws IOException{

        LongArrayList activeTxns=new LongArrayList(txnMap.size());
        for(Map.Entry<Long, TxnHolder> txnEntry : txnMap.entrySet()){
            if(isTimedOut(txnEntry.getValue())) continue;
            Txn value=txnEntry.getValue().txn;
            if(value.getEffectiveState()==Txn.State.ACTIVE
                    && value.getTxnId()<=maxId
                    && value.getTxnId()>=minTimestamp)
                activeTxns.add(txnEntry.getKey());
        }
        return activeTxns.toArray();
    }
 
Example 5
Source File: RegionTxnStore.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public long[] getActiveTxnIds(long afterTs,long beforeTs,byte[] destinationTable) throws IOException{
    if(LOG.isTraceEnabled())
        SpliceLogUtils.trace(LOG,"getActiveTxnIds beforeTs=%d, afterTs=%s, destinationTable=%s",beforeTs,afterTs,destinationTable);

    LongArrayList lal = new LongArrayList();
    try (Source<TxnMessage.Txn> activeTxn = getActiveTxns(afterTs, beforeTs, destinationTable)) {
        while (activeTxn.hasNext()) {
            TxnMessage.Txn next = activeTxn.next();
            TxnMessage.TxnInfo info = next.getInfo();
            lal.add(info.getTxnId());
        }
    }
    return lal.toArray();
}
 
Example 6
Source File: ExhaustiveLongEncodingTest.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
@DataPoints public static long[] powersOf7(){
    LongArrayList dataPoints = new LongArrayList(100);
    long l = 1l;
    while(l>0){
        dataPoints.add(l);
        dataPoints.add(-l);
        l*=7;
    }

    return dataPoints.toArray();
}
 
Example 7
Source File: MemTxnStore.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
private long[] getAllActiveTransactions(long minTimestamp,long maxId) throws IOException{

        LongArrayList activeTxns=new LongArrayList(txnMap.size());
        for(Map.Entry<Long, TxnHolder> txnEntry : txnMap.entrySet()){
            if(isTimedOut(txnEntry.getValue())) continue;
            Txn value=txnEntry.getValue().txn;
            if(value.getEffectiveState()==Txn.State.ACTIVE
                    && value.getTxnId()<=maxId
                    && value.getTxnId()>=minTimestamp)
                activeTxns.add(txnEntry.getKey());
        }
        return activeTxns.toArray();
    }