Singleton class using threads
Hi all,
I have one singleton class like Connection ( this has the databse connection). if everytime I need a connection I called the
Connection.getConnection() method.
But the problem is , in My applicaiton I am using the Threading.
If i use the threading then its getting the null pointer exception in the Connection class.
I think the Singleton class is using in the Normal process and also Thread process simultaniously. So How can I synchronize this connection with threading.
I used the getConnection method like below
public static synchronized cConnection getConnection()
{
return connection;
}
please suggest me.
thanks

