}
@Test
public void testConcrruentTxnPut() throws Exception {
final String mapName = randomString();
final MultiMap multiMap = client.getMultiMap(mapName);
final int threads = 10;
final ExecutorService ex = Executors.newFixedThreadPool(threads);
final CountDownLatch latch = new CountDownLatch(threads);
final AtomicReference<Throwable> error = new AtomicReference<Throwable>(null);
for (int i = 0; i < threads; i++) {
final int key = i;
ex.execute(new Runnable() {
public void run() {
multiMap.put(key, "value");
final TransactionContext context = client.newTransactionContext();
try {
context.beginTransaction();
final TransactionalMultiMap txnMultiMap = context.getMultiMap(mapName);
txnMultiMap.put(key, "value");
txnMultiMap.put(key, "value1");
txnMultiMap.put(key, "value2");
assertEquals(3, txnMultiMap.get(key).size());
context.commitTransaction();
assertEquals(3, multiMap.get(key).size());
} catch (Exception e) {
error.compareAndSet(null, e);
} finally {
latch.countDown();
}