activemq-cpp-3.3.0

src/main/activemq/core/policies/DefaultRedeliveryPolicy.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _ACTIVEMQ_CORE_POLICIES_DEFAULTREDELIVERYPOLICY_H_
00019 #define _ACTIVEMQ_CORE_POLICIES_DEFAULTREDELIVERYPOLICY_H_
00020 
00021 #include <activemq/util/Config.h>
00022 
00023 #include <activemq/core/RedeliveryPolicy.h>
00024 
00025 namespace activemq {
00026 namespace core {
00027 namespace policies {
00028 
00029     class AMQCPP_API DefaultRedeliveryPolicy : public RedeliveryPolicy {
00030     private:
00031 
00032         double backOffMultiplier;
00033         double collisionAvoidanceFactor;
00034         long long initialRedeliveryDelay;
00035         int maximumRedeliveries;
00036         bool useCollisionAvoidance;
00037         bool useExponentialBackOff;
00038         long long redeliveryDelay;
00039 
00040     private:
00041 
00042         DefaultRedeliveryPolicy( const DefaultRedeliveryPolicy& );
00043         DefaultRedeliveryPolicy& operator= ( const DefaultRedeliveryPolicy& );
00044 
00045     public:
00046 
00047         DefaultRedeliveryPolicy();
00048 
00049         virtual ~DefaultRedeliveryPolicy();
00050 
00051         virtual double getBackOffMultiplier() const {
00052             return this->backOffMultiplier;
00053         }
00054 
00055         virtual void setBackOffMultiplier( double value ) {
00056             this->backOffMultiplier = value;
00057         }
00058 
00059         virtual short getCollisionAvoidancePercent() const;
00060 
00061         virtual void setCollisionAvoidancePercent( short value );
00062 
00063         virtual long long getInitialRedeliveryDelay() const {
00064             return this->initialRedeliveryDelay;
00065         }
00066 
00067         virtual void setInitialRedeliveryDelay( long long value ) {
00068             this->initialRedeliveryDelay = value;
00069         }
00070 
00071         virtual long long getRedeliveryDelay() const {
00072             return this->redeliveryDelay;
00073         }
00074 
00075         virtual void setRedeliveryDelay( long long value ) {
00076             this->redeliveryDelay = value;
00077         }
00078 
00079         virtual int getMaximumRedeliveries() const {
00080             return this->maximumRedeliveries;
00081         }
00082 
00083         virtual void setMaximumRedeliveries( int value ) {
00084             this->maximumRedeliveries = value;
00085         }
00086 
00087         virtual bool isUseCollisionAvoidance() const {
00088             return this->useCollisionAvoidance;
00089         }
00090 
00091         virtual void setUseCollisionAvoidance( bool value ) {
00092             this->useCollisionAvoidance = value;
00093         }
00094 
00095         virtual bool isUseExponentialBackOff() const {
00096             return this->useExponentialBackOff;
00097         }
00098 
00099         virtual void setUseExponentialBackOff( bool value ) {
00100             this->useExponentialBackOff = value;
00101         }
00102 
00103         virtual long long getNextRedeliveryDelay( long long previousDelay );
00104 
00105         virtual RedeliveryPolicy* clone() const;
00106 
00107     };
00108 
00109 }}}
00110 
00111 #endif /* _ACTIVEMQ_CORE_POLICIES_DEFAULTREDELIVERYPOLICY_H_ */