To use a Caching methodolgy or not?
I was wondering if someone can help me answer this question? I am going to have this class that will be used by the Beans to complete a transaction. Because I have several Beans that all need this one particular class to complete a transaction, I was wondering if it would be good to create this class in a cache type manner. Meaning this class will only be instantiated once when the server loads after that all the beans will only reference it through this class' getInstance() method. I know this class does not contain any data that needs to persist however I would like to avoid having mulitple instances of this one particular class. The class completes a rather long transaction process. It is not much from my side, but I have to wait a few seconds for the other application that I connect to, to complete the transaction, then finally get a return. This class does not do too much work, but it just needs to wait for a long time to get back a response. Since threads are lighter and cheaper than a complete process I was wondering if I should create this class that extends the thread. Below I have some basic code that can do this but I was wondering if this would be a good methodolgy for transaction heavy application. Sorry for making it too long. I have marked the class with X's to prevent the client who we connect to.
public class XXXXXXX extends Thread {
private static XXXXXXXX wconn = null;
private XXXXXXXX xxc;
private String response = null;
public XXXXXXXX() {
this.xxc = new XXXXXXXX ();
/*******************
* set properties *
*******************/
this.xxc.host = ""; //Connector ID
this.xxc.port = 8800; //without SSL
//this.xxc.port = 443; //SSL
this.xxc.ssl = false; //SSL (if true, change port to 443!)
this.xxc.compress = true; //compression
this.xxc._native = true; // native request; MUST set to true for XML Pro
this.xxc.keepalive = false; //indicates if the connection to the server should persist
}
public void run()
{
}
public static XXXXXXXX getInstance()
{
return wconn;
}
private other functions ....
Thank You for any insight that you can provide.

