Concurrent Data Storage Example
535773Sep 25 2006 — edited Sep 25 2006Is there handy example on how to use Concurrent Data Storage?
I am witing an sample program, in which a process spawns a thread and writes to HashMap every 10 secs, and on other side multiple processes with multple threads which constantly reads the HashMap every 10 secs.
I was successful, in writing sample progams for writing and reading those HashMaps. But, on reading the HashMap, I don't get updated data. I have restart the reader process to read most current data.
On Writer, I am setting these flags:
envConfig.setTransactional(false);
envConfig.setLocking(false);
envConfig.setAllowCreate(true);
dbConfig.setTransactional(false);
dbConfig.setAllowCreate(true);
Also, I am calling env.sync(), after I do map.put(index, value) on HashMap.
On Reader, I am setting these flags:
envConfig.setTransactional(false);
envConfig.setLocking(false);
envConfig.setReadOnly(true);
dbConfig.setTransactional(false);
dbConfig.setReadOnly(true);
And I am calling map.get(index) to retrieve the value.
Do, I have to set any other flags? Or I am totally off the course.
Thanks