001/* 002 * (C) Copyright 2016 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 */ 017package org.nuxeo.ecm.platform.importer.queue.manager; 018 019import org.nuxeo.ecm.platform.importer.source.SourceNode; 020 021import java.util.concurrent.TimeUnit; 022 023/** 024 * This interface should be renamed into CompoundQueues or simply MultiQueues 025 * 026 * @since 8.3 027 */ 028public interface QueuesManager extends AutoCloseable { 029 030 /** 031 * Returns the number of queues. 032 */ 033 int count(); 034 035 /** 036 * Put a node into a queue. 037 * 038 */ 039 void put(int queue, SourceNode node) throws InterruptedException; 040 041 /** 042 * Get a node from a queue. 043 * 044 */ 045 SourceNode poll(int queue); 046 047 /** 048 * Get a node from a queue, with a timeout. 049 * 050 */ 051 SourceNode poll(int queue, long timeout, TimeUnit unit) throws InterruptedException; 052 053 /** 054 * Returns true if there is no element in the queue. 055 */ 056 boolean isEmpty(int queue); 057 058 /** 059 * Returns the number of elements in the queue. 060 */ 061 int size(int queue); 062 063}