You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2015/07/29 23:51:44 UTC
[1/2] activemq-cpp git commit: Formatting cleanup
Repository: activemq-cpp
Updated Branches:
refs/heads/master e858be510 -> d96e76169
Formatting cleanup
Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/32bad60f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/32bad60f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/32bad60f
Branch: refs/heads/master
Commit: 32bad60f5f08769f0ccdda37795a1f77f415987f
Parents: e858be5
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Jul 29 17:15:31 2015 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Jul 29 17:15:31 2015 -0400
----------------------------------------------------------------------
activemq-cpp/src/main/decaf/nio/Buffer.h | 12 +--
activemq-cpp/src/main/decaf/nio/ByteBuffer.h | 71 ++++++++-------
activemq-cpp/src/main/decaf/util/Date.h | 20 ++--
activemq-cpp/src/main/decaf/util/Deque.h | 22 ++---
activemq-cpp/src/main/decaf/util/List.h | 18 ++--
activemq-cpp/src/main/decaf/util/ListIterator.h | 4 +-
activemq-cpp/src/main/decaf/util/StlSet.h | 96 +++++++++-----------
7 files changed, 119 insertions(+), 124 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/32bad60f/activemq-cpp/src/main/decaf/nio/Buffer.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/nio/Buffer.h b/activemq-cpp/src/main/decaf/nio/Buffer.h
index 1863854..4c5df4f 100644
--- a/activemq-cpp/src/main/decaf/nio/Buffer.h
+++ b/activemq-cpp/src/main/decaf/nio/Buffer.h
@@ -21,8 +21,8 @@
#include <decaf/lang/exceptions/IllegalArgumentException.h>
#include <decaf/nio/InvalidMarkException.h>
-namespace decaf{
-namespace nio{
+namespace decaf {
+namespace nio {
/**
* A container for data of a specific primitive type.
@@ -133,8 +133,8 @@ namespace nio{
public:
- Buffer( int capactiy );
- Buffer( const Buffer& other );
+ Buffer(int capactiy);
+ Buffer(const Buffer& other);
virtual ~Buffer() {}
public:
@@ -164,7 +164,7 @@ namespace nio{
*
* @throws IllegalArgumentException if preconditions on the new pos don't hold.
*/
- virtual Buffer& position( int newPosition );
+ virtual Buffer& position(int newPosition);
/**
* @returns this buffers Limit
@@ -185,7 +185,7 @@ namespace nio{
*
* @throws IllegalArgumentException if preconditions on the new pos don't hold.
*/
- virtual Buffer& limit( int newLimit );
+ virtual Buffer& limit(int newLimit);
/**
* Sets this buffer's mark at its position.
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/32bad60f/activemq-cpp/src/main/decaf/nio/ByteBuffer.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/nio/ByteBuffer.h b/activemq-cpp/src/main/decaf/nio/ByteBuffer.h
index cb10e99..82c5d70 100644
--- a/activemq-cpp/src/main/decaf/nio/ByteBuffer.h
+++ b/activemq-cpp/src/main/decaf/nio/ByteBuffer.h
@@ -108,7 +108,7 @@ namespace nio{
*
* @throws IllegalArgumentException if capacity is negative.
*/
- ByteBuffer( int capacity );
+ ByteBuffer(int capacity);
public:
@@ -133,7 +133,7 @@ namespace nio{
* @throws BufferUnderflowException if there are fewer than length bytes remaining
* in this buffer
*/
- ByteBuffer& get( std::vector<unsigned char> buffer );
+ ByteBuffer& get(std::vector<unsigned char> buffer);
/**
* Relative bulk get method.
@@ -164,7 +164,7 @@ namespace nio{
* remaining in this buffer.
* @throws NullPointerException if the passed buffer is null.
*/
- ByteBuffer& get( unsigned char* buffer, int size, int offset, int length );
+ ByteBuffer& get(unsigned char* buffer, int size, int offset, int length);
/**
* This method transfers the bytes remaining in the given source buffer into
@@ -186,7 +186,7 @@ namespace nio{
* @throws IllegalArgumentException if the source buffer is this buffer
* @throws ReadOnlyBufferException if this buffer is read-only
*/
- ByteBuffer& put( ByteBuffer& src );
+ ByteBuffer& put(ByteBuffer& src);
/**
* This method transfers bytes into this buffer from the given source array.
@@ -215,7 +215,7 @@ namespace nio{
* @throws IndexOutOfBoundsException if the preconditions of size, offset, or length
* are not met.
*/
- ByteBuffer& put( const unsigned char* buffer, int size, int offset, int length );
+ ByteBuffer& put(const unsigned char* buffer, int size, int offset, int length);
/**
* This method transfers the entire content of the given source byte array into
@@ -229,7 +229,7 @@ namespace nio{
* @throws BufferOverflowException if there is insufficient space in this buffer.
* @throws ReadOnlyBufferException if this buffer is read-only.
*/
- ByteBuffer& put( std::vector<unsigned char>& buffer );
+ ByteBuffer& put(std::vector<unsigned char>& buffer);
public: // Abstract Methods
@@ -460,7 +460,7 @@ namespace nio{
* @throws IndexOutOfBoundsException if index is not smaller than the
* buffer's limit, or index is negative.
*/
- virtual unsigned char get( int index ) const = 0;
+ virtual unsigned char get(int index) const = 0;
/**
* Reads the next byte at this buffer's current position, and then increments
@@ -484,7 +484,7 @@ namespace nio{
* @throws IndexOutOfBoundsException if index is not smaller than the
* buffer's limit, or index is negative.
*/
- virtual char getChar( int index ) const = 0;
+ virtual char getChar(int index) const = 0;
/**
* Reads the next eight bytes at this buffer's current position, and then
@@ -508,7 +508,7 @@ namespace nio{
* @throws IndexOutOfBoundsException if index is not smaller than the
* buffer's limit, or index is negative.
*/
- virtual double getDouble( int index ) const = 0;
+ virtual double getDouble(int index) const = 0;
/**
* Reads the next four bytes at this buffer's current position, and then
@@ -532,7 +532,7 @@ namespace nio{
* @throws IndexOutOfBoundsException if there are not enough bytes
* remaining to fill the requested Data Type, or index is negative.
*/
- virtual float getFloat( int index ) const = 0;
+ virtual float getFloat(int index) const = 0;
/**
* Reads the next eight bytes at this buffer's current position, and then
@@ -556,7 +556,7 @@ namespace nio{
* @throws IndexOutOfBoundsException if there are not enough bytes
* remaining to fill the requested Data Type, or index is negative.
*/
- virtual long long getLong( int index ) const = 0;
+ virtual long long getLong(int index) const = 0;
/**
* Reads the next four bytes at this buffer's current position, and then
@@ -580,7 +580,7 @@ namespace nio{
* @throws IndexOutOfBoundsException if there are not enough bytes
* remaining to fill the requested Data Type, or index is negative.
*/
- virtual int getInt( int index ) const = 0;
+ virtual int getInt(int index) const = 0;
/**
* Reads the next two bytes at this buffer's current position, and then
@@ -604,7 +604,7 @@ namespace nio{
* @throws IndexOutOfBoundsException if there are not enough bytes
* remaining to fill the requested Data Type, or index is negative.
*/
- virtual short getShort( int index ) const = 0;
+ virtual short getShort(int index) const = 0;
/**
* Writes the given byte into this buffer at the current position, and then
@@ -618,7 +618,7 @@ namespace nio{
* smaller than its limit.
* @throws ReadOnlyBufferException if this buffer is read-only.
*/
- virtual ByteBuffer& put( unsigned char value ) = 0;
+ virtual ByteBuffer& put(unsigned char value) = 0;
/**
* Writes the given byte into this buffer at the given index.
@@ -632,7 +632,7 @@ namespace nio{
* minus the size of the type being written, or index is negative.
* @throw ReadOnlyBufferException if this buffer is read-only.
*/
- virtual ByteBuffer& put( int index, unsigned char value ) = 0;
+ virtual ByteBuffer& put(int index, unsigned char value) = 0;
/**
* Writes one byte containing the given value, into this buffer at the
@@ -647,7 +647,7 @@ namespace nio{
* in this buffer than the size of the data to be written
* @throw ReadOnlyBufferException if this buffer is read-only
*/
- virtual ByteBuffer& putChar( char value ) = 0;
+ virtual ByteBuffer& putChar(char value) = 0;
/**
* Writes one byte containing the given value, into this buffer at the
@@ -664,7 +664,7 @@ namespace nio{
* minus the size of the type being written, or index is negative.
* @throw ReadOnlyBufferException if this buffer is read-only
*/
- virtual ByteBuffer& putChar( int index, char value ) = 0;
+ virtual ByteBuffer& putChar(int index, char value) = 0;
/**
* Writes eight bytes containing the given value, into this buffer at the
@@ -679,7 +679,7 @@ namespace nio{
* in this buffer than the size of the data to be written
* @throw ReadOnlyBufferException if this buffer is read-only
*/
- virtual ByteBuffer& putDouble( double value ) = 0;
+ virtual ByteBuffer& putDouble(double value) = 0;
/**
* Writes eight bytes containing the given value, into this buffer at the
@@ -696,7 +696,7 @@ namespace nio{
* minus the size of the type being written, or index is negative.
* @throw ReadOnlyBufferException if this buffer is read-only.
*/
- virtual ByteBuffer& putDouble( int index, double value ) = 0;
+ virtual ByteBuffer& putDouble(int index, double value) = 0;
/**
* Writes four bytes containing the given value, into this buffer at the
@@ -711,7 +711,7 @@ namespace nio{
* in this buffer than the size of the data to be written.
* @throw ReadOnlyBufferException if this buffer is read-only.
*/
- virtual ByteBuffer& putFloat( float value ) = 0;
+ virtual ByteBuffer& putFloat(float value) = 0;
/**
* Writes four bytes containing the given value, into this buffer at the
@@ -728,7 +728,7 @@ namespace nio{
* minus the size of the type being written, or index is negative.
* @throw ReadOnlyBufferException if this buffer is read-only.
*/
- virtual ByteBuffer& putFloat( int index, float value ) = 0;
+ virtual ByteBuffer& putFloat(int index, float value) = 0;
/**
* Writes eight bytes containing the given value, into this buffer at the
@@ -743,7 +743,7 @@ namespace nio{
* in this buffer than the size of the data to be written.
* @throw ReadOnlyBufferException if this buffer is read-only.
*/
- virtual ByteBuffer& putLong( long long value ) = 0;
+ virtual ByteBuffer& putLong(long long value) = 0;
/**
* Writes eight bytes containing the given value, into this buffer at the
@@ -760,7 +760,7 @@ namespace nio{
* minus the size of the type being written, or index is negative.
* @throw ReadOnlyBufferException if this buffer is read-only.
*/
- virtual ByteBuffer& putLong( int index, long long value ) = 0;
+ virtual ByteBuffer& putLong(int index, long long value) = 0;
/**
* Writes four bytes containing the given value, into this buffer at the
@@ -775,7 +775,7 @@ namespace nio{
* in this buffer than the size of the data to be written
* @throw ReadOnlyBufferException if this buffer is read-only
*/
- virtual ByteBuffer& putInt( int value ) = 0;
+ virtual ByteBuffer& putInt(int value) = 0;
/**
* Writes four bytes containing the given value, into this buffer at the
@@ -792,7 +792,7 @@ namespace nio{
* minus the size of the type being written, or index is negative.
* @throw ReadOnlyBufferException if this buffer is read-only
*/
- virtual ByteBuffer& putInt( int index, int value ) = 0;
+ virtual ByteBuffer& putInt(int index, int value) = 0;
/**
* Writes two bytes containing the given value, into this buffer at the
@@ -807,7 +807,7 @@ namespace nio{
* in this buffer than the size of the data to be written.
* @throw ReadOnlyBufferException if this buffer is read-only.
*/
- virtual ByteBuffer& putShort( short value ) = 0;
+ virtual ByteBuffer& putShort(short value) = 0;
/**
* Writes two bytes containing the given value, into this buffer at the
@@ -824,7 +824,7 @@ namespace nio{
* minus the size of the type being written, or index is negative.
* @throw ReadOnlyBufferException if this buffer is read-only.
*/
- virtual ByteBuffer& putShort( int index, short value ) = 0;
+ virtual ByteBuffer& putShort(int index, short value) = 0;
/**
* Creates a new byte buffer whose content is a shared subsequence of this
@@ -841,27 +841,28 @@ namespace nio{
*/
virtual ByteBuffer* slice() const = 0;
- public: // Comparable
+ public:
+ // Comparable
/**
* {@inheritDoc}
*/
- virtual int compareTo( const ByteBuffer& value ) const;
+ virtual int compareTo(const ByteBuffer& value) const;
/**
* {@inheritDoc}
*/
- virtual bool equals( const ByteBuffer& value ) const;
+ virtual bool equals(const ByteBuffer& value) const;
/**
* {@inheritDoc}
*/
- virtual bool operator==( const ByteBuffer& value ) const;
+ virtual bool operator==(const ByteBuffer& value) const;
/**
* {@inheritDoc}
*/
- virtual bool operator<( const ByteBuffer& value ) const;
+ virtual bool operator<(const ByteBuffer& value) const;
public:
@@ -876,7 +877,7 @@ namespace nio{
*
* @throws IllegalArgumentException if capacity is negative.
*/
- static ByteBuffer* allocate( int capacity );
+ static ByteBuffer* allocate(int capacity);
/**
* Wraps the passed buffer with a new ByteBuffer.
@@ -902,7 +903,7 @@ namespace nio{
* @throws IndexOutOfBoundsException if the preconditions of size, offset, or length
* are not met.
*/
- static ByteBuffer* wrap( unsigned char* array, int size, int offset, int length );
+ static ByteBuffer* wrap(unsigned char* array, int size, int offset, int length);
/**
* Wraps the passed STL Byte Vector in a ByteBuffer.
@@ -919,7 +920,7 @@ namespace nio{
*
* @returns a new ByteBuffer that is backed by buffer, caller owns.
*/
- static ByteBuffer* wrap( std::vector<unsigned char>& buffer );
+ static ByteBuffer* wrap(std::vector<unsigned char>& buffer);
};
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/32bad60f/activemq-cpp/src/main/decaf/util/Date.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/util/Date.h b/activemq-cpp/src/main/decaf/util/Date.h
index a758f35..edb57b7 100644
--- a/activemq-cpp/src/main/decaf/util/Date.h
+++ b/activemq-cpp/src/main/decaf/util/Date.h
@@ -51,13 +51,13 @@ namespace util{
* Constructs the date with a given time value.
* @param milliseconds The time in milliseconds;
*/
- Date( long long milliseconds );
+ Date(long long milliseconds);
/**
* Copy constructor.
* @param source The Date instance to copy into this one.
*/
- Date( const Date& source );
+ Date(const Date& source);
/**
* Assigns the value of one Date object to another.
@@ -67,7 +67,7 @@ namespace util{
*
* @return reference to this object with the newly assigned value.
*/
- Date& operator= ( const Date& value );
+ Date& operator=(const Date& value);
virtual ~Date();
@@ -82,7 +82,7 @@ namespace util{
* @param milliseconds The underlying time value in
* milliseconds.
*/
- void setTime( long long milliseconds );
+ void setTime(long long milliseconds);
/**
* Determines whether or not this date falls after the
@@ -90,7 +90,7 @@ namespace util{
* @param when The date to compare
* @return true if this date falls after when.
*/
- bool after( const Date& when ) const;
+ bool after(const Date& when) const;
/**
* Determines whether or not this date falls before the
@@ -98,7 +98,7 @@ namespace util{
* @param when The date to compare
* @return true if this date falls before when.
*/
- bool before( const Date& when ) const;
+ bool before(const Date& when) const;
/**
* Converts this Date object to a String of the form:
@@ -125,13 +125,13 @@ namespace util{
public: // Comparable
- virtual int compareTo( const Date& value ) const;
+ virtual int compareTo(const Date& value) const;
- virtual bool equals( const Date& value ) const;
+ virtual bool equals(const Date& value) const;
- virtual bool operator==( const Date& value ) const;
+ virtual bool operator==(const Date& value) const;
- virtual bool operator<( const Date& value ) const;
+ virtual bool operator<(const Date& value) const;
};
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/32bad60f/activemq-cpp/src/main/decaf/util/Deque.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/util/Deque.h b/activemq-cpp/src/main/decaf/util/Deque.h
index 7e37776..c8b035e 100644
--- a/activemq-cpp/src/main/decaf/util/Deque.h
+++ b/activemq-cpp/src/main/decaf/util/Deque.h
@@ -59,7 +59,7 @@ namespace util {
* @throws IllegalArgumentException if some property of the specified element prevents it
* from being added to this deque.
*/
- virtual void addFirst( const E& element ) = 0;
+ virtual void addFirst(const E& element) = 0;
/**
* Inserts an element onto the end of the Deque if possible without violating
@@ -76,7 +76,7 @@ namespace util {
* @throws IllegalArgumentException if some property of the specified element prevents it
* from being added to this deque.
*/
- virtual void addLast( const E& element ) = 0;
+ virtual void addLast(const E& element) = 0;
/**
* This method attempts to insert the given element into the Deque at the front end.
@@ -93,7 +93,7 @@ namespace util {
* @throws IllegalArgumentException if some property of the specified element prevents it
* from being added to this deque.
*/
- virtual bool offerFirst( const E& element ) = 0;
+ virtual bool offerFirst(const E& element) = 0;
/**
* This method attempts to insert the given element into the Deque at the end. Unlike
@@ -110,7 +110,7 @@ namespace util {
* @throws IllegalArgumentException if some property of the specified element prevents it
* from being added to this deque.
*/
- virtual bool offerLast( const E& element ) = 0;
+ virtual bool offerLast(const E& element) = 0;
/**
* Removes the topmost element from the Deque and returns it. Unlike the pollFirst
@@ -140,7 +140,7 @@ namespace util {
*
* @returns true if an element was available to remove, false otherwise.
*/
- virtual bool pollFirst( E& element ) = 0;
+ virtual bool pollFirst(E& element) = 0;
/**
* Removes the last element from the Deque assigns it to the element reference passed.
@@ -150,7 +150,7 @@ namespace util {
*
* @returns true if an element was available to remove, false otherwise.
*/
- virtual bool pollLast( E& element ) = 0;
+ virtual bool pollLast(E& element) = 0;
/**
* Attempts to fetch a reference to the first element in the Deque. This method does
@@ -182,7 +182,7 @@ namespace util {
*
* @returns true if an element was assigned to the reference passed, false otherwise.
*/
- virtual bool peekFirst( E& value ) const = 0;
+ virtual bool peekFirst(E& value) const = 0;
/**
* Retrieves the last element contained in this Deque and assigns its value to the
@@ -192,7 +192,7 @@ namespace util {
*
* @returns true if an element was assigned to the reference passed, false otherwise.
*/
- virtual bool peekLast( E& value ) const = 0;
+ virtual bool peekLast(E& value) const = 0;
/**
* Removes the first occurrence of the specified element from this Deque. If there is no
@@ -206,7 +206,7 @@ namespace util {
* @throws NullPointerException if the specified element is NULL and this deque is a Collection
* of pointers and does not permit null elements.
*/
- virtual bool removeFirstOccurrence( const E& value ) = 0;
+ virtual bool removeFirstOccurrence(const E& value) = 0;
/**
* Removes the last occurrence of the specified element from this Deque. If there is no
@@ -220,7 +220,7 @@ namespace util {
* @throws NullPointerException if the specified element is NULL and this deque is a Collection
* of pointers and does not permit null elements.
*/
- virtual bool removeLastOccurrence( const E& value ) = 0;
+ virtual bool removeLastOccurrence(const E& value) = 0;
/**
* Pushes an element onto the stack represented by this deque (in other words, at the head
@@ -239,7 +239,7 @@ namespace util {
* @throws IllegalArgumentException if some property of the specified element prevents it
* from being added to this deque.
*/
- virtual void push( const E& element ) = 0;
+ virtual void push(const E& element) = 0;
/**
* Treats this Deque as a stack and attempts to pop an element off the top. If there's no
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/32bad60f/activemq-cpp/src/main/decaf/util/List.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/util/List.h b/activemq-cpp/src/main/decaf/util/List.h
index 951b49b..ee77afd 100644
--- a/activemq-cpp/src/main/decaf/util/List.h
+++ b/activemq-cpp/src/main/decaf/util/List.h
@@ -77,8 +77,8 @@ namespace util{
* @throws IndexOutOfBoundsException if the index is out of range
* (index < 0 || index > size())
*/
- virtual ListIterator<E>* listIterator( int index ) = 0;
- virtual ListIterator<E>* listIterator( int index ) const = 0;
+ virtual ListIterator<E>* listIterator(int index) = 0;
+ virtual ListIterator<E>* listIterator(int index) const = 0;
/**
* Returns the index of the first occurrence of the specified element in
@@ -94,7 +94,7 @@ namespace util{
* @throws NullPointerException if the Collection is a container of pointers
* and does not allow NULL values.
*/
- virtual int indexOf( const E& value ) const = 0;
+ virtual int indexOf(const E& value) const = 0;
/**
* Returns the index of the last occurrence of the specified element in
@@ -110,7 +110,7 @@ namespace util{
* @throws NullPointerException if the Collection is a container of pointers
* and does not allow NULL values.
*/
- virtual int lastIndexOf( const E& value ) const = 0;
+ virtual int lastIndexOf(const E& value) const = 0;
/**
* Gets the element contained at position passed.
@@ -123,7 +123,7 @@ namespace util{
* @throws IndexOutOfBoundsException if the index given is less than zero
* or greater than the List size.
*/
- virtual E get( int index ) const = 0;
+ virtual E get(int index) const = 0;
/**
* Replaces the element at the specified position in this list with the
@@ -146,7 +146,7 @@ namespace util{
* @throws IllegalStateException if the element cannot be added at this time due
* to insertion restrictions.
*/
- virtual E set( int index, const E& element ) = 0;
+ virtual E set(int index, const E& element) = 0;
/**
* Inserts the specified element at the specified position in this list.
@@ -167,7 +167,7 @@ namespace util{
* @throws IllegalStateException if the element cannot be added at this time due
* to insertion restrictions.
*/
- virtual void add( int index, const E& element ) = 0;
+ virtual void add(int index, const E& element) = 0;
/**
* Inserts all of the elements in the specified collection into this list at
@@ -196,7 +196,7 @@ namespace util{
* @throws IllegalStateException if the element cannot be added at this time due
* to insertion restrictions.
*/
- virtual bool addAll( int index, const Collection<E>& source ) = 0;
+ virtual bool addAll(int index, const Collection<E>& source) = 0;
/**
* Removes the element at the specified position in this list.
@@ -211,7 +211,7 @@ namespace util{
* or greater than the List size.
* @throws UnsupportedOperationExceptio if this is an unmodifiable collection.
*/
- virtual E removeAt( int index ) = 0;
+ virtual E removeAt(int index) = 0;
};
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/32bad60f/activemq-cpp/src/main/decaf/util/ListIterator.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/util/ListIterator.h b/activemq-cpp/src/main/decaf/util/ListIterator.h
index b144324..04ee118 100644
--- a/activemq-cpp/src/main/decaf/util/ListIterator.h
+++ b/activemq-cpp/src/main/decaf/util/ListIterator.h
@@ -59,7 +59,7 @@ namespace util{
* @throw IllegalArgumentException if some aspect of this element
* prevents it from being added to this list.
*/
- virtual void add( const E& e ) = 0;
+ virtual void add(const E& e) = 0;
/**
* Replaces the last element returned by next or previous with the
@@ -79,7 +79,7 @@ namespace util{
* called, or remove or add have been called after the last call to next
* or previous.
*/
- virtual void set( const E& e ) = 0;
+ virtual void set(const E& e) = 0;
/**
* Returns true if this list iterator has more elements when traversing the
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/32bad60f/activemq-cpp/src/main/decaf/util/StlSet.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/util/StlSet.h b/activemq-cpp/src/main/decaf/util/StlSet.h
index ae5a028..62f844b 100644
--- a/activemq-cpp/src/main/decaf/util/StlSet.h
+++ b/activemq-cpp/src/main/decaf/util/StlSet.h
@@ -27,8 +27,8 @@
#include <decaf/util/Iterator.h>
#include <decaf/util/AbstractSet.h>
-namespace decaf{
-namespace util{
+namespace decaf {
+namespace util {
/**
* Set template that wraps around a std::set to provide
@@ -52,40 +52,38 @@ namespace util{
private:
- SetIterator( const SetIterator& );
- SetIterator operator= ( const SetIterator& );
+ SetIterator(const SetIterator&);
+ SetIterator operator=(const SetIterator&);
public:
- SetIterator( typename std::set<E>* set ) :
- Iterator<E>(), current( set->begin() ), previous( set->begin() ), set( set ) {
+ SetIterator(typename std::set<E>* set) :
+ Iterator<E>(), current(set->begin()), previous(set->begin()), set(set) {
}
virtual ~SetIterator() {}
virtual E next() {
- if( this->current == set->end() ) {
+ if (this->current == set->end()) {
throw NoSuchElementException(
- __FILE__, __LINE__,
- "Set::Iterator::next - No more elements to return" );
+ __FILE__, __LINE__, "Set::Iterator::next - No more elements to return");
}
this->previous = this->current;
- return *( this->current++ );
+ return *(this->current++);
}
virtual bool hasNext() const {
- return ( this->current != set->end() );
+ return (this->current != set->end());
}
virtual void remove() {
- if( this->previous == set->end() ) {
+ if (this->previous == set->end()) {
throw lang::exceptions::IllegalStateException(
- __FILE__, __LINE__,
- "Set::Iterator::remove - Invalid State to call remove" );
+ __FILE__, __LINE__, "Set::Iterator::remove - Invalid State to call remove");
}
- this->set->erase( this->previous );
+ this->set->erase(this->previous);
this->previous = this->set->end();
}
};
@@ -99,36 +97,34 @@ namespace util{
private:
- ConstSetIterator( const ConstSetIterator& );
- ConstSetIterator operator= ( const ConstSetIterator& );
+ ConstSetIterator(const ConstSetIterator&);
+ ConstSetIterator operator=(const ConstSetIterator&);
public:
- ConstSetIterator( const typename std::set<E>* set ) :
- Iterator<E>(), current( set->begin() ), previous( set->begin() ), set( set ) {
+ ConstSetIterator(const typename std::set<E>* set) :
+ Iterator<E>(), current(set->begin()), previous(set->begin()), set(set) {
}
virtual ~ConstSetIterator() {}
virtual E next() {
- if( this->current == set->end() ) {
+ if (this->current == set->end()) {
throw NoSuchElementException(
- __FILE__, __LINE__,
- "Set::Iterator::next - No more elements to return" );
+ __FILE__, __LINE__, "Set::Iterator::next - No more elements to return");
}
this->previous = this->current;
- return *( this->current++ );
+ return *(this->current++);
}
virtual bool hasNext() const {
- return ( this->current != set->end() );
+ return (this->current != set->end());
}
virtual void remove() {
throw lang::exceptions::UnsupportedOperationException(
- __FILE__, __LINE__,
- "Set::Iterator::remove - Not Valid on a Const Iterator" );
+ __FILE__, __LINE__, "Set::Iterator::remove - Not Valid on a Const Iterator");
}
};
@@ -140,21 +136,19 @@ namespace util{
StlSet() : AbstractSet<E>(), values() {}
/**
- * Copy constructor - copies the content of the given set into this
- * one.
+ * Copy constructor - copies the content of the given set into this one.
* @param source The source set.
*/
- StlSet( const StlSet& source ) : AbstractSet<E>(), values() {
- copy( source );
+ StlSet(const StlSet& source) : AbstractSet<E>(), values() {
+ copy(source);
}
/**
- * Copy constructor - copies the content of the given set into this
- * one.
+ * Copy constructor - copies the content of the given set into this one.
* @param source The source set.
*/
- StlSet( const Collection<E>& source ) : AbstractSet<E>(), values() {
- AbstractSet<E>::copy( source );
+ StlSet(const Collection<E>& source) : AbstractSet<E>(), values() {
+ AbstractSet<E>::copy(source);
}
virtual ~StlSet() {}
@@ -163,20 +157,20 @@ namespace util{
* {@inheritDoc}
*/
Iterator<E>* iterator() {
- return new SetIterator( &values );
+ return new SetIterator(&values);
}
Iterator<E>* iterator() const {
- return new ConstSetIterator( &values );
+ return new ConstSetIterator(&values);
}
/**
* {@inheritDoc}
*/
- virtual bool equals( const Collection<E>& collection ) const {
+ virtual bool equals(const Collection<E>& collection) const {
- const StlSet<E>* setptr = dynamic_cast<const StlSet<E>*>( &collection );
- if( setptr == NULL ) {
- return AbstractSet<E>::equals( collection );
+ const StlSet<E>* setptr = dynamic_cast<const StlSet<E>*>(&collection);
+ if (setptr == NULL) {
+ return AbstractSet<E>::equals(collection);
}
return this->values == setptr->values;
@@ -185,11 +179,11 @@ namespace util{
/**
* {@inheritDoc}
*/
- virtual void copy( const Collection<E>& collection ) {
+ virtual void copy(const Collection<E>& collection) {
- const StlSet<E>* setptr = dynamic_cast<const StlSet<E>*>( &collection );
- if( setptr == NULL ) {
- AbstractSet<E>::copy( collection );
+ const StlSet<E>* setptr = dynamic_cast<const StlSet<E>*>(&collection);
+ if (setptr == NULL) {
+ AbstractSet<E>::copy(collection);
return;
}
@@ -207,9 +201,9 @@ namespace util{
/**
* {@inheritDoc}
*/
- virtual bool contains( const E& value ) const {
+ virtual bool contains(const E& value) const {
typename std::set<E>::const_iterator iter;
- iter = values.find( value );
+ iter = values.find(value);
return iter != values.end();
}
@@ -224,21 +218,21 @@ namespace util{
* @return The number of elements in this set.
*/
virtual int size() const {
- return (int)values.size();
+ return (int) values.size();
}
/**
* {@inheritDoc}
*/
- virtual bool add( const E& value ) {
- return values.insert( value ).second;
+ virtual bool add(const E& value) {
+ return values.insert(value).second;
}
/**
* {@inheritDoc}
*/
- virtual bool remove( const E& value ) {
- return values.erase( value ) != 0;
+ virtual bool remove(const E& value) {
+ return values.erase(value) != 0;
}
};
[2/2] activemq-cpp git commit:
https://issues.apache.org/jira/browse/AMQCPP-532
Posted by ta...@apache.org.
https://issues.apache.org/jira/browse/AMQCPP-532
Add some additional safety measures to try and prevent message available
callback while destroying a browser object.
Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/d96e7616
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/d96e7616
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/d96e7616
Branch: refs/heads/master
Commit: d96e76169265269ad2a52041ec5c1a41549d3299
Parents: 32bad60
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Jul 29 17:51:09 2015 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Jul 29 17:51:09 2015 -0400
----------------------------------------------------------------------
.../main/activemq/core/ActiveMQQueueBrowser.cpp | 53 +++++++++-----------
.../main/activemq/core/ActiveMQQueueBrowser.h | 2 +-
.../test/openwire/OpenwireQueueBrowserTest.h | 2 +-
3 files changed, 27 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/d96e7616/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp b/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp
index 837db95..c4fe43a 100644
--- a/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp
+++ b/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.cpp
@@ -63,13 +63,15 @@ namespace core{
const std::string& name, const std::string& selector,
int prefetch, int maxPendingMessageCount, bool noLocal,
bool browser, bool dispatchAsync,
- cms::MessageListener* listener ) :
+ cms::MessageListener* listener) :
ActiveMQConsumerKernel(session, id, destination, name, selector, prefetch,
maxPendingMessageCount, noLocal, browser, dispatchAsync,
listener), parent(parent) {
}
+ virtual ~Browser() {}
+
virtual void dispatch(const Pointer<MessageDispatch>& dispatched) {
try{
@@ -82,9 +84,9 @@ namespace core{
this->parent->notifyMessageAvailable();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_RETHROW(ActiveMQException)
+ AMQ_CATCH_EXCEPTION_CONVERT(Exception, ActiveMQException)
+ AMQ_CATCHALL_THROW(ActiveMQException)
}
};
}}
@@ -94,19 +96,19 @@ ActiveMQQueueBrowser::ActiveMQQueueBrowser(ActiveMQSessionKernel* session,
const Pointer<commands::ConsumerId>& consumerId,
const Pointer<commands::ActiveMQDestination>& destination,
const std::string& selector,
- bool dispatchAsync ) : cms::QueueBrowser(),
- cms::MessageEnumeration(),
- session(session),
- consumerId(consumerId),
- destination(destination),
- selector(selector),
- dispatchAsync(dispatchAsync),
- queue(NULL),
- closed(false),
- mutex(),
- wait(),
- browseDone(),
- browser(NULL) {
+ bool dispatchAsync) : cms::QueueBrowser(),
+ cms::MessageEnumeration(),
+ session(session),
+ consumerId(consumerId),
+ destination(destination),
+ selector(selector),
+ dispatchAsync(dispatchAsync),
+ queue(NULL),
+ closed(false),
+ mutex(),
+ wait(),
+ browseDone(),
+ browser(NULL) {
if (session == NULL) {
throw ActiveMQException(__FILE__, __LINE__, "Session instance provided was NULL.");
@@ -122,7 +124,6 @@ ActiveMQQueueBrowser::ActiveMQQueueBrowser(ActiveMQSessionKernel* session,
// Cache the Queue instance for faster retreival.
this->queue = destination.dynamicCast<cms::Queue>().get();
- this->closed = false;
}
////////////////////////////////////////////////////////////////////////////////
@@ -159,14 +160,10 @@ cms::MessageEnumeration* ActiveMQQueueBrowser::getEnumeration() {
////////////////////////////////////////////////////////////////////////////////
void ActiveMQQueueBrowser::close() {
try {
-
- if (this->closed) {
- return;
- }
-
- synchronized(&mutex) {
- destroyConsumer();
- this->closed = true;
+ if (closed.compareAndSet(false, true)) {
+ synchronized(&mutex) {
+ destroyConsumer();
+ }
}
}
AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
@@ -237,7 +234,6 @@ cms::Message* ActiveMQQueueBrowser::nextMessage() {
////////////////////////////////////////////////////////////////////////////////
void ActiveMQQueueBrowser::notifyMessageAvailable() {
-
synchronized(&wait) {
wait.notifyAll();
}
@@ -287,6 +283,7 @@ void ActiveMQQueueBrowser::destroyConsumer() {
session->commit();
}
+ this->browser->stop();
this->browser->close();
this->browser.reset(NULL);
}
@@ -295,7 +292,7 @@ void ActiveMQQueueBrowser::destroyConsumer() {
////////////////////////////////////////////////////////////////////////////////
void ActiveMQQueueBrowser::checkClosed() {
- if (closed) {
+ if (closed.get()) {
throw ActiveMQException(__FILE__, __LINE__, "The QueueBrowser is closed.");
}
}
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/d96e7616/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.h b/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.h
index e964766..3b5ed07 100644
--- a/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.h
+++ b/activemq-cpp/src/main/activemq/core/ActiveMQQueueBrowser.h
@@ -55,7 +55,7 @@ namespace kernels {
std::string selector;
bool dispatchAsync;
cms::Queue* queue;
- volatile bool closed;
+ decaf::util::concurrent::atomic::AtomicBoolean closed;
mutable decaf::util::concurrent::Mutex mutex;
mutable decaf::util::concurrent::Mutex wait;
http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/d96e7616/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h
index 3cfc121..6a4a050 100644
--- a/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h
+++ b/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireQueueBrowserTest.h
@@ -32,7 +32,7 @@ namespace openwire {
CPPUNIT_TEST( testBrowseReceive );
CPPUNIT_TEST( testQueueBrowserWith2Consumers );
CPPUNIT_TEST( testRepeatedQueueBrowserCreateDestroy );
- // TODO - CPPUNIT_TEST( testRepeatedQueueBrowserCreateDestroyWithMessageInQueue );
+ CPPUNIT_TEST( testRepeatedQueueBrowserCreateDestroyWithMessageInQueue );
CPPUNIT_TEST( testBrowsingExpirationIsIgnored );
CPPUNIT_TEST_SUITE_END();