コード例 #1
0
 public void run() {
   HazelcastClient hClient = TestUtility.newHazelcastClient(h);
   while (run) {
     Map<String, String> clientMap = hClient.getMap("putFromMultipleThreads");
     clientMap.put(String.valueOf(counter.incrementAndGet()), String.valueOf(counter.get()));
   }
 }
コード例 #2
0
 @Test
 public void putBigObject() {
   HazelcastClient hClient = getHazelcastClient();
   Map<String, Object> clientMap = hClient.getMap("putABigObject");
   List list = new ArrayList();
   int size = 10000000;
   byte[] b = new byte[size];
   b[size - 1] = (byte) 144;
   list.add(b);
   clientMap.put("obj", b);
   byte[] bigB = (byte[]) clientMap.get("obj");
   assertTrue(Arrays.equals(b, bigB));
   assertEquals(size, bigB.length);
 }
コード例 #3
0
 private void putAndGet(Map<String, String> map, int counter) {
   long beginTime = Clock.currentTimeMillis();
   for (int i = 1; i <= counter; i++) {
     if (i % (counter / 10) == 0) {
       System.out.println(i + ": " + (Clock.currentTimeMillis() - beginTime) + " ms");
     }
     map.put("key_" + i, String.valueOf(i));
   }
   beginTime = Clock.currentTimeMillis();
   for (int i = 1; i <= counter; i++) {
     if (i % (counter / 10) == 0) {
       System.out.println(i + ": " + (Clock.currentTimeMillis() - beginTime) + " ms");
     }
     assertEquals(String.valueOf(i), map.get("key_" + i));
   }
 }