It already does that for the case of read-only in a transaction,
which is pretty much the same case (no transaction synchronization).
See the code earlier on:
// FIXME: We cannot passivate here, because previous // interceptors work with the context, in particular // the re-entrance interceptor is doing lock counting // Just remove it from the cache if(ctx.getId() != null) container.getInstanceCache().remove(ctx.getId());
The real solution should be to remove it from the cache
and "schedule" passivation for when whoever is using it releases it.
It used to do exactly that prior to 3.2.x (all passivation was on a background thread)
but Bill "simplified it". :-)
Or we should just add a big warning if somebody tries to use option-c with a shared instance
cache. They should use the multiple instance config :-)