You need not write the code of instantiating the singleton in the ejbCreate or
any other specific method. You can do something similar to:
MyEJB implements SessionBean {
|
| public void someMethod() {
|
| //do some logic
| .....
| //at this point, i need the value for a property. So do the
following
| ConfigMgr.getInstance().getPropertyValue("someProperty");
|
| }
|
| }
|
| ConfigMgr {
|
|
| private static ConfigMgr configMgr;
|
| private Properties properties;
|
| private ConfigMgr() {
|
| //load the properties file
| properties = someCodeToLoadPropertiesFile();
| }
| public synchronized static getInstance() {
|
| if (configMgr == null) {
| configMgr = new ConfigMgr();
| }
| return configMgr;
| }
|
|
| }
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973307#3973307
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3973307
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user