[concurrency-interest] synchronize design
alarmnummer at gmail.com
Wed Feb 7 04:17:14 EST 2007
Another solution would be the following:
Create an Executor with a single thread and let this thread
communicate with the structure (if the structure is accessed by a
single thread, you don't need concurrency control in the structure
If a client want to read something, it creates a runnable, places it
on the executor and by using a Future the thread can wait for
completion and the result. The same goes for the writes.
And to give writes a higher priority than the reads, you could use a
BlockingQueue as workQueue that is able to deal with priorities. Items
with a higher priority fall through faster than items with a lower
priortity (give the writes a higher priority than the reads).
I guess there are lots of other solutions, but I don't have enough
information to give a good answer.
On 2/7/07, Rajesh Balamohan <rbalamohan at sonoasystems.com> wrote:
> Can you try checking ReadWrite Locks in JDK 1.5 for this?.. Aquire the
> write lock only when you want to change it.
> sidali ikhlef wrote:
> > Hi,
> > I have multiple threads accessing a shared class called Resources, witch is
> > composed of many other objects such as Current Activity, current environment
> > ..... I want to synchronize the access to this resource but not using simple
> > mechanisms like synchronize or synchronize(this). Any help or referencing
> > will be appreciated.
> > Precision: writing to the resource must have higher priority than reading
> > and the chronology is very important to keep data coherent.
> > Regards.
> > _________________________________________________________________
> > MSN Messenger: appels gratuits de PC à PC !
> > http://www.msn.fr/newhotmail/Default.asp?Ath=f
> > _______________________________________________
> > Concurrency-interest mailing list
> > Concurrency-interest at altair.cs.oswego.edu
> > http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
More information about the Concurrency-interest