multithreading - Reg multiple synchronised block with multiple JVM's -


i have java application deployed on was.it receives request wps(websphere process server) , inserts data oracle db. inorder avoid multithreading issues,i wrote code in synchronised block.now application working fine on dev env(single jvm). came know qa has multiple jvm's. heared synchronised block doesn't work on multiple jvm's,so worried whether application works in qa env?

the synchronized keyword works using locks against instances in jvm method invoked, won't guarantees of thread safety if application running across multiple jvms. (in fact, guarantee in single jvm if careful synchronize on.)

this mechanism documented, including oracle javadocs, blog posts on topic might easier understand.

i don't think can tell whether application work in "qa" information you've given. depends on detail of what's being done. example, let's assume wps sending requests out jvms , have insert them in database. if inserting database using primary key number incrementing in jvm have problems result possibly won't occur synchronized code. on other hand, if you're generating random primary id, or letting database generate ids you, it's rather less problem.

it might if think scenarios cause application fail or wrong thing. if you're not sure how proceed you'll @ least able ask more specific questions.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -