APISonar


java.util.ArrayList.wait

> java > util > ArrayList > wait
java APIs util APIs ArrayList APIs wait APIs

Example 1
private ArrayList<Result> docs;

	private void waitForDocs() {
		synchronized (docs) {
			while (pending > 0)
				try {
					docs.wait();
				} catch (InterruptedException e) {}
		}
	}
Example 2
private static ArrayList<Result> results;

	private static void waitForResults() {
		synchronized (results) {
			while (pending > 0)
				try {
					results.wait();
				} catch (InterruptedException e) {}
		}
	}
Example 3
private final ArrayList<ByteBuffer> mEmptyBuffers = new ArrayList<>();

    private ByteBuffer acquireEmptyBuffer() {
        synchronized (mEmptyBuffers) {
            // wait for an empty input buffer first
            while (!mInputEOS && mEmptyBuffers.isEmpty()) {
                try {
                    mEmptyBuffers.wait();
                } catch (InterruptedException e) {}
            }

            // if already EOS, return null to stop further encoding.
            return mInputEOS ? null : mEmptyBuffers.remove(0);
        }
    }