{@inheritDoc}

@throws CouldNotPerformException {@inheritDoc}
@throws InterruptedException     {@inheritDoc}
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);
        }
    }
183340
@Override
    public boolean contains(final ENTRY entry) throws CouldNotPerformException {
        if (entry == null) {
            throw new NotAvailableException("entry");
        }
        return contains(entry.getId());
    }
1310718
@Override
    public void waitForAvailabilityState(final AvailabilityState.State availabilityState) throws InterruptedException {
        synchronized (controllerAvailabilityMonitor) {
            while (!Thread.currentThread().isInterrupted()) {
                if (this.availabilityState.equals(availabilityState)) {
                    return;
                }
                controllerAvailabilityMonitor.wait();
            }
        }
    }
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);
        }

    }
788087
protected boolean handlePausedFlow(Execution execution) throws InterruptedException {
        String branchId = execution.getSystemContext().getBranchId();
        PauseReason reason = findPauseReason(execution.getExecutionId(), branchId);
        if (reason != null) { // need to pause the execution
            pauseFlow(reason, execution);
            return true;
        }
        return false;
    }
455423
@Override
    public T take(final WaitStrategy.Takeable<T> t) throws InterruptedException {
        T result;

        while ((result = t.take()) == null) {
            LockSupport.parkNanos(1l);
        }

        return result;
    }
244327
@Override
    public void activate() throws InterruptedException, CouldNotPerformException {
        synchronized (maintainerLock) {

            // Duplicated activation filter.
            if (isActive()) {
                return;
            }

            try {
                verifyMaintainability();
                validateInitialization();
                setConnectionState(CONNECTING);
                remoteServerWatchDog.activate();
                listenerWatchDog.activate();
            } catch (CouldNotPerformException ex) {
                throw new InvalidStateException("Could not activate remote service!", ex);
            }
        }
    }
403126
@Override
    public void waitForValue(final long timeout, final TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException {
        synchronized (VALUE_LOCK) {
            if (value != null) {
                return;
            }
            // if 0 wait forever like the default java wait() implementation.
            if (timeUnit.toMillis(timeout) == 0) {
                VALUE_LOCK.wait();
            } else {
                timeUnit.timedWait(VALUE_LOCK, timeout);
            }
            if (value == null) {
                throw new NotAvailableException(Observable.class, new TimeoutException());
            }
        }

        //waitUntilNotificationIsFinished();
    }
679896
@Override
    public CONFIG applyConfigUpdate(final CONFIG config) throws CouldNotPerformException, InterruptedException {
        synchronized (CONFIG_LOCK) {
            try {
                this.config = config;
                configObservable.notifyObservers(config);

                // detect scope change if instance is already active and reinit if needed.
                try {
                    if (isActive() && !currentScope.equals(detectScope(config))) {
                        currentScope = detectScope();
                        reinit(currentScope);
                    }
                } catch (CouldNotPerformException ex) {
                    throw new CouldNotPerformException("Could not verify scope changes!", ex);
                }

                try {
                    notifyConfigUpdate(config);
                } catch (CouldNotPerformException ex) {
                    ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify config update!", ex), logger);
                }
                return this.config;
            } catch (CouldNotPerformException ex) {
                throw new CouldNotPerformException("Could not apply config update!", ex);
            }
        }
    }
329445
public void updateEnabled(boolean interrupted) {
        for (int i = 0; i != interruptOnlyItems.size(); ++i) {
            JMenuItem item = interruptOnlyItems.get(i);
            item.setEnabled(interrupted);
        }

        for (int i = 0; i != runOnlyItems.size(); ++i) {
            JMenuItem item = runOnlyItems.get(i);
            item.setEnabled(!interrupted);
        }
    }
739490
private int externalInterruptibleAwaitDone() throws InterruptedException {
    int s;
    if (Thread.interrupted())
      throw new InterruptedException();
    if ((s = status) >= 0 && (s = ((this instanceof CountedCompleter)
        ? ForkJoinPool.common.externalHelpComplete((CountedCompleter<?>) this, 0)
        : ForkJoinPool.common.tryExternalUnpush(this) ? doExec() : 0)) >= 0) {
      while ((s = status) >= 0) {
        if (U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
          synchronized (this) {
            if (status >= 0)
              wait(0L);
            else
              notifyAll();
          }
        }
      }
    }
    return s;
  }
684808
public void awaitTermination() throws InterruptedException {
      lock.lock();
      try {
         while (!isDone) {
            done.await();
         }
      } finally {
         isDone = false;
         lock.unlock();
      }
   }
1164447
public void removeDependency(final Registry registry) throws CouldNotPerformException {
        if (registry == null) {
            throw new NotAvailableException("registry");
        }
        registryLock.writeLock().lock();
        try {
            dependingRegistryMapLock.writeLock().lock();
            try {
                if (!dependingRegistryMap.containsKey(registry)) {
                    logger.warn("Could not remove a dependency which was never registered!");
                    return;
                }
                dependingRegistryMap.remove(registry).shutdown();
            } finally {
                dependingRegistryMapLock.writeLock().unlock();
            }
        } finally {
            registryLock.writeLock().unlock();
        }
    }
943165
@Override
	public final T get() throws InterruptedException, ExecutionException {
		block(0);
		if (!isUnblocked()) throw new InterruptedException();
		if (hasError()) throw new ExecutionException(error);
		if (isCancelled()) throw new ExecutionException(cancel);
		return result;
	}
171
public void run(Context context) throws IOException, InterruptedException {
    setup(context);
    while (context.nextKeyValue()) {
      map(context.getCurrentKey(), context.getCurrentValue(), context);
    }
    cleanup(context);
  }
962618
public void execute(@Nonnull Runnable task, final ResourceActivity activity ) throws InterruptedException {
        final ResourceList resources = activity.getResourceList();
        _withLock(new NotReallyRoleSensitiveCallable<Void,InterruptedException>() {
            @Override
            public Void call() throws InterruptedException {
                while (inUse.isCollidingWith(resources)) {
                    // TODO revalidate the resource list after re-acquiring lock, for now we just let the build fail
                    _await();
                }

                // we have a go
                inProgress.add(activity);
                inUse = ResourceList.union(inUse, resources);
                return null;
            }
        });

        try {
            task.run();
        } finally {
           // TODO if AsynchronousExecution, do that later
            _withLock(new Runnable() {
                @Override
                public void run() {
                    inProgress.remove(activity);
                    inUse = ResourceList.union(resourceView);
                    _signalAll();
                }
            });
        }
    }
1223357
@Override
	public E take() throws InterruptedException {
		E e = queue.take();
		signalSizeReduced();
		return e;
	}