Search in sources :

Example 1 with SerializedKeyValueBuffers

use of com.ms.silverking.cloud.dht.client.serialization.internal.SerializedKeyValueBuffers in project SilverKing by Morgan-Stanley.

the class KVSerializationTest method runTest.

public void runTest(int numKeys, BufferMode bufferMode) {
    SerializedKeyValueBuffers skvBuffers;
    Stopwatch sw;
    ThreadLocalRandom random;
    skvBuffers = new SerializedKeyValueBuffers();
    random = ThreadLocalRandom.current();
    sw = new SimpleStopwatch();
    for (int i = 0; i < numKeys; i++) {
        DHTKey key;
        ByteBuffer value;
        key = new SimpleKey(random.nextLong(), random.nextLong());
        value = randomValue(random);
        skvBuffers.addKeyValue(key, value, bufferMode);
    }
    sw.stop();
    System.out.println(skvBuffers);
    System.out.printf("Elapsed %f\n", sw.getElapsedSeconds());
    skvBuffers.freeze();
    display(skvBuffers);
}
Also used : SerializedKeyValueBuffers(com.ms.silverking.cloud.dht.client.serialization.internal.SerializedKeyValueBuffers) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) Stopwatch(com.ms.silverking.time.Stopwatch) DHTKey(com.ms.silverking.cloud.dht.common.DHTKey) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) ByteBuffer(java.nio.ByteBuffer) SimpleKey(com.ms.silverking.cloud.dht.common.SimpleKey)

Aggregations

SerializedKeyValueBuffers (com.ms.silverking.cloud.dht.client.serialization.internal.SerializedKeyValueBuffers)1 DHTKey (com.ms.silverking.cloud.dht.common.DHTKey)1 SimpleKey (com.ms.silverking.cloud.dht.common.SimpleKey)1 SimpleStopwatch (com.ms.silverking.time.SimpleStopwatch)1 Stopwatch (com.ms.silverking.time.Stopwatch)1 ByteBuffer (java.nio.ByteBuffer)1 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)1