best proceed java 6 list being accessed concurrently
i have list vigilant being accessed churned threads. there mostly thread, conditions twin threads, updates list. there 5 threads review list, depending array user requests being processed.
the list reserve tasks perform, list domain objects being retrieved updated concurrently.
now there several ways opening list thread-safe:
-use synchronized block
-use normal lock (i.e. review ops share same lock)
-use readwritelock
-use new concurrentblablba collection classes
my question:
what optimal proceed use, given cricital sections typically enclose lot operations (mostly only adding/removing/inserting removing elements list)?
can advise another approach, listed above?
some constrains
-optimal opening critical, memory use much
-it contingency an systematic list (currently synchronizing an arraylist), nonetheless sorted list (i.e. sorted controlling allied comparator, nonetheless according insertion order)
-the list big, containing adult 100000 domain objects, so controlling something copyonwritearraylist feasible
-the write/update ciritical sections typically unequivocally quick, doing rudimentary add/remove/insert reinstate (set)
-the review operations essentially elementat(index) many time, nonetheless review operations competence binary search, indexof(element)
-no proceed iteration over list done, nonetheless operation indexof(..) camber list
Comments
Post a Comment