Search code examples
javahttpurlconnection

how to use KeepAliveCache get(url,object)


I have an old application that seems to be written in java 1.4 or 1.3. and I am migrating it to 1.7. The issue is that it is using KeepAliveCache's get(URL) method inthe old implementation, while the new signature is get(URL, Object).

Can someone explain me how to use this method? Can I do get(URL, URL)?


Solution

  • KeepAliveCache is a sun.* class that shouldn't have been used in the first place, for exactly the reason you have encountered: it is an implementation-private class whose API is subject to change without notice.

    Just remove it and use what's provided in java.net. It does connection pooling and all that for you automatically. No need to peer under the hood. You'll improve code quality and probably fix bugs too.