Interesting question. I would firstly refer you to the bitly best-
practices:
http://code.google.com/p/bitly-api/wiki/ApiBestPractices
Additionally, I suggest posting to the bitly API group to see if
anyone from bitly can state the actual call limit. I suspect you might
be hitting that and not the connection limit, in which case any
connection tricker in bitlyj would be moot.
However, to entertain the possibility of gaining more throughput,
there is at least one thing to try. Bitly, at least according to the
headers from the API server, supports HTTP 1.1 persistent connections.
According to:
http://download.oracle.com/javase/1.5.0/docs/guide/net/http-keepalive.html
the jdk >= 5 should cache and reuse the underlying TCP connections for
dealing with HTTP streams, if the streams are fully consumed. I need
to make sure the underlying XML parser is both fully consuming and
closing the stream, though I suspect it is. The only other thing I can
think of is to modify bitlyj to fully consume the error response,
which it doesn't currently do. According to the tiger docs, "Doing so
may results in idle TCP connections."
This would be a simple change, but I'm doubtful that it's at the root
of your problem. Again, see if the bitly API group will divulge the
actual call limit.
The only other thing you may be doing is using bitlyj in a
multithreaded fashion. Bitlyj maintains no mutable state, so it should
be thread-safe by default. However, for N threads you will have at
least N open connections, and if some are idling (which is possible
but I'd think unlikely), you would have N + idle connections.
I follow the bilty API group, so start a thread and I'll watch.
-chris