I have multiple wars deployed in jetty. Initially I had a singleton class but the problem was it was initialized in both the wars. So I’m trying by making the singleton as enum. Is there a way to make a JVM wide singleton ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t really enforce this. Your singletons will be classloader-specific, and since your apps can define multiple classloaders, you’re going to be frustrated.