this little bit of combo question:
let's have multiple threads need lock on values such user id. example, want isolate database operations related given player, operations related id 5 run simultaneously alongside operations on id 7, if operation on id 5 running, operation on id 5 have wait. have used code example: http://illegalargumentexception.blogspot.com/2008/04/java-synchronizing-on-transient-id.html core java , may use generics allow used other data types such ints or longs.
how optionally lock on 2 of these kinds of variables, , or or logic? example, let's have messaging system clients can message each other, want have threads block on either id? in other words, if want operation between ids 5 , 7, want wait running operations on either 5 or 7 finish first before unlocking.
thanks pointers!
i haven't done myself build hashtable maps id's locks. fact id's primitives shouldn't problem, can use integer or long variants keys in hashtable.
more info lock's
Comments
Post a Comment