Code example for BlockingQueue

Methods: containsoffer

	private static final BlockingQueue<File> collection = new LinkedBlockingQueue<File>(10);
	public synchronized static Maybe<File> reserve(final File outputFile) {"Reserving file '{}'.", outputFile.getName());
		if (!collection.contains(outputFile) && collection.offer(outputFile)) {
			log.debug("Reserved file '{}'.", outputFile.getName());
			return Maybe.just(outputFile);
		log.debug("File '{}' is still reserved.", outputFile.getName());
		return Maybe.nothing(); 
	public static boolean release(final File inputFile) {
		return collection.remove(inputFile);
	public synchronized static int numberOfReservedFiles() { 
		return collection.size();
Connect your IDE to all the code out there  Get Codota for Java