KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > classloader > scoping > singleton > MySingleton


1 package org.jboss.test.classloader.scoping.singleton;
2
3 /** A singleton class for testing singleton versioning
4  * @author Scott.Stark@jboss.org
5  * @version $Revision: 16662 $
6  */

7 public class MySingleton
8 {
9    private static MySingleton instance;
10
11    private String JavaDoc version;
12
13    public static MySingleton getInstance()
14    {
15       if( instance == null )
16       {
17          instance = new MySingleton("V2");
18       }
19       return instance;
20    }
21
22    private MySingleton(String JavaDoc version)
23    {
24       this.version = version;
25    }
26
27    public String JavaDoc getVersion()
28    {
29       return version;
30    }
31 }
32
Popular Tags