0

I am currently developing a web solution using JavaEE. I have a database connection being established through a singleton.

Will a singleton be user specfic, as in a new instance will be created for each user or will the singleton be shared across all users on the server?

Thanks

2

2 Answers 2

1

Singleton object is same for all users. Only one object will be created per application and all users will reach the same singleton object.

Sign up to request clarification or add additional context in comments.

Comments

0

Singleton, if implemented properly, means there will be one instance of that class per JVM. Check out this wiki for a nice overview with code examples.

1 Comment

Thanks for the reply! I'd give you an upvote but don't have enough rep. This answer was good too but Salih replied first!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.