OrchestratorContext implements AutoCloseable { public boolean largeLocks() { return largeLocks; } private  OrchestratorContext(OrchestratorContext parentOrNull,
                                Clock clock,
                                TimeBudget timeBudget,
                                boolean probe,
                                boolean largeLocks,
                                boolean usePermanentlyDownStatus); static OrchestratorContext createContextForMultiAppOp(Clock clock); static OrchestratorContext createContextForSingleAppOp(Clock clock); static OrchestratorContext createContextForSingleAppOp(Clock clock, boolean usePermanentlyDownStatus); static OrchestratorContext createContextForAdminOp(Clock clock); Duration getTimeLeft(); ClusterControllerClientTimeouts getClusterControllerTimeouts(); boolean isProbe(); boolean largeLocks(); boolean usePermanentlyDownStatus(); boolean hasLock(ApplicationInstanceReference application); boolean registerLockAcquisition(ApplicationInstanceReference application, Runnable unlock); OrchestratorContext createSubcontextWithinLock(); OrchestratorContext createSubcontextForSingleAppOp(boolean probe); @Override void close();  }
@Test public void testLargeLocks() { var mutable = new Object() { boolean locked = true; }; Runnable unlock = () -> mutable.locked = false; try (OrchestratorContext rootContext = OrchestratorContext.createContextForMultiAppOp(new ManualClock())) { try (OrchestratorContext probeContext = rootContext.createSubcontextForSingleAppOp(true)) { assertFalse(probeContext.hasLock(application)); assertTrue(probeContext.registerLockAcquisition(application, unlock)); assertTrue(probeContext.hasLock(application)); assertTrue(mutable.locked); } try (OrchestratorContext nonProbeContext = rootContext.createSubcontextForSingleAppOp(false)) { assertTrue(nonProbeContext.hasLock(application)); assertTrue(mutable.locked); } assertTrue(mutable.locked); } assertFalse(mutable.locked); }