I'm using JBossCache 'Malagueta' 3.2.0.GA
I faced with strange issue in production environment, sometimes writes to jboss are lost. I tried to reproduce this situation with simple java application
public static void testCache() {
Cache cache = new DefaultCacheFactory().createCache(false);
cache.create();
cache.start();
final Node node = cache.getRoot().addChild(Fqn.fromString("/child1"));
int threadsCount = 20;
final CyclicBarrier b = new CyclicBarrier(threadsCount);
for (int i = 0; i < threadsCount; i++) {
final long j = i;
new Thread(new Runnable() {
@Override
public void run() {
try {
b.await();
String name = RandomGenerator.getRandomName(4);
node.put(j, name);
String nameFromCache = (String) node.get(j);
if (!name.equals(nameFromCache)) {
System.out.println("error");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
From time to time, this test output "error", which i run from static void mai
. 1 of 3 runs return "error" msg, node simply return "null". I can't reproduce it on every machine