This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
We have a java utility which basically does some business process like validating rules for set of customers. Right now this utility have the limitation that is we cannot run the utility for two customers at the same time(Concurrently) in that case it produces undesired results.
Basically I am thinking how can this be achieved like we can run the same application for different customers concurrently. Again this is simlple Java utility does not have any Enterprise or Webcomponents. When two instances of the same application is run it will still use only one JVM right.What should be kept in mind while designing so that the resources are not shared across two instances of the same application. I am trying to come up with an application which can be run concurrently. Please advise.
Thanks in advance Bhazee [ February 24, 2008: Message edited by: Prem Bhazee ]
Yes the application is running using java coammdn followed by the jar file. So can you please confirm then everytime this application is run it should create separate JVM' for each instances. So the static variables will also be separate across the JVM's right. Is there anything which will be shared between the different instances of the JVM's for different instances of the application.
I am just trying to understand will any method or variables(static) will be shared across instances of the applicaion.
Originally posted by Prem Bhazee: When you say no data in memory you mean are you asking whether the different instances will be operating on the same data in memory. Can you please elaborate.
Both static and non-static variables are not shared.
So let's say you have class A, with static field B of some type. Now in the same JVM it is true that any reference to A.B will refer to the same object. However, A.B in one JVM will NOT refer to the same object as A.B in another JVM.