Hi experts,
I am getting SynchronizationCommitConflictException when more threads try to modify the same Region value. Likely there is a misconfiguration in the config files but I don't know what the error can be. Can you please help?
client cache XML
<client-cache>
<pool name="client" subscription-enabled="true">
<locator host="localhost" port="41111"/>
</pool>
<region name="THROTTLING" refid="CACHING_PROXY">
<region-attributes statistics-enabled="true" enable-gateway="true" hub-id="transaction-gateway" scope="global"/>
</region>
</client-cache>
server cache XML
<cache>
<cache-server port="40404"/>
<region name="THROTTLING" refid="REPLICATE">
<region-attributes statistics-enabled="true" enable-gateway="true" hub-id="transaction-gateway"/>
</region>
</cache>
Java code
getDistributedLockService().lock(key, 30000, 60000);
...
private DistributedLockService getDistributedLockService() {
synchronized (DistributedLockService.class) {
DistributedLockService distributedLockService = DistributedLockService.getServiceNamed("distributedLockService_THROTTLING");
if (distributedLockService == null) {
// TODO -> deprecated
distributedLockService = DistributedLockService.create("distributedLockService_THROTTLING", getCache().getCache().getDistributedSystem());
}
return distributedLockService;
}
}
...
private synchronized Region getCache() {
// getting the cache
ClientCache clientCache = new ClientCacheFactory().set("cache-xml-file", "gemfire-client.xml").create();
return clientCache.getRegion("THROTTLING");
}
And this is the exception trace:
vfs:/D:/utils/cygwin/home/Viktor/content/sim-service-get-customer-by-id-v2-1.1-SNAPSHOT.jar/wsdl/GetCustomerById.wsdl
15:00:02,605 WARN [com.arjuna.ats.arjuna] (http--127.0.0.1-8080-10) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffffc0a80017:-639fd3a7:522dd364:22, TXStateProxyImpl@8890213 txId:TXId: Viktor-PC(:loner):60027:17700203:12 realDeal:class com.gemstone.gemfire.internal.cache.tx.ClientTXStateStub@33482373 target node: null isJTA:true >: com.gemstone.gemfire.cache.SynchronizationCommitConflictException: Conflict detected in GemFire transaction TXId: 192.168.0.23(:loner):60027:17700203:12, caused by com.gemstone.gemfire.cache.CommitConflictException: Entry for key CACHE_FREQUENCY_BigSystem on region THROTTLING had a state change
at com.gemstone.gemfire.internal.cache.TXState.beforeCompletion(TXState.java:909) [gemfire.jar:]
at com.gemstone.gemfire.internal.cache.TXStateProxyImpl.beforeCompletion(TXStateProxyImpl.java:523) [gemfire.jar:]
at com.gemstone.gemfire.internal.cache.tier.sockets.command.TXSynchronizationCommand$1.run(TXSynchronizationCommand.java:90) [gemfire.jar:]
at com.gemstone.gemfire.internal.cache.TXSynchronizationRunnable.run(TXSynchronizationRunnable.java:44) [gemfire.jar:]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_29]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_29]
at com.gemstone.gemfire.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:692) [gemfire.jar:]
at com.gemstone.gemfire.distributed.internal.DistributionManager$6$1.run(DistributionManager.java:1029) [gemfire.jar:]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_29]
Caused by: com.gemstone.gemfire.cache.CommitConflictException: Entry for key CACHE_FREQUENCY_BigSystem on region THROTTLING had a state change
at com.gemstone.gemfire.internal.cache.TXEntryState.checkForConflict(TXEntryState.java:1428) [gemfire.jar:]
at com.gemstone.gemfire.internal.cache.TXRegionState.checkForConflicts(TXRegionState.java:219) [gemfire.jar:]
at com.gemstone.gemfire.internal.cache.TXState.checkForConflicts(TXState.java:571) [gemfire.jar:]
at com.gemstone.gemfire.internal.cache.TXState.reserveAndCheck(TXState.java:303) [gemfire.jar:]
at com.gemstone.gemfire.internal.cache.TXState.beforeCompletion(TXState.java:871) [gemfire.jar:]
... 8 more
Thanks,
V.