I\'ve got some questions about Java\'s assigment.
I\'ve got a class:
public class Test {
private String s;
public synchro
Perhaps a Read Write Lock could solve your problem?
Take a look at its documentation:
A read-write lock allows for a greater level of concurrency in accessing shared data than that permitted by a mutual exclusion lock. It exploits the fact that while only a single thread at a time (a writer thread) can modify the shared data, in many cases any number of threads can concurrently read the data (hence reader threads). In theory, the increase in concurrency permitted by the use of a read-write lock will lead to performance improvements over the use of a mutual exclusion lock. ....