Scenario:
I have been using Java SE for quite some time, working with threads etc, though I have little experience with Java EE.
I have a 3rd-party Java library that connects to a remote server (at the 3rd-party company). The library creates several threads and is keeping the connection alive by itself.
I am not allowed to open new connections over and over (by creating new instances of the library). I need to keep the same instance of the library which will keep the connection up at all time.
This is quite easy in a Java SE application.
Now, I want to create a web service (perhaps using GlassFish or similar) to use internally at my company to be able to use the functionality of this library with its connection.
In other words, I need a custom remote connection (that is not created by or managed by my code) to be kept alive between request instances.
Question:
Is this possible to achieve? If so, which technology should I take a look at?
you can do that using connection pool.when ever a connection required to remote server, get the connection from this pool instead of instantiating every time.This will help you in maintaing better memory foot print and efficiency.If connection is no longer in use, you can return the connection to pool.