user_1357
user_1357

Reputation: 7940

Play Framework: Global class

We have a class Global.scala in Play Framework. I was wondering does all the requests share a copy of this class? For example if I were to instantiate an object at this Global.scala

val temp = new SomeObject

Is above shared among all the requests that comes to the Play? Or does every request have their copy of Global.scala?

Thanks

Upvotes: 0

Views: 118

Answers (1)

Michael Zajac
Michael Zajac

Reputation: 55569

Assuming your Global is another singleton object, then yes, all requests will share Global.temp, as it gets created when the application is started. Of course, this would obviously not be true for an application distributed across multiple instances.

Upvotes: 2

Related Questions