Fixed - ConcurrentModificationException in RTransaction object. #1459

pull/1499/head
Nikita 7 years ago
parent cfb37545e1
commit 6c8f04b0f1

@ -15,12 +15,14 @@
*/
package org.redisson.cache;
import java.io.Serializable;
/**
*
* @author Nikita Koksharov
*
*/
public class LocalCachedMapDisabledKey {
public class LocalCachedMapDisabledKey implements Serializable {
private String requestId;
private long timeout;

@ -15,12 +15,14 @@
*/
package org.redisson.cache;
import java.io.Serializable;
/**
*
* @author Nikita Koksharov
*
*/
public class LocalCachedMapEnable {
public class LocalCachedMapEnable implements Serializable {
private byte[][] keyHashes;
private String requestId;

@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@ -79,7 +80,7 @@ public class RedissonTransaction implements RTransaction {
private final AtomicBoolean executed = new AtomicBoolean();
private final TransactionOptions options;
private List<TransactionalOperation> operations = new ArrayList<TransactionalOperation>();
private List<TransactionalOperation> operations = new CopyOnWriteArrayList<TransactionalOperation>();
private Set<String> localCaches = new HashSet<String>();
private final long startTime = System.currentTimeMillis();
@ -287,6 +288,7 @@ public class RedissonTransaction implements RTransaction {
private void checkTimeout() {
if (options.getTimeout() != -1 && System.currentTimeMillis() - startTime > options.getTimeout()) {
rollbackAsync();
throw new TransactionTimeoutException("Transaction was discarded due to timeout " + options.getTimeout() + " milliseconds");
}
}

@ -22,7 +22,7 @@ public abstract class RedissonBaseTransactionalMapTest extends BaseTest {
@Test
public void testFastPut() throws InterruptedException {
ExecutorService executor = Executors.newFixedThreadPool(200);
ExecutorService executor = Executors.newFixedThreadPool(2000);
for (int i = 0; i < 2000; i++) {
executor.submit(() -> {
for (int j = 0; j < 100; j++) {

Loading…
Cancel
Save