I'm running Play Framework 1.2.7 on Heroku, and my app is only functioning because I've rigged it up to restart every ten mins. I would like to get to the bottom of this problem and I suspect the following aspect of my code is the issue.
I hit upon a certain style of coding which involves using a non-static method, with a static instance of an object. I like the way the code reads and can be organised. e.g. If I need a version of the object that has state I instantiate it, if not I just do something like Obj.instance().theMethod() however this might be causing problems.
Assuming there is a class called Shop I'm doing this:
public class Shop{
// some stuff
private static final Shop INSTANCE = new Shop();
public static Shop instance() {
return INSTANCE;
}
// some stuff
public void doSomething(){
// do method stuff
}
}
Which I then call in my code like this:
Shop.instance().doSomething()
Would be much appreciated if you could let me know whether this is a problem. Thanks
Aucun commentaire:
Enregistrer un commentaire