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 2012/10/18 17:35:24 UTC
svn commit: r1399699 [2/2] - in
/activemq/activemq-cpp/trunk/activemq-cpp/src/main: ./ activemq/core/
activemq/core/policies/ activemq/exceptions/ activemq/io/
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.cpp Thu Oct 18 15:35:22 2012
@@ -33,36 +33,36 @@ PrefetchPolicy::~PrefetchPolicy() {
}
////////////////////////////////////////////////////////////////////////////////
-void PrefetchPolicy::configure( const decaf::util::Properties& properties ) {
+void PrefetchPolicy::configure(const decaf::util::Properties& properties) {
- try{
+ try {
- if( properties.hasProperty( "cms.PrefetchPolicy.durableTopicPrefetch" ) ) {
- this->setDurableTopicPrefetch( Integer::parseInt(
- properties.getProperty( "cms.PrefetchPolicy.durableTopicPrefetch" ) ) );
+ if (properties.hasProperty("cms.PrefetchPolicy.durableTopicPrefetch")) {
+ this->setDurableTopicPrefetch(Integer::parseInt(
+ properties.getProperty("cms.PrefetchPolicy.durableTopicPrefetch")));
}
- if( properties.hasProperty( "cms.PrefetchPolicy.queueBrowserPrefetch" ) ) {
- this->setQueueBrowserPrefetch( Integer::parseInt(
- properties.getProperty( "cms.PrefetchPolicy.queueBrowserPrefetch" ) ) );
+ if (properties.hasProperty("cms.PrefetchPolicy.queueBrowserPrefetch")) {
+ this->setQueueBrowserPrefetch(Integer::parseInt(
+ properties.getProperty("cms.PrefetchPolicy.queueBrowserPrefetch")));
}
- if( properties.hasProperty( "cms.PrefetchPolicy.queuePrefetch" ) ) {
- this->setQueuePrefetch( Integer::parseInt(
- properties.getProperty( "cms.PrefetchPolicy.queuePrefetch" ) ) );
+ if (properties.hasProperty("cms.PrefetchPolicy.queuePrefetch")) {
+ this->setQueuePrefetch(Integer::parseInt(
+ properties.getProperty("cms.PrefetchPolicy.queuePrefetch")));
}
- if( properties.hasProperty( "cms.PrefetchPolicy.topicPrefetch" ) ) {
- this->setTopicPrefetch( Integer::parseInt(
- properties.getProperty( "cms.PrefetchPolicy.topicPrefetch" ) ) );
+ if (properties.hasProperty("cms.PrefetchPolicy.topicPrefetch")) {
+ this->setTopicPrefetch(Integer::parseInt(
+ properties.getProperty("cms.PrefetchPolicy.topicPrefetch")));
}
- if( properties.hasProperty( "cms.PrefetchPolicy.all" ) ) {
- int value = Integer::parseInt( properties.getProperty( "cms.PrefetchPolicy.all" ) );
+ if (properties.hasProperty("cms.PrefetchPolicy.all")) {
+ int value = Integer::parseInt(properties.getProperty("cms.PrefetchPolicy.all"));
- this->setDurableTopicPrefetch( value );
- this->setQueueBrowserPrefetch( value );
- this->setQueuePrefetch( value );
- this->setTopicPrefetch( value );
+ this->setDurableTopicPrefetch(value);
+ this->setQueueBrowserPrefetch(value);
+ this->setQueuePrefetch(value);
+ this->setTopicPrefetch(value);
}
}
- DECAF_CATCH_RETHROW( Exception )
- DECAF_CATCHALL_THROW( Exception )
+ DECAF_CATCH_RETHROW(Exception)
+ DECAF_CATCHALL_THROW(Exception)
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/PrefetchPolicy.h Thu Oct 18 15:35:22 2012
@@ -34,8 +34,8 @@ namespace core {
class AMQCPP_API PrefetchPolicy {
private:
- PrefetchPolicy( const PrefetchPolicy& );
- PrefetchPolicy& operator= ( const PrefetchPolicy& );
+ PrefetchPolicy(const PrefetchPolicy&);
+ PrefetchPolicy& operator=(const PrefetchPolicy&);
protected:
@@ -51,7 +51,7 @@ namespace core {
* @param value
* The number of messages to prefetch.
*/
- virtual void setDurableTopicPrefetch( int value ) = 0;
+ virtual void setDurableTopicPrefetch(int value) = 0;
/**
* Gets the amount of messages to prefetch for a Durable Topic.
@@ -66,7 +66,7 @@ namespace core {
* @param value
* The number of messages to prefetch.
*/
- virtual void setQueuePrefetch( int value ) = 0;
+ virtual void setQueuePrefetch(int value) = 0;
/**
* Gets the amount of messages to prefetch for a Queue.
@@ -81,7 +81,7 @@ namespace core {
* @param value
* The number of messages to prefetch.
*/
- virtual void setQueueBrowserPrefetch( int value ) = 0;
+ virtual void setQueueBrowserPrefetch(int value) = 0;
/**
* Gets the amount of messages to prefetch for a Queue Browser.
@@ -96,7 +96,7 @@ namespace core {
* @param value
* The number of messages to prefetch.
*/
- virtual void setTopicPrefetch( int value ) = 0;
+ virtual void setTopicPrefetch(int value) = 0;
/**
* Gets the amount of messages to prefetch for a Topic.
@@ -112,7 +112,7 @@ namespace core {
*
* @returns the allowable value for a prefetch limit, either requested or the max.
*/
- virtual int getMaxPrefetchLimit( int value ) const = 0;
+ virtual int getMaxPrefetchLimit(int value) const = 0;
/**
* Clone the Policy and return a new pointer to that clone.
@@ -137,7 +137,7 @@ namespace core {
* @throws NumberFormatException if a property that is numeric cannot be converted
* @throws IllegalArgumentException if a property can't be converted to the correct type.
*/
- virtual void configure( const decaf::util::Properties& properties );
+ virtual void configure(const decaf::util::Properties& properties);
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.cpp Thu Oct 18 15:35:22 2012
@@ -40,39 +40,39 @@ RedeliveryPolicy::~RedeliveryPolicy() {
}
////////////////////////////////////////////////////////////////////////////////
-void RedeliveryPolicy::configure( const decaf::util::Properties& properties ) {
+void RedeliveryPolicy::configure(const decaf::util::Properties& properties) {
- try{
+ try {
- if( properties.hasProperty( "cms.RedeliveryPolicy.backOffMultiplier" ) ) {
- this->setBackOffMultiplier( Double::parseDouble(
- properties.getProperty( "cms.RedeliveryPolicy.backOffMultiplier" ) ) );
- }
- if( properties.hasProperty( "cms.RedeliveryPolicy.collisionAvoidancePercent" ) ) {
- this->setCollisionAvoidancePercent( Short::parseShort(
- properties.getProperty( "cms.RedeliveryPolicy.collisionAvoidancePercent" ) ) );
- }
- if( properties.hasProperty( "cms.RedeliveryPolicy.initialRedeliveryDelay" ) ) {
- this->setInitialRedeliveryDelay( Long::parseLong(
- properties.getProperty( "cms.RedeliveryPolicy.initialRedeliveryDelay" ) ) );
- }
- if( properties.hasProperty( "cms.RedeliveryPolicy.redeliveryDelay" ) ) {
- this->setRedeliveryDelay( Long::parseLong(
- properties.getProperty( "cms.RedeliveryPolicy.redeliveryDelay" ) ) );
- }
- if( properties.hasProperty( "cms.RedeliveryPolicy.maximumRedeliveries" ) ) {
- this->setMaximumRedeliveries( Integer::parseInt(
- properties.getProperty( "cms.RedeliveryPolicy.maximumRedeliveries" ) ) );
- }
- if( properties.hasProperty( "cms.RedeliveryPolicy.useCollisionAvoidance" ) ) {
- this->setUseCollisionAvoidance( Boolean::parseBoolean(
- properties.getProperty( "cms.RedeliveryPolicy.useCollisionAvoidance" ) ) );
- }
- if( properties.hasProperty( "cms.RedeliveryPolicy.useExponentialBackOff" ) ) {
- this->setUseExponentialBackOff( Boolean::parseBoolean(
- properties.getProperty( "cms.RedeliveryPolicy.useExponentialBackOff" ) ) );
+ if (properties.hasProperty("cms.RedeliveryPolicy.backOffMultiplier")) {
+ this->setBackOffMultiplier(Double::parseDouble(
+ properties.getProperty("cms.RedeliveryPolicy.backOffMultiplier")));
+ }
+ if (properties.hasProperty("cms.RedeliveryPolicy.collisionAvoidancePercent")) {
+ this->setCollisionAvoidancePercent(Short::parseShort(
+ properties.getProperty("cms.RedeliveryPolicy.collisionAvoidancePercent")));
+ }
+ if (properties.hasProperty("cms.RedeliveryPolicy.initialRedeliveryDelay")) {
+ this->setInitialRedeliveryDelay(Long::parseLong(
+ properties.getProperty("cms.RedeliveryPolicy.initialRedeliveryDelay")));
+ }
+ if (properties.hasProperty("cms.RedeliveryPolicy.redeliveryDelay")) {
+ this->setRedeliveryDelay(Long::parseLong(
+ properties.getProperty("cms.RedeliveryPolicy.redeliveryDelay")));
+ }
+ if (properties.hasProperty("cms.RedeliveryPolicy.maximumRedeliveries")) {
+ this->setMaximumRedeliveries(Integer::parseInt(
+ properties.getProperty("cms.RedeliveryPolicy.maximumRedeliveries")));
+ }
+ if (properties.hasProperty("cms.RedeliveryPolicy.useCollisionAvoidance")) {
+ this->setUseCollisionAvoidance(Boolean::parseBoolean(
+ properties.getProperty("cms.RedeliveryPolicy.useCollisionAvoidance")));
+ }
+ if (properties.hasProperty("cms.RedeliveryPolicy.useExponentialBackOff")) {
+ this->setUseExponentialBackOff(Boolean::parseBoolean(
+ properties.getProperty("cms.RedeliveryPolicy.useExponentialBackOff")));
}
}
- DECAF_CATCH_RETHROW( Exception )
- DECAF_CATCHALL_THROW( Exception )
+ DECAF_CATCH_RETHROW(Exception)
+ DECAF_CATCHALL_THROW(Exception)
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/RedeliveryPolicy.h Thu Oct 18 15:35:22 2012
@@ -38,8 +38,8 @@ namespace core {
private:
- RedeliveryPolicy( const RedeliveryPolicy& );
- RedeliveryPolicy& operator= ( const RedeliveryPolicy& );
+ RedeliveryPolicy(const RedeliveryPolicy&);
+ RedeliveryPolicy& operator=(const RedeliveryPolicy&);
protected:
@@ -60,7 +60,7 @@ namespace core {
* @param value
* The new value for the back-off multiplier.
*/
- virtual void setBackOffMultiplier( double value ) = 0;
+ virtual void setBackOffMultiplier(double value) = 0;
/**
* @returns the currently set Collision Avoidance percentage.
@@ -71,7 +71,7 @@ namespace core {
* @param value
* The collision avoidance percentage setting.
*/
- virtual void setCollisionAvoidancePercent( short value ) = 0;
+ virtual void setCollisionAvoidancePercent(short value) = 0;
/**
* Gets the initial time that redelivery of messages is delayed.
@@ -86,7 +86,7 @@ namespace core {
* @param value
* Time in Milliseconds to wait before starting redelivery.
*/
- virtual void setInitialRedeliveryDelay( long long value ) = 0;
+ virtual void setInitialRedeliveryDelay(long long value) = 0;
/**
* Gets the time that redelivery of messages is delayed.
@@ -101,7 +101,7 @@ namespace core {
* @param value
* Time in Milliseconds to wait before the next redelivery.
*/
- virtual void setRedeliveryDelay( long long value ) = 0;
+ virtual void setRedeliveryDelay(long long value) = 0;
/**
* Gets the Maximum number of allowed redeliveries for a message before it will
@@ -117,7 +117,7 @@ namespace core {
* @param maximumRedeliveries
* The maximum number of times that a message will be redelivered.
*/
- virtual void setMaximumRedeliveries( int maximumRedeliveries ) = 0;
+ virtual void setMaximumRedeliveries(int maximumRedeliveries) = 0;
/**
* Given the last used redelivery delay calculate the next value of the delay
@@ -128,7 +128,7 @@ namespace core {
*
* @return the new delay to use before attempting another redelivery.
*/
- virtual long long getNextRedeliveryDelay( long long previousDelay ) = 0;
+ virtual long long getNextRedeliveryDelay(long long previousDelay) = 0;
/**
* @returns whether or not collision avoidance is enabled for this Policy.
@@ -139,7 +139,7 @@ namespace core {
* @param value
* Enable or Disable collision avoidance for this Policy.
*/
- virtual void setUseCollisionAvoidance( bool value ) = 0;
+ virtual void setUseCollisionAvoidance(bool value) = 0;
/**
* @returns whether or not the exponential back off option is enabled.
@@ -150,7 +150,7 @@ namespace core {
* @param value
* Enable or Disable the exponential back off multiplier option.
*/
- virtual void setUseExponentialBackOff( bool value ) = 0;
+ virtual void setUseExponentialBackOff(bool value) = 0;
/**
* Create a copy of this Policy and return it.
@@ -175,7 +175,7 @@ namespace core {
* @throws NumberFormatException if a property that is numeric cannot be converted
* @throws IllegalArgumentException if a property can't be converted to the correct type.
*/
- virtual void configure( const decaf::util::Properties& properties );
+ virtual void configure(const decaf::util::Properties& properties);
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp Thu Oct 18 15:35:22 2012
@@ -36,8 +36,7 @@ const int SimplePriorityMessageDispatchC
////////////////////////////////////////////////////////////////////////////////
SimplePriorityMessageDispatchChannel::SimplePriorityMessageDispatchChannel() :
- closed( false ), running( false ), mutex(), channels( MAX_PRIORITIES ), enqueued( 0 ) {
-
+ closed(false), running(false), mutex(), channels(MAX_PRIORITIES), enqueued(0) {
}
////////////////////////////////////////////////////////////////////////////////
@@ -45,18 +44,18 @@ SimplePriorityMessageDispatchChannel::~S
}
////////////////////////////////////////////////////////////////////////////////
-void SimplePriorityMessageDispatchChannel::enqueue( const Pointer<MessageDispatch>& message ) {
- synchronized( &mutex ) {
- this->getChannel( message ).addLast( message );
+void SimplePriorityMessageDispatchChannel::enqueue(const Pointer<MessageDispatch>& message) {
+ synchronized(&mutex) {
+ this->getChannel(message).addLast(message);
this->enqueued++;
mutex.notify();
}
}
////////////////////////////////////////////////////////////////////////////////
-void SimplePriorityMessageDispatchChannel::enqueueFirst( const Pointer<MessageDispatch>& message ) {
- synchronized( &mutex ) {
- this->getChannel( message ).addFirst( message );
+void SimplePriorityMessageDispatchChannel::enqueueFirst(const Pointer<MessageDispatch>& message) {
+ synchronized(&mutex) {
+ this->getChannel(message).addFirst(message);
this->enqueued++;
mutex.notify();
}
@@ -68,20 +67,20 @@ bool SimplePriorityMessageDispatchChanne
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<MessageDispatch> SimplePriorityMessageDispatchChannel::dequeue( long long timeout ) {
+Pointer<MessageDispatch> SimplePriorityMessageDispatchChannel::dequeue(long long timeout) {
- synchronized( &mutex ) {
+ synchronized(&mutex) {
// Wait until the channel is ready to deliver messages.
- while( timeout != 0 && !closed && ( isEmpty() || !running ) ) {
- if( timeout == -1 ) {
+ while (timeout != 0 && !closed && (isEmpty() || !running)) {
+ if (timeout == -1) {
mutex.wait();
} else {
- mutex.wait( (unsigned long)timeout );
+ mutex.wait((unsigned long) timeout);
break;
}
}
- if( closed || !running || isEmpty() ) {
+ if (closed || !running || isEmpty()) {
return Pointer<MessageDispatch>();
}
@@ -93,8 +92,8 @@ Pointer<MessageDispatch> SimplePriorityM
////////////////////////////////////////////////////////////////////////////////
Pointer<MessageDispatch> SimplePriorityMessageDispatchChannel::dequeueNoWait() {
- synchronized( &mutex ) {
- if( closed || !running || isEmpty() ) {
+ synchronized(&mutex) {
+ if (closed || !running || isEmpty()) {
return Pointer<MessageDispatch>();
}
return removeFirst();
@@ -105,8 +104,8 @@ Pointer<MessageDispatch> SimplePriorityM
////////////////////////////////////////////////////////////////////////////////
Pointer<MessageDispatch> SimplePriorityMessageDispatchChannel::peek() const {
- synchronized( &mutex ) {
- if( closed || !running || isEmpty() ) {
+ synchronized(&mutex) {
+ if (closed || !running || isEmpty()) {
return Pointer<MessageDispatch>();
}
return getFirst();
@@ -117,8 +116,8 @@ Pointer<MessageDispatch> SimplePriorityM
////////////////////////////////////////////////////////////////////////////////
void SimplePriorityMessageDispatchChannel::start() {
- synchronized( &mutex ) {
- if( !closed ) {
+ synchronized(&mutex) {
+ if (!closed) {
running = true;
mutex.notifyAll();
}
@@ -127,7 +126,7 @@ void SimplePriorityMessageDispatchChanne
////////////////////////////////////////////////////////////////////////////////
void SimplePriorityMessageDispatchChannel::stop() {
- synchronized( &mutex ) {
+ synchronized(&mutex) {
running = false;
mutex.notifyAll();
}
@@ -135,8 +134,8 @@ void SimplePriorityMessageDispatchChanne
////////////////////////////////////////////////////////////////////////////////
void SimplePriorityMessageDispatchChannel::close() {
- synchronized( &mutex ) {
- if( !closed ) {
+ synchronized(&mutex) {
+ if (!closed) {
running = false;
closed = true;
}
@@ -146,8 +145,8 @@ void SimplePriorityMessageDispatchChanne
////////////////////////////////////////////////////////////////////////////////
void SimplePriorityMessageDispatchChannel::clear() {
- synchronized( &mutex ) {
- for( int i = 0; i < MAX_PRIORITIES; i++ ) {
+ synchronized(&mutex) {
+ for (int i = 0; i < MAX_PRIORITIES; i++) {
this->channels[i].clear();
}
}
@@ -155,7 +154,7 @@ void SimplePriorityMessageDispatchChanne
////////////////////////////////////////////////////////////////////////////////
int SimplePriorityMessageDispatchChannel::size() const {
- synchronized( &mutex ) {
+ synchronized(&mutex) {
return this->enqueued;
}
@@ -163,14 +162,14 @@ int SimplePriorityMessageDispatchChannel
}
////////////////////////////////////////////////////////////////////////////////
-std::vector< Pointer<MessageDispatch> > SimplePriorityMessageDispatchChannel::removeAll() {
- std::vector< Pointer<MessageDispatch> > result;
+std::vector<Pointer<MessageDispatch> > SimplePriorityMessageDispatchChannel::removeAll() {
+ std::vector<Pointer<MessageDispatch> > result;
- synchronized( &mutex ) {
- for( int i = MAX_PRIORITIES - 1; i >= 0; --i ) {
- std::vector< Pointer<MessageDispatch> > temp( channels[i].toArray() );
- result.insert( result.end(), temp.begin(), temp.end() );
- this->enqueued -= (int)temp.size();
+ synchronized(&mutex) {
+ for (int i = MAX_PRIORITIES - 1; i >= 0; --i) {
+ std::vector<Pointer<MessageDispatch> > temp(channels[i].toArray());
+ result.insert(result.end(), temp.begin(), temp.end());
+ this->enqueued -= (int) temp.size();
channels[i].clear();
}
}
@@ -179,13 +178,13 @@ std::vector< Pointer<MessageDispatch> >
}
////////////////////////////////////////////////////////////////////////////////
-LinkedList< Pointer<MessageDispatch> >& SimplePriorityMessageDispatchChannel::getChannel( const Pointer<MessageDispatch>& dispatch ) {
+LinkedList<Pointer<MessageDispatch> >& SimplePriorityMessageDispatchChannel::getChannel(const Pointer<MessageDispatch>& dispatch) {
int priority = cms::Message::DEFAULT_MSG_PRIORITY;
- if( dispatch->getMessage() != NULL ) {
- priority = Math::max( dispatch->getMessage()->getPriority(), 0 );
- priority = Math::min( dispatch->getMessage()->getPriority(), 9 );
+ if (dispatch->getMessage() != NULL) {
+ priority = Math::max(dispatch->getMessage()->getPriority(), 0);
+ priority = Math::min(dispatch->getMessage()->getPriority(), 9);
}
return this->channels[priority];
@@ -194,10 +193,10 @@ LinkedList< Pointer<MessageDispatch> >&
////////////////////////////////////////////////////////////////////////////////
Pointer<MessageDispatch> SimplePriorityMessageDispatchChannel::removeFirst() {
- if( this->enqueued > 0 ) {
- for( int i = MAX_PRIORITIES - 1; i >= 0; i-- ) {
- LinkedList< Pointer<MessageDispatch> >& channel = channels[i];
- if( !channel.isEmpty() ) {
+ if (this->enqueued > 0) {
+ for (int i = MAX_PRIORITIES - 1; i >= 0; i--) {
+ LinkedList<Pointer<MessageDispatch> >& channel = channels[i];
+ if (!channel.isEmpty()) {
this->enqueued--;
return channel.pop();
}
@@ -210,10 +209,10 @@ Pointer<MessageDispatch> SimplePriorityM
////////////////////////////////////////////////////////////////////////////////
Pointer<MessageDispatch> SimplePriorityMessageDispatchChannel::getFirst() const {
- if( this->enqueued > 0 ) {
- for( int i = MAX_PRIORITIES - 1; i >= 0; i-- ) {
- LinkedList< Pointer<MessageDispatch> >& channel = channels[i];
- if( !channel.isEmpty() ) {
+ if (this->enqueued > 0) {
+ for (int i = MAX_PRIORITIES - 1; i >= 0; i--) {
+ LinkedList<Pointer<MessageDispatch> >& channel = channels[i];
+ if (!channel.isEmpty()) {
return channel.getFirst();
}
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h Thu Oct 18 15:35:22 2012
@@ -46,17 +46,17 @@ namespace core {
private:
- SimplePriorityMessageDispatchChannel( const SimplePriorityMessageDispatchChannel& );
- SimplePriorityMessageDispatchChannel& operator= ( const SimplePriorityMessageDispatchChannel& );
+ SimplePriorityMessageDispatchChannel(const SimplePriorityMessageDispatchChannel&);
+ SimplePriorityMessageDispatchChannel& operator=(const SimplePriorityMessageDispatchChannel&);
public:
SimplePriorityMessageDispatchChannel();
virtual ~SimplePriorityMessageDispatchChannel();
- virtual void enqueue( const Pointer<MessageDispatch>& message );
+ virtual void enqueue(const Pointer<MessageDispatch>& message);
- virtual void enqueueFirst( const Pointer<MessageDispatch>& message );
+ virtual void enqueueFirst(const Pointer<MessageDispatch>& message);
virtual bool isEmpty() const;
@@ -68,7 +68,7 @@ namespace core {
return this->running;
}
- virtual Pointer<MessageDispatch> dequeue( long long timeout );
+ virtual Pointer<MessageDispatch> dequeue(long long timeout);
virtual Pointer<MessageDispatch> dequeueNoWait();
@@ -84,61 +84,45 @@ namespace core {
virtual int size() const;
- virtual std::vector< Pointer<MessageDispatch> > removeAll();
+ virtual std::vector<Pointer<MessageDispatch> > removeAll();
public:
- virtual void lock() throw( decaf::lang::exceptions::RuntimeException ) {
+ virtual void lock() {
mutex.lock();
}
- virtual bool tryLock() throw( decaf::lang::exceptions::RuntimeException ) {
+ virtual bool tryLock() {
return mutex.tryLock();
}
- virtual void unlock() throw( decaf::lang::exceptions::RuntimeException ) {
+ virtual void unlock() {
mutex.unlock();
}
- virtual void wait() throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalMonitorStateException,
- decaf::lang::exceptions::InterruptedException ) {
-
+ virtual void wait() {
mutex.wait();
}
- virtual void wait( long long millisecs )
- throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalMonitorStateException,
- decaf::lang::exceptions::InterruptedException ) {
-
- mutex.wait( millisecs );
+ virtual void wait(long long millisecs) {
+ mutex.wait(millisecs);
}
- virtual void wait( long long millisecs, int nanos )
- throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalArgumentException,
- decaf::lang::exceptions::IllegalMonitorStateException,
- decaf::lang::exceptions::InterruptedException ) {
-
- mutex.wait( millisecs, nanos );
+ virtual void wait(long long millisecs, int nanos) {
+ mutex.wait(millisecs, nanos);
}
- virtual void notify() throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalMonitorStateException ) {
-
+ virtual void notify() {
mutex.notify();
}
- virtual void notifyAll() throw( decaf::lang::exceptions::RuntimeException,
- decaf::lang::exceptions::IllegalMonitorStateException ) {
-
+ virtual void notifyAll() {
mutex.notifyAll();
}
private:
- decaf::util::LinkedList< Pointer<MessageDispatch> >& getChannel( const Pointer<MessageDispatch>& dispatch );
+ decaf::util::LinkedList<Pointer<MessageDispatch> >& getChannel(const Pointer<MessageDispatch>& dispatch);
Pointer<MessageDispatch> removeFirst();
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.cpp?rev=1399699&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.cpp Thu Oct 18 15:35:22 2012
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Synchronization.h"
+
+using namespace activemq;
+using namespace activemq::core;
+
+////////////////////////////////////////////////////////////////////////////////
+Synchronization::~Synchronization() {}
+
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/Synchronization.h Thu Oct 18 15:35:22 2012
@@ -19,7 +19,6 @@
#define _ACTIVEMQ_CORE_SYNCHRONIZATION_H_
#include <activemq/util/Config.h>
-#include <activemq/exceptions/ActiveMQException.h>
namespace activemq {
namespace core {
@@ -28,10 +27,10 @@ namespace core {
* Transacted Object Synchronization, used to sync the events of a Transaction
* with the items in the Transaction.
*/
- class Synchronization {
+ class AMQCPP_API Synchronization {
public:
- virtual ~Synchronization() {}
+ virtual ~Synchronization();
virtual void beforeEnd() = 0;
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.cpp Thu Oct 18 15:35:22 2012
@@ -38,7 +38,6 @@ DefaultPrefetchPolicy::DefaultPrefetchPo
queuePrefetch( DEFAULT_QUEUE_PREFETCH ),
queueBrowserPrefetch( DEFAULT_QUEUE_BROWSER_PREFETCH ),
topicPrefetch( DEFAULT_TOPIC_PREFETCH ) {
-
}
////////////////////////////////////////////////////////////////////////////////
@@ -50,10 +49,10 @@ PrefetchPolicy* DefaultPrefetchPolicy::c
DefaultPrefetchPolicy* copy = new DefaultPrefetchPolicy;
- copy->setDurableTopicPrefetch( this->getDurableTopicPrefetch() );
- copy->setTopicPrefetch( this->getTopicPrefetch() );
- copy->setQueueBrowserPrefetch( this->getQueueBrowserPrefetch() );
- copy->setQueuePrefetch( this->getQueuePrefetch() );
+ copy->setDurableTopicPrefetch(this->getDurableTopicPrefetch());
+ copy->setTopicPrefetch(this->getTopicPrefetch());
+ copy->setQueueBrowserPrefetch(this->getQueueBrowserPrefetch());
+ copy->setQueuePrefetch(this->getQueuePrefetch());
return copy;
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultPrefetchPolicy.h Thu Oct 18 15:35:22 2012
@@ -44,8 +44,8 @@ namespace policies {
private:
- DefaultPrefetchPolicy( const DefaultPrefetchPolicy& );
- DefaultPrefetchPolicy& operator= ( DefaultPrefetchPolicy& );
+ DefaultPrefetchPolicy(const DefaultPrefetchPolicy&);
+ DefaultPrefetchPolicy& operator=(DefaultPrefetchPolicy&);
public:
@@ -53,39 +53,39 @@ namespace policies {
virtual ~DefaultPrefetchPolicy();
- virtual void setDurableTopicPrefetch( int value ) {
- this->durableTopicPrefetch = getMaxPrefetchLimit( value );
+ virtual void setDurableTopicPrefetch(int value) {
+ this->durableTopicPrefetch = getMaxPrefetchLimit(value);
}
virtual int getDurableTopicPrefetch() const {
return this->durableTopicPrefetch;
}
- virtual void setQueuePrefetch( int value ) {
- this->queuePrefetch = getMaxPrefetchLimit( value );
+ virtual void setQueuePrefetch(int value) {
+ this->queuePrefetch = getMaxPrefetchLimit(value);
}
virtual int getQueuePrefetch() const {
return this->queuePrefetch;
}
- virtual void setQueueBrowserPrefetch( int value ) {
- this->queueBrowserPrefetch = getMaxPrefetchLimit( value );
+ virtual void setQueueBrowserPrefetch(int value) {
+ this->queueBrowserPrefetch = getMaxPrefetchLimit(value);
}
virtual int getQueueBrowserPrefetch() const {
return this->queueBrowserPrefetch;
}
- virtual void setTopicPrefetch( int value ) {
- this->topicPrefetch = getMaxPrefetchLimit( value );
+ virtual void setTopicPrefetch(int value) {
+ this->topicPrefetch = getMaxPrefetchLimit(value);
}
virtual int getTopicPrefetch() const {
return this->topicPrefetch;
}
- virtual int getMaxPrefetchLimit( int value ) const {
+ virtual int getMaxPrefetchLimit(int value) const {
return value < MAX_PREFETCH_SIZE ? value : MAX_PREFETCH_SIZE;
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.cpp Thu Oct 18 15:35:22 2012
@@ -43,37 +43,36 @@ DefaultRedeliveryPolicy::~DefaultRedeliv
////////////////////////////////////////////////////////////////////////////////
short DefaultRedeliveryPolicy::getCollisionAvoidancePercent() const {
- return (short)Math::round( this->collisionAvoidanceFactor * 100 );
+ return (short) Math::round(this->collisionAvoidanceFactor * 100);
}
////////////////////////////////////////////////////////////////////////////////
-void DefaultRedeliveryPolicy::setCollisionAvoidancePercent( short value ) {
+void DefaultRedeliveryPolicy::setCollisionAvoidancePercent(short value) {
this->collisionAvoidanceFactor = value * 0.01;
}
////////////////////////////////////////////////////////////////////////////////
-long long DefaultRedeliveryPolicy::getNextRedeliveryDelay( long long previousDelay ) {
+long long DefaultRedeliveryPolicy::getNextRedeliveryDelay(long long previousDelay) {
static Random randomNumberGenerator;
long long nextDelay;
- if( previousDelay == 0 ) {
+ if (previousDelay == 0) {
nextDelay = redeliveryDelay;
- } else if( useExponentialBackOff && (int)backOffMultiplier > 1 ) {
- nextDelay = (long long)( (double)previousDelay * backOffMultiplier );
+ } else if (useExponentialBackOff && (int) backOffMultiplier > 1) {
+ nextDelay = (long long) ((double) previousDelay * backOffMultiplier);
} else {
nextDelay = previousDelay;
}
- if( useCollisionAvoidance ) {
+ if (useCollisionAvoidance) {
/*
* First random determines +/-, second random determines how far to
* go in that direction. -cgs
*/
- double variance = ( randomNumberGenerator.nextBoolean() ?
- collisionAvoidanceFactor : -collisionAvoidanceFactor ) * randomNumberGenerator.nextDouble( );
- nextDelay += (long long)( (double)nextDelay * variance );
+ double variance = (randomNumberGenerator.nextBoolean() ? collisionAvoidanceFactor : -collisionAvoidanceFactor) * randomNumberGenerator.nextDouble();
+ nextDelay += (long long) ((double) nextDelay * variance);
}
return nextDelay;
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/policies/DefaultRedeliveryPolicy.h Thu Oct 18 15:35:22 2012
@@ -39,8 +39,8 @@ namespace policies {
private:
- DefaultRedeliveryPolicy( const DefaultRedeliveryPolicy& );
- DefaultRedeliveryPolicy& operator= ( const DefaultRedeliveryPolicy& );
+ DefaultRedeliveryPolicy(const DefaultRedeliveryPolicy&);
+ DefaultRedeliveryPolicy& operator=(const DefaultRedeliveryPolicy&);
public:
@@ -52,19 +52,19 @@ namespace policies {
return this->backOffMultiplier;
}
- virtual void setBackOffMultiplier( double value ) {
+ virtual void setBackOffMultiplier(double value) {
this->backOffMultiplier = value;
}
virtual short getCollisionAvoidancePercent() const;
- virtual void setCollisionAvoidancePercent( short value );
+ virtual void setCollisionAvoidancePercent(short value);
virtual long long getInitialRedeliveryDelay() const {
return this->initialRedeliveryDelay;
}
- virtual void setInitialRedeliveryDelay( long long value ) {
+ virtual void setInitialRedeliveryDelay(long long value) {
this->initialRedeliveryDelay = value;
}
@@ -72,7 +72,7 @@ namespace policies {
return this->redeliveryDelay;
}
- virtual void setRedeliveryDelay( long long value ) {
+ virtual void setRedeliveryDelay(long long value) {
this->redeliveryDelay = value;
}
@@ -80,7 +80,7 @@ namespace policies {
return this->maximumRedeliveries;
}
- virtual void setMaximumRedeliveries( int value ) {
+ virtual void setMaximumRedeliveries(int value) {
this->maximumRedeliveries = value;
}
@@ -88,7 +88,7 @@ namespace policies {
return this->useCollisionAvoidance;
}
- virtual void setUseCollisionAvoidance( bool value ) {
+ virtual void setUseCollisionAvoidance(bool value) {
this->useCollisionAvoidance = value;
}
@@ -96,11 +96,11 @@ namespace policies {
return this->useExponentialBackOff;
}
- virtual void setUseExponentialBackOff( bool value ) {
+ virtual void setUseExponentialBackOff(bool value) {
this->useExponentialBackOff = value;
}
- virtual long long getNextRedeliveryDelay( long long previousDelay );
+ virtual long long getNextRedeliveryDelay(long long previousDelay);
virtual RedeliveryPolicy* clone() const;
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp Thu Oct 18 15:35:22 2012
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include <stdio.h>
#include "ActiveMQException.h"
#include <decaf/util/logging/LoggerDefines.h>
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h Thu Oct 18 15:35:22 2012
@@ -25,8 +25,6 @@
#include <cms/CMSException.h>
#include <decaf/lang/Exception.h>
#include <activemq/exceptions/ExceptionDefines.h>
-#include <stdarg.h>
-#include <sstream>
namespace activemq{
namespace exceptions{
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.cpp?rev=1399699&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.cpp Thu Oct 18 15:35:22 2012
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BrokerException.h"
+
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace decaf::lang;
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+BrokerException::BrokerException() : ActiveMQException() {}
+
+////////////////////////////////////////////////////////////////////////////////
+BrokerException::BrokerException(const exceptions::ActiveMQException& ex) : exceptions::ActiveMQException() {
+ *(exceptions::ActiveMQException*)this = ex;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+BrokerException::BrokerException(const BrokerException& ex) : exceptions::ActiveMQException() {
+ *(exceptions::ActiveMQException*)this = ex;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+BrokerException::BrokerException(const char* file, const int lineNumber, const char* msg, ...) : exceptions::ActiveMQException() {
+
+ va_list vargs;
+ va_start(vargs, msg);
+ buildMessage(msg, vargs);
+
+ // Set the first mark for this exception.
+ setMark(file, lineNumber);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+BrokerException::BrokerException(const char* file, const int lineNumber, const commands::BrokerError* error) : exceptions::ActiveMQException() {
+
+ std::ostringstream ostream;
+ ostream << "*** BEGIN SERVER-SIDE STACK TRACE ***" << std::endl;
+ ostream << "Message: " << error->getMessage() << std::endl;
+ if (error->getCause() != NULL) {
+ ostream << "Cause: " << error->getCause()->toString() << std::endl;
+ }
+ ostream << "Exception Class " << error->getExceptionClass() << std::endl;
+
+ for (std::size_t ix = 0; ix < error->getStackTraceElements().size(); ++ix) {
+ ostream << "\t[FILE: " << error->getStackTraceElements()[ix]->FileName
+ << ", LINE: " << error->getStackTraceElements()[ix]->LineNumber
+ << "] occurred in: " << error->getStackTraceElements()[ix]->ClassName
+ << "." << error->getStackTraceElements()[ix]->MethodName << std::endl;
+ }
+
+ ostream << "*** END SERVER-SIDE STACK TRACE ***";
+
+ setMessage(ostream.str().c_str());
+ setMark(file, lineNumber);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+BrokerException::~BrokerException() throw() {}
+
+////////////////////////////////////////////////////////////////////////////////
+BrokerException* BrokerException::clone() const{
+ return new BrokerException( *this );
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/BrokerException.h Thu Oct 18 15:35:22 2012
@@ -21,74 +21,33 @@
#include <activemq/util/Config.h>
#include <activemq/exceptions/ActiveMQException.h>
#include <activemq/commands/BrokerError.h>
-#include <sstream>
-namespace activemq{
-namespace exceptions{
+namespace activemq {
+namespace exceptions {
- class AMQCPP_API BrokerException : public exceptions::ActiveMQException {
+ class AMQCPP_API BrokerException: public exceptions::ActiveMQException {
public:
- BrokerException() {}
+ BrokerException();
- BrokerException( const exceptions::ActiveMQException& ex )
- : exceptions::ActiveMQException(){
- *( exceptions::ActiveMQException* )this = ex;
- }
-
- BrokerException( const BrokerException& ex )
- : exceptions::ActiveMQException(){
- *( exceptions::ActiveMQException* )this = ex;
- }
-
- BrokerException( const char* file, const int lineNumber,
- const char* msg, ... )
- : exceptions::ActiveMQException() {
-
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- BrokerException( const char* file, const int lineNumber,
- const commands::BrokerError* error )
- : exceptions::ActiveMQException() {
-
- std::ostringstream ostream;
- ostream << "*** BEGIN SERVER-SIDE STACK TRACE ***" << std::endl;
- ostream << "Message: " << error->getMessage() << std::endl;
- if( error->getCause() != NULL ) {
- ostream << "Cause: " << error->getCause()->toString() << std::endl;
- }
- ostream << "Exception Class " << error->getExceptionClass() << std::endl;
-
- for( std::size_t ix = 0; ix< error->getStackTraceElements().size(); ++ix ){
- ostream << "\t[FILE: " << error->getStackTraceElements()[ix]->FileName
- << ", LINE: " << error->getStackTraceElements()[ix]->LineNumber
- << "] occurred in: " << error->getStackTraceElements()[ix]->ClassName
- << "." << error->getStackTraceElements()[ix]->MethodName
- << std::endl;
- }
-
- ostream << "*** END SERVER-SIDE STACK TRACE ***";
-
- setMessage( ostream.str().c_str() );
- setMark( file, lineNumber );
- }
+ BrokerException(const exceptions::ActiveMQException& ex);
+
+ BrokerException(const BrokerException& ex);
+
+ BrokerException(const char* file, const int lineNumber, const char* msg, ...);
+
+ BrokerException(const char* file, const int lineNumber, const commands::BrokerError* error);
/**
* Clones this exception. This is useful for cases where you need
* to preserve the type of the original exception as well as the message.
* All subclasses should override.
+ *
+ * @returns new BrokerException instance that is a clone of this one.
*/
- virtual BrokerException* clone() const{
- return new BrokerException( *this );
- }
+ virtual BrokerException* clone() const;
- virtual ~BrokerException() throw() {}
+ virtual ~BrokerException() throw ();
};
}}
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.cpp?rev=1399699&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.cpp Thu Oct 18 15:35:22 2012
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ConnectionFailedException.h"
+
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace decaf::lang;
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionFailedException::ConnectionFailedException() : ActiveMQException() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionFailedException::ConnectionFailedException(const exceptions::ActiveMQException& ex) : ActiveMQException() {
+ *(exceptions::ActiveMQException*) this = ex;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionFailedException::ConnectionFailedException(const ConnectionFailedException& ex) : ActiveMQException() {
+ *(exceptions::ActiveMQException*) this = ex;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionFailedException::ConnectionFailedException(const char* file, const int lineNumber, const char* msg, ...) : ActiveMQException() {
+
+ va_list vargs;
+ va_start(vargs, msg);
+ buildMessage(msg, vargs);
+
+ // Set the first mark for this exception.
+ setMark(file, lineNumber);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionFailedException::~ConnectionFailedException() throw() {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ConnectionFailedException* ConnectionFailedException::clone() const {
+ return new ConnectionFailedException(*this);
+}
+
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ConnectionFailedException.h Thu Oct 18 15:35:22 2012
@@ -27,35 +27,17 @@ namespace exceptions {
class AMQCPP_API ConnectionFailedException : public exceptions::ActiveMQException {
public:
- ConnectionFailedException() {}
+ ConnectionFailedException();
- ConnectionFailedException( const exceptions::ActiveMQException& ex )
- : exceptions::ActiveMQException() {
- *( exceptions::ActiveMQException* )this = ex;
- }
-
- ConnectionFailedException( const ConnectionFailedException& ex )
- : exceptions::ActiveMQException() {
- *( exceptions::ActiveMQException* )this = ex;
- }
-
- ConnectionFailedException( const char* file, const int lineNumber,
- const char* msg, ... )
- : exceptions::ActiveMQException() {
-
- va_list vargs;
- va_start( vargs, msg );
- buildMessage( msg, vargs );
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- virtual ConnectionFailedException* clone() const {
- return new ConnectionFailedException( *this );
- }
+ ConnectionFailedException(const exceptions::ActiveMQException& ex);
- virtual ~ConnectionFailedException() throw() {}
+ ConnectionFailedException(const ConnectionFailedException& ex);
+
+ ConnectionFailedException(const char* file, const int lineNumber, const char* msg, ...);
+
+ virtual ~ConnectionFailedException() throw ();
+
+ virtual ConnectionFailedException* clone() const;
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp Thu Oct 18 15:35:22 2012
@@ -26,11 +26,12 @@ using namespace activemq::io;
using namespace decaf::io;
using namespace decaf::lang::exceptions;
-LOGDECAF_INITIALIZE( logger, LoggingInputStream, "activemq.io.LoggingInputStream")
+LOGDECAF_INITIALIZE(logger, LoggingInputStream, "activemq.io.LoggingInputStream")
////////////////////////////////////////////////////////////////////////////////
-LoggingInputStream::LoggingInputStream( decaf::io::InputStream* inputStream, bool own )
- : decaf::io::FilterInputStream( inputStream, own ) {}
+LoggingInputStream::LoggingInputStream(decaf::io::InputStream* inputStream, bool own) :
+ decaf::io::FilterInputStream(inputStream, own) {
+}
////////////////////////////////////////////////////////////////////////////////
LoggingInputStream::~LoggingInputStream() {}
@@ -38,60 +39,54 @@ LoggingInputStream::~LoggingInputStream(
////////////////////////////////////////////////////////////////////////////////
int LoggingInputStream::doReadByte() {
try {
-
- unsigned char c = (unsigned char)FilterInputStream::doReadByte();
- log( &c, 1 );
+ unsigned char c = (unsigned char) FilterInputStream::doReadByte();
+ log(&c, 1);
return c;
}
- AMQ_CATCH_RETHROW( IOException )
- AMQ_CATCHALL_THROW( IOException )
+ AMQ_CATCH_RETHROW(IOException)
+ AMQ_CATCHALL_THROW(IOException)
}
////////////////////////////////////////////////////////////////////////////////
-int LoggingInputStream::doReadArrayBounded( unsigned char* buffer, int size,
- int offset, int length ) {
+int LoggingInputStream::doReadArrayBounded(unsigned char* buffer, int size, int offset, int length) {
try {
- if( length == 0 ) {
+ if (length == 0) {
return 0;
}
- if( buffer == NULL ) {
- throw NullPointerException(
- __FILE__, __LINE__,
- "LoggingInputStream::read - Passed Buffer is Null" );
+ if (buffer == NULL) {
+ throw NullPointerException(__FILE__, __LINE__, "LoggingInputStream::read - Passed Buffer is Null");
}
- if( length > size - offset ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "Given size{%d} - offset{%d} is less than length{%d}.", size, offset, length );
+ if (length > size - offset) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "Given size{%d} - offset{%d} is less than length{%d}.", size, offset, length);
}
- int numRead = FilterInputStream::doReadArrayBounded( buffer, size, offset, length );
+ int numRead = FilterInputStream::doReadArrayBounded(buffer, size, offset, length);
- log( buffer, numRead );
+ log(buffer, numRead);
- return (int)numRead;
+ return (int) numRead;
}
- AMQ_CATCH_RETHROW( IOException )
- AMQ_CATCH_RETHROW( IndexOutOfBoundsException )
- AMQ_CATCH_RETHROW( NullPointerException )
- AMQ_CATCHALL_THROW( IOException )
+ AMQ_CATCH_RETHROW(IOException)
+ AMQ_CATCH_RETHROW(IndexOutOfBoundsException)
+ AMQ_CATCH_RETHROW(NullPointerException)
+ AMQ_CATCHALL_THROW(IOException)
}
////////////////////////////////////////////////////////////////////////////////
-void LoggingInputStream::log( const unsigned char* buffer, int len ) {
+void LoggingInputStream::log(const unsigned char* buffer, int len) {
ostringstream ostream;
ostream << "TCP Trace: Reading: " << endl << "[";
- for( int ix = 0; ix < len; ++ix ) {
- ostream << setw( 2 ) << setfill( '0' ) << std::hex << (int)buffer[ix];
+ for (int ix = 0; ix < len; ++ix) {
+ ostream << setw(2) << setfill('0') << std::hex << (int) buffer[ix];
- if( ( ( ix + 1 ) % 2 ) == 0 ) {
+ if (((ix + 1) % 2) == 0) {
ostream << ' ';
}
}
@@ -99,5 +94,5 @@ void LoggingInputStream::log( const unsi
ostream << "] len: " << std::dec << len << " bytes";
// Log the data
- LOGDECAF_INFO( logger, ostream.str() )
+ LOGDECAF_INFO(logger, ostream.str())
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h Thu Oct 18 15:35:22 2012
@@ -36,11 +36,13 @@ namespace io{
/**
* Creates a DataInputStream that uses the specified underlying
* InputStream.
- * @param inputStream the InputStream instance to wrap.
- * @param own indicates if this class owns the wrapped string
- * defaults to false.
+ *
+ * @param inputStream
+ * the InputStream instance to wrap.
+ * @param own
+ * indicates if this class owns the wrapped string defaults to false.
*/
- LoggingInputStream( decaf::io::InputStream* inputStream, bool own = false );
+ LoggingInputStream(decaf::io::InputStream* inputStream, bool own = false);
virtual ~LoggingInputStream();
@@ -48,14 +50,14 @@ namespace io{
virtual int doReadByte();
- virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length );
+ virtual int doReadArrayBounded(unsigned char* buffer, int size, int offset, int length);
private:
/**
* Logs the data in the buffer.
*/
- void log( const unsigned char* buffer, int len );
+ void log(const unsigned char* buffer, int len);
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.cpp Thu Oct 18 15:35:22 2012
@@ -29,66 +29,63 @@ using namespace decaf::lang::exceptions;
LOGDECAF_INITIALIZE( logger, LoggingOutputStream, "activemq.io.LoggingOutputStream")
////////////////////////////////////////////////////////////////////////////////
-LoggingOutputStream::LoggingOutputStream( OutputStream* outputStream, bool own )
- : decaf::io::FilterOutputStream( outputStream, own ) {}
+LoggingOutputStream::LoggingOutputStream(OutputStream* outputStream, bool own) :
+ decaf::io::FilterOutputStream(outputStream, own) {
+}
////////////////////////////////////////////////////////////////////////////////
-LoggingOutputStream::~LoggingOutputStream() {}
+LoggingOutputStream::~LoggingOutputStream() {
+}
////////////////////////////////////////////////////////////////////////////////
-void LoggingOutputStream::doWriteByte( const unsigned char c ) {
+void LoggingOutputStream::doWriteByte(const unsigned char c) {
try {
-
- log( &c, 1 );
- FilterOutputStream::doWriteByte( c );
+ log(&c, 1);
+ FilterOutputStream::doWriteByte(c);
}
- AMQ_CATCH_RETHROW( IOException )
- AMQ_CATCHALL_THROW( IOException )
+ AMQ_CATCH_RETHROW(IOException)
+ AMQ_CATCHALL_THROW(IOException)
}
////////////////////////////////////////////////////////////////////////////////
-void LoggingOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size,
- int offset, int length ) {
+void LoggingOutputStream::doWriteArrayBounded(const unsigned char* buffer, int size, int offset, int length) {
try {
- if( length == 0 ) {
+ if (length == 0) {
return;
}
- if( buffer == NULL ) {
- throw NullPointerException(
- __FILE__, __LINE__,
- "LoggingOutputStream::write - Passed Buffer is Null" );
+ if (buffer == NULL) {
+ throw NullPointerException(__FILE__, __LINE__, "LoggingOutputStream::write - Passed Buffer is Null");
}
- if( ( offset + length ) > size ) {
- throw decaf::lang::exceptions::IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "DataOutputStream::write - given offset + length is greater than buffer size.");
+ if ((offset + length) > size) {
+ throw decaf::lang::exceptions::IndexOutOfBoundsException(__FILE__, __LINE__,
+ "DataOutputStream::write - given offset + length is greater than buffer size.");
}
- log( buffer + offset, length );
+ log(buffer + offset, length);
- FilterOutputStream::doWriteArrayBounded( buffer, size, offset, length );
+ FilterOutputStream::doWriteArrayBounded(buffer, size, offset, length);
}
- AMQ_CATCH_RETHROW( IOException )
- AMQ_CATCH_RETHROW( NullPointerException )
- AMQ_CATCH_RETHROW( IndexOutOfBoundsException )
- AMQ_CATCHALL_THROW( IOException )
+ AMQ_CATCH_RETHROW(IOException)
+ AMQ_CATCH_RETHROW(NullPointerException)
+ AMQ_CATCH_RETHROW(IndexOutOfBoundsException)
+ AMQ_CATCHALL_THROW(IOException)
}
////////////////////////////////////////////////////////////////////////////////
-void LoggingOutputStream::log( const unsigned char* buffer, int len ) {
+void LoggingOutputStream::log(const unsigned char* buffer, int len) {
// Write the buffer as hex to a string stream.
ostringstream ostream;
ostream << "TCP Trace: Writing:" << endl << '[';
- for( int ix = 0; ix < len; ++ix ) {
- ostream << setw( 2 ) << setfill( '0' ) << std::hex << (int)buffer[ix];
+ for (int ix = 0; ix < len; ++ix) {
+ ostream << setw(2) << setfill('0') << std::hex << (int) buffer[ix];
- if( ( ( ix + 1 ) % 2 ) == 0 ) {
+ if (((ix + 1) % 2) == 0) {
ostream << ' ';
}
}
@@ -96,5 +93,5 @@ void LoggingOutputStream::log( const uns
ostream << "] len: " << std::dec << len << " bytes";
// Log the data
- LOGDECAF_INFO( logger, ostream.str() )
+ LOGDECAF_INFO(logger, ostream.str())
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h?rev=1399699&r1=1399698&r2=1399699&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingOutputStream.h Thu Oct 18 15:35:22 2012
@@ -45,22 +45,22 @@ namespace io{
* If true, this object will control the lifetime of the
* output stream that it encapsulates.
*/
- LoggingOutputStream( OutputStream* next, bool own = false );
+ LoggingOutputStream(OutputStream* next, bool own = false);
virtual ~LoggingOutputStream();
protected:
- virtual void doWriteByte( unsigned char c );
+ virtual void doWriteByte(unsigned char c);
- virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length );
+ virtual void doWriteArrayBounded(const unsigned char* buffer, int size, int offset, int length);
private:
/**
* Logs the data in the buffer.
*/
- void log( const unsigned char* buffer, int len );
+ void log(const unsigned char* buffer, int len);
};