Why not codify one or the other of the workarounds, otherwise it
becomes necessary to put both in place, which is redundant. The first
workaround of restarting the resource adapter seems to assume that
recovery only happens at a time that's isolated from the normal running
of the server. Stopping and starting a resource adapter (per the spec)
means bringing applications down and that really isn't acceptable. So
the second one is better. Maybe the spec should indicate a requirement
for a resource adapter to free up all resources associated with an
XAResource that is supplied to
ResourceAdapter.getXAResources(ActvationSpec[]) after commit/rollback
completes?