I have a general question about JNDI. I have read some documentation and plan to read more, but I thought I should post my question to make sure I am heading down the right path.
I have a java object that makes telnet connections and enables you to programatically screen scrape telnet 3270 applications. The problem I have is that I need to write a service that uses this object. The object has connect() and disconnect() methods to connect to a server, but I do not want to connect and disconnect every time the service is called. So, here is my idea:
1. At JBoss or application startup create the telnet session object and have the object connect to the telnet server and then register the object with JNDI. 2. From the service perform a JNDI lookup to retreive the object and use it. (Since the object has already connected there will be no need to connect)
Here are my quesitons: A. Is it possible to do the above? Is JNDI the correct mechanism to use for this sort of thing? If so can someone point me to some example or tutorial? B. How are objects created by JBoss and registered with JNDI? C. Am I going about this in the right way? D. This is probably beyond my skill level, but is it possible to create a pool of such objects instead of just one?