Non-Web Service API and initialization

I need to integrate with a third party service provider and web services are absolutely not an option (for several reasons). The api is a simple java POJO interface passing/receving java objects. I see that I can make the call using a custom java action. However, I need to be able to initialize the connection to the service once up front and store it so that I don't have to each time I call it inside the java action which would significantly hurt performance. What is the best way to initialize this java connection class and make it available downstream in my custom java actions?
2 answers

Maybe you could initialize the connection after startup of your app?


If you want to reuse the same connection within one request, you can store that connection in a static ThreadLocal variable, that will make it available in all java actions started from the same thread (request)