Value () { // the following code makes sense only if we do not use ObjectReference.enableCollection() / disableCollection() // to keep temporary objects if (Patches.IBM_JDK_DISABLE_COLLECTION_BUG) { final EvaluationContextImpl evalContext = myStoredEvaluationContext; if (evalContext != null && !evalContext.getSuspendContext().isResumed() && myValue instanceof ObjectReference && VirtualMachineProxyImpl.isCollected((ObjectReference)myValue)) { final Semaphore semaphore = new Semaphore(); semaphore.down(); evalContext.getDebugProcess().getManagerThread().invoke(new SuspendContextCommandImpl(evalContext.getSuspendContext()) { @Override public void contextAction(@NotNull SuspendContextImpl suspendContext) { // re-setting the context will cause value recalculation try { setContext(myStoredEvaluationContext); } finally { semaphore.up(); } } @Override protected void commandCancelled() { semaphore.up(); } }); semaphore.waitFor(); } } assertValueReady(); return myValue; }