Sunday, 15 July 2012

design patterns - Is my style of coding - using static object with non-static getter - causing 'memory leaks' or 'performance issues' in my Java app on Heroku -


I am running Play Framework 1.2.7 on Heroku, and my app is only working because I pushed it up Restart every ten minutes I want to go to the bottom of this problem and I suspect that the following aspect of my code is the issue.

I hit a certain style of coding in which a non -Static method is used, in which one object is located The example is example. The way I read the code and it can be arranged. Like if I need the version of the object that contains the state, then I instill it, if not, then I just like Obj.instance () Do something TheMethod () However this can cause problems.

Assume that there is a square called shop I am doing this:

  public class shop Shop INSTANCE = new shop (); Public Stable Shop Example () {Return INSTANCE; } // Some goods are public dos doSomething () {// method stuff}}  

which I call in my code like this:

  store .instance () DoSomething ()  

If you can tell me that this is a problem, then it would be greatly appreciated.

Edit: The main issue is that CS / SE is not being studied, so I do not have so much knowledge, so that they will get back. If you can point me out some keywords to Google that would be very appreciated.


No comments:

Post a Comment