I\'m having a hard time dealing with a Java garbage collection problem, and interpreting the logs.
My application requires that no GC takes longer than 2 seconds, and id
I think your attention might be a little misdirected.
Spend a little time in a profiler finding your biggest allocation hotspots. If there are just a few places in your code where the majority of your allocations occur, try using an object pool rather than always constructing new objects.
Collection classes and StringBuilders are great candidates for pooling. When you return them to the pool, call the collection.clear() or the stringbuilder.setLength(0) methods, so that they're ready for consumption when the next caller wants to retrieve them from the pool.
The best way to tune the GC is by creating fewer objects. There are lots of strategies for eliminating allocations, and pooling is just one of them (though one of my favorites).
UPDATE: It's been five years since I wrote this answer, and my opinion on pooling has mostly changed. Back when I wrote this answer in 2009, I could frequently use object pooling (even of simple objects like StringBuilder) to speed up tight inner loops with lots of allocations. These days, it's harder to find cases where pooling doesn't make the situation worse. I almost never use pools for anything other than threads or connections. Still though, it's a nice tool to have at your disposal, even if you don't use it often.