Awaits until the internal state changes to PAUSING, and returns the reference
of current ControllerServiceStarter.
162926
@VisibleForTesting
    public ControllerServiceStarter awaitServicePausing() {
        monitor.enterWhenUninterruptibly(hasReachedPausing);
        try {
            if (serviceState != ServiceState.PAUSING) {
                throw new IllegalStateException("Expected state=" + ServiceState.PAUSING +
                        ", but actual state=" + serviceState);
            } else {
                return this.starter;
            }
        } finally {
            monitor.leave();
        }
    }
45553
def pause(self):
        """"""
        if self.state == STATE_PLAYING:
            self._player.set_state(Gst.State.PAUSED)
            self.state = STATE_PAUSED
1098015
public void pause() {
        checkState();
        if (mState == STATE_PLAYING) {
            PlaybackService.pause(getContext(), mClientKey);
            mState = STATE_PAUSED;
        }
    }
53225
def stop(self, timeout=None):
        
        assert self.state == STARTED, "Process not started"
        self.state = STOPPING
        # Allow every controller a chance to clean up
        self._run_hook(ProcessStopHook, timeout=timeout)
        for s in self._spawned:
            if not s.ready():
                self.log.debug(
                    "Waiting for %s *%s **%s", s._function, s._args, s._kwargs)
            s.wait(timeout=timeout)
        self._spawned = []
        self._controllers = OrderedDict()
        self._unpublished = set()
        self.state = STOPPED
        self.log.debug("Done process.stop()")
684808
public void awaitTermination() throws InterruptedException {
      lock.lock();
      try {
         while (!isDone) {
            done.await();
         }
      } finally {
         isDone = false;
         lock.unlock();
      }
   }
1049689
public void resume() {
    CountDownLatch latch = suspension.getAndSet(null);
    if (latch != null) {
      suspendBarrier.reset();
      latch.countDown();
    }
  }
1049352
private void waitForAsyncSendsResolution() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "waitForAsyncSendsResolution");

        //AsyncSend is only for non-managed environments.. no need to wait for managed environment
        if (!isManaged()) {

            synchronized (_inProgressAysncSends) {
                while (_inProgressAysncSends.get() > 0L) {
                    try {
                        //wait for 20 seconds.. and again check for condition..if no notification comes before then.
                        _inProgressAysncSends.wait(1000 * 20);
                    } catch (InterruptedException e) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                            SibTr.debug(tc, "waitForAsyncSendsResolution got interrupted", e);
                    }
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "waitForAsyncSendsResolution");
    }
786426
public void pause() {
        switch (status) {
            case PAUSED:
            case STOPPED:
                return;

            case PLAYING:
                status = Status.PAUSED;

                // Remove all callbacks
                slideHandler.removeCallbacksAndMessages(null);
        }
    }
181067
@Override
    public void waitForData() throws CouldNotPerformException, InterruptedException {
        try {
            if (isDataAvailable()) {
                return;
            }
            logger.debug("Wait for " + this.toString() + " data...");
            getDataFuture().get();
            dataObservable.waitForValue();
        } catch (ExecutionException | CancellationException ex) {
            if (shutdownInitiated) {
                throw new InterruptedException("Interrupt request because system shutdown was initiated!");
            }
            throw new CouldNotPerformException("Could not wait for data!", ex);
        }
    }
1133039
protected final void waitForCheckpoint(boolean persistent)
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "waitForCheckpoint");

        checkpointHelper.waitForCheckpoint(persistent);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "waitForCheckpoint",
                       "persistent=" + persistent + "(boolean)");
    }
771922
@Override
    public void pause() throws PauseableComponentException {
        try {
            if (ivState == ACTIVE_STATE) {
                deactivateEndpoint();
            } else if (ivState == INACTIVE_STATE) {
                Tr.info(tc, "MDB_ENDPOINT_ALREADY_INACTIVE_CNTR4117I", beanMetaData.enterpriseBeanName, beanMetaData.getModuleMetaData().getName(),
                        beanMetaData.getModuleMetaData().getApplicationMetaData().getName());
            } else {
                throw new PauseableComponentException(Tr.formatMessage(tc, "MDB_ENDPOINT_DID_NOT_PAUSE_CNTR4119W", beanMetaData.enterpriseBeanName,
                                                                       beanMetaData.getModuleMetaData().getName(),
                                                                       beanMetaData.getModuleMetaData().getApplicationMetaData().getName()));
            }
        } catch (ResourceException re) {
            throw new PauseableComponentException(re);
        }

    }
1144209
boolean awaitState(final InternalState expected) {
        synchronized (this) {
            final InternalState initialRequired = this.requiredState;
            for(;;) {
                final InternalState required = this.requiredState;
                // Stop in case the server failed to reach the state
                if(required == InternalState.FAILED) {
                    return false;
                // Stop in case the required state changed
                } else if (initialRequired != required) {
                    return false;
                }
                final InternalState current = this.internalState;
                if(expected == current) {
                    return true;
                }
                try {
                    wait();
                } catch(InterruptedException e) {
                    Thread.currentThread().interrupt();
                    return false;
                }
            }
        }
    }
996377
def on_service_departure(self, svc_ref):
        
        with self._lock:
            if svc_ref is self.reference:
                # Forget about the service
                self._value.unset_service()

                # Clear the reference
                self.reference = None

                # Look for a replacement
                self._pending_ref = self._context.get_service_reference(
                    self.requirement.specification, self.requirement.filter
                )

                if self._pending_ref is None:
                    # No replacement found yet, wait a little
                    self.__still_valid = True
                    self.__timer_args = (self._value, svc_ref)
                    self.__timer = threading.Timer(
                        self.__timeout, self.__unbind_call, (False,)
                    )
                    self.__timer.start()

                else:
                    # Notify iPOPO immediately
                    self._ipopo_instance.unbind(self, self._value, svc_ref)
                return True

            return None
402827
private Object waitingGet(boolean interruptible) {
        Signaller q = null;
        boolean queued = false;
        int spins = SPINS;
        Object r;
        while ((r = result) == null) {
            if (spins > 0) {
                if (ThreadLocalRandom.nextSecondarySeed() >= 0)
                    --spins;
            }
            else if (q == null)
                q = new Signaller(interruptible, 0L, 0L);
            else if (!queued)
                queued = tryPushStack(q);
            else {
                try {
                    ForkJoinPool.managedBlock(q);
                } catch (InterruptedException ie) { // currently cannot happen
                    q.interrupted = true;
                }
                if (q.interrupted && interruptible)
                    break;
            }
        }
        if (q != null) {
            q.thread = null;
            if (q.interrupted) {
                if (interruptible)
                    cleanStack();
                else
                    Thread.currentThread().interrupt();
            }
        }
        if (r != null)
            postComplete();
        return r;
    }
237423
def mark_pausing(self):
    
    with self._lock:
      self._set_state(self._PAUSING, self._RUNNING)
1040906
private void queueProcessable(final IEngineProcessable processableModel) {

        ensurePendingCapacity();

        final TemplateFlowController controller = this.flowController;

        this.pendingProcessings[this.pendingProcessingsSize] = processableModel;
        this.pendingProcessingsSize++;

        if (controller.stopProcessing) {
            controller.processorTemplateHandlerPending = true;
            return;
        }

        final boolean processed = this.pendingProcessings[this.pendingProcessingsSize - 1].process();
        if (!processed) {
            controller.processorTemplateHandlerPending = true;
            return;
        }
        this.pendingProcessingsSize--;

        controller.processorTemplateHandlerPending = false;

    }
1166689
@Override
	public void waitForEnabled(long time) throws WidgetException {
		waitForCommand(new ITimerCallback() {

			@Override
			public boolean execute() throws WidgetException {
				return isEnabled();
			}

			@Override
			public String toString() {
				return "Waiting for element with the locator: " + locator + " to be enabled.";
			}
		}, time);

	}