activemq-cpp-3.9.5
BlockingQueue.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_UTIL_CONCURRENT_BLOCKINGQUEUE_H_
19#define _DECAF_UTIL_CONCURRENT_BLOCKINGQUEUE_H_
20
21#include <decaf/util/Config.h>
23
26
27namespace decaf {
28namespace util {
29namespace concurrent {
30
163 template< typename E >
164 class BlockingQueue : public AbstractQueue<E> {
165 public:
166
167 virtual ~BlockingQueue() {
168 }
169
170 using Queue<E>::offer;
171 using Queue<E>::poll;
172
183 virtual void put(const E& value) = 0;
184
203 virtual bool offer(const E& e, long long timeout, const TimeUnit& unit) = 0;
204
212 virtual E take() = 0;
213
227 virtual bool poll(E& result, long long timeout, const TimeUnit& unit) = 0;
228
242 virtual int remainingCapacity() const = 0;
243
262 virtual int drainTo(Collection<E>& c) = 0;
263
284 virtual int drainTo(Collection<E>& c, int maxElements) = 0;
285
286 };
287
288}}}
289
290#endif /* _DECAF_UTIL_CONCURRENT_BLOCKINGQUEUE_H_ */
AbstractQueue()
Definition AbstractQueue.h:51
The root interface in the collection hierarchy.
Definition Collection.h:69
A kind of collection provides advanced operations than other basic collections, such as insertion,...
Definition Queue.h:55
A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...
Definition BlockingQueue.h:164
virtual int drainTo(Collection< E > &c, int maxElements)=0
Removes at most the given number of available elements from this queue and adds them to the given col...
virtual void put(const E &value)=0
Inserts the specified element into this queue, waiting if necessary for space to become available.
virtual bool offer(const E &e, long long timeout, const TimeUnit &unit)=0
Inserts the specified element into this queue, waiting up to the specified wait time if necessary for...
virtual ~BlockingQueue()
Definition BlockingQueue.h:167
virtual bool poll(E &result, long long timeout, const TimeUnit &unit)=0
Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for ...
virtual E take()=0
Retrieves and removes the head of this queue, waiting if necessary until an element becomes available...
virtual int drainTo(Collection< E > &c)=0
Removes all available elements from this queue and adds them to the given collection.
virtual int remainingCapacity() const =0
Returns the number of additional elements that this queue can ideally (in the absence of memory or re...
A TimeUnit represents time durations at a given unit of granularity and provides utility methods to c...
Definition TimeUnit.h:62
Definition AbstractExecutorService.h:28
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25