Merge lp:~kroq-gar78/ubuntu/precise/activemq/sid-merge into lp:ubuntu/precise/activemq
- Precise (12.04)
- sid-merge
- Merge into precise
| Status: | Superseded |
|---|---|
| Proposed branch: | lp:~kroq-gar78/ubuntu/precise/activemq/sid-merge |
| Merge into: | lp:ubuntu/precise/activemq |
| Diff against target: |
9034 lines (+100/-8562) 24 files modified
.pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java (+0/-2389) .pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java (+0/-1449) .pc/activemq-admin.patch/assembly/src/release/bin/activemq-admin (+0/-155) .pc/applied-patches (+0/-8) .pc/disable_some_modules.diff/pom.xml (+0/-1320) .pc/drop_derby_use.diff/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DataSourceSupport.java (+0/-96) .pc/exclude_geronimo_jca.diff/activemq-pool/pom.xml (+0/-104) .pc/exclude_geronimo_jca.diff/activemq-spring/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java (+0/-187) .pc/exclude_spring_osgi.diff/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java (+0/-51) .pc/init_debian_default_values.diff/assembly/src/release/bin/activemq (+0/-653) .pc/javadoc_links.diff/activemq-core/pom.xml (+0/-705) .pc/javadoc_links.diff/pom.xml (+0/-1328) activemq-core/pom.xml (+4/-3) activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java (+2/-22) activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java (+0/-23) activemq-core/src/main/java/org/apache/activemq/store/jdbc/DataSourceSupport.java (+5/-6) activemq-pool/pom.xml (+0/-15) activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java (+3/-2) activemq-spring/src/main/java/org/apache/activemq/pool/PooledConnectionFactoryBean.java (+2/-2) assembly/src/release/bin/activemq (+53/-22) assembly/src/release/bin/activemq-admin (+1/-1) debian/changelog (+16/-0) debian/libactivemq-java.poms (+4/-4) pom.xml (+10/-17) |
| To merge this branch: | bzr merge lp:~kroq-gar78/ubuntu/precise/activemq/sid-merge |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| James Page | Needs Fixing on 2012-05-21 | ||
| Ubuntu branches | 2012-05-20 | Pending | |
|
Review via email:
|
|||
This proposal has been superseded by a proposal from 2012-07-13.
Commit Message
Description of the Change
I fixed the error that caused activemq not to start by merging the Debian Sid branch into this one.
- 9. By kroq-gar78 on 2012-07-17
-
debian/
libactivemq- java.poms: added the options '--java-lib' to
certain lines so that the necessary files are included in the
package and activemq doesn't fail to start (LP: #993249)
Unmerged revisions
- 9. By kroq-gar78 on 2012-07-17
-
debian/
libactivemq- java.poms: added the options '--java-lib' to
certain lines so that the necessary files are included in the
package and activemq doesn't fail to start (LP: #993249) - 8. By kroq-gar78 on 2012-05-18
-
* Install the activemq-
{core,console, run} and kahadb jar files to
/usr/share/java. (Closes: #668943)
- Add the necessary --java-lib flag to d/libactivemq-java.poms
* Thanks to Ulrich Dangel for RC bugfix, upload to unstable.
* Merge from Debian unstable, remaining changes:
- debian/control: Build-Depends on junit4 to fix FTBFS. (LP: #993249)
Preview Diff
| 1 | === removed directory '.pc/CVE-2011-4605.diff' |
| 2 | === removed directory '.pc/CVE-2011-4605.diff/activemq-core' |
| 3 | === removed directory '.pc/CVE-2011-4605.diff/activemq-core/src' |
| 4 | === removed directory '.pc/CVE-2011-4605.diff/activemq-core/src/main' |
| 5 | === removed directory '.pc/CVE-2011-4605.diff/activemq-core/src/main/java' |
| 6 | === removed directory '.pc/CVE-2011-4605.diff/activemq-core/src/main/java/org' |
| 7 | === removed directory '.pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache' |
| 8 | === removed directory '.pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq' |
| 9 | === removed file '.pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java' |
| 10 | --- .pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java 2012-01-15 19:38:21 +0000 |
| 11 | +++ .pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java 1970-01-01 00:00:00 +0000 |
| 12 | @@ -1,2389 +0,0 @@ |
| 13 | -/** |
| 14 | - * Licensed to the Apache Software Foundation (ASF) under one or more |
| 15 | - * contributor license agreements. See the NOTICE file distributed with |
| 16 | - * this work for additional information regarding copyright ownership. |
| 17 | - * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 18 | - * (the "License"); you may not use this file except in compliance with |
| 19 | - * the License. You may obtain a copy of the License at |
| 20 | - * |
| 21 | - * http://www.apache.org/licenses/LICENSE-2.0 |
| 22 | - * |
| 23 | - * Unless required by applicable law or agreed to in writing, software |
| 24 | - * distributed under the License is distributed on an "AS IS" BASIS, |
| 25 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 26 | - * See the License for the specific language governing permissions and |
| 27 | - * limitations under the License. |
| 28 | - */ |
| 29 | -package org.apache.activemq; |
| 30 | - |
| 31 | -import java.io.IOException; |
| 32 | -import java.io.InputStream; |
| 33 | -import java.io.OutputStream; |
| 34 | -import java.net.URI; |
| 35 | -import java.net.URISyntaxException; |
| 36 | -import java.util.HashMap; |
| 37 | -import java.util.Iterator; |
| 38 | -import java.util.Map; |
| 39 | -import java.util.concurrent.ConcurrentHashMap; |
| 40 | -import java.util.concurrent.CopyOnWriteArrayList; |
| 41 | -import java.util.concurrent.CountDownLatch; |
| 42 | -import java.util.concurrent.LinkedBlockingQueue; |
| 43 | -import java.util.concurrent.ThreadFactory; |
| 44 | -import java.util.concurrent.ThreadPoolExecutor; |
| 45 | -import java.util.concurrent.TimeUnit; |
| 46 | -import java.util.concurrent.atomic.AtomicBoolean; |
| 47 | -import java.util.concurrent.atomic.AtomicInteger; |
| 48 | -import javax.jms.Connection; |
| 49 | -import javax.jms.ConnectionConsumer; |
| 50 | -import javax.jms.ConnectionMetaData; |
| 51 | -import javax.jms.DeliveryMode; |
| 52 | -import javax.jms.Destination; |
| 53 | -import javax.jms.ExceptionListener; |
| 54 | -import javax.jms.IllegalStateException; |
| 55 | -import javax.jms.InvalidDestinationException; |
| 56 | -import javax.jms.JMSException; |
| 57 | -import javax.jms.Queue; |
| 58 | -import javax.jms.QueueConnection; |
| 59 | -import javax.jms.QueueSession; |
| 60 | -import javax.jms.ServerSessionPool; |
| 61 | -import javax.jms.Session; |
| 62 | -import javax.jms.Topic; |
| 63 | -import javax.jms.TopicConnection; |
| 64 | -import javax.jms.TopicSession; |
| 65 | -import javax.jms.XAConnection; |
| 66 | -import org.apache.activemq.advisory.DestinationSource; |
| 67 | -import org.apache.activemq.blob.BlobTransferPolicy; |
| 68 | -import org.apache.activemq.command.ActiveMQDestination; |
| 69 | -import org.apache.activemq.command.ActiveMQMessage; |
| 70 | -import org.apache.activemq.command.ActiveMQTempDestination; |
| 71 | -import org.apache.activemq.command.ActiveMQTempQueue; |
| 72 | -import org.apache.activemq.command.ActiveMQTempTopic; |
| 73 | -import org.apache.activemq.command.BrokerInfo; |
| 74 | -import org.apache.activemq.command.Command; |
| 75 | -import org.apache.activemq.command.CommandTypes; |
| 76 | -import org.apache.activemq.command.ConnectionControl; |
| 77 | -import org.apache.activemq.command.ConnectionError; |
| 78 | -import org.apache.activemq.command.ConnectionId; |
| 79 | -import org.apache.activemq.command.ConnectionInfo; |
| 80 | -import org.apache.activemq.command.ConsumerControl; |
| 81 | -import org.apache.activemq.command.ConsumerId; |
| 82 | -import org.apache.activemq.command.ConsumerInfo; |
| 83 | -import org.apache.activemq.command.ControlCommand; |
| 84 | -import org.apache.activemq.command.DestinationInfo; |
| 85 | -import org.apache.activemq.command.ExceptionResponse; |
| 86 | -import org.apache.activemq.command.Message; |
| 87 | -import org.apache.activemq.command.MessageDispatch; |
| 88 | -import org.apache.activemq.command.MessageId; |
| 89 | -import org.apache.activemq.command.ProducerAck; |
| 90 | -import org.apache.activemq.command.ProducerId; |
| 91 | -import org.apache.activemq.command.RemoveInfo; |
| 92 | -import org.apache.activemq.command.RemoveSubscriptionInfo; |
| 93 | -import org.apache.activemq.command.Response; |
| 94 | -import org.apache.activemq.command.SessionId; |
| 95 | -import org.apache.activemq.command.ShutdownInfo; |
| 96 | -import org.apache.activemq.command.WireFormatInfo; |
| 97 | -import org.apache.activemq.management.JMSConnectionStatsImpl; |
| 98 | -import org.apache.activemq.management.JMSStatsImpl; |
| 99 | -import org.apache.activemq.management.StatsCapable; |
| 100 | -import org.apache.activemq.management.StatsImpl; |
| 101 | -import org.apache.activemq.state.CommandVisitorAdapter; |
| 102 | -import org.apache.activemq.thread.Scheduler; |
| 103 | -import org.apache.activemq.thread.TaskRunnerFactory; |
| 104 | -import org.apache.activemq.transport.Transport; |
| 105 | -import org.apache.activemq.transport.TransportListener; |
| 106 | -import org.apache.activemq.transport.failover.FailoverTransport; |
| 107 | -import org.apache.activemq.util.IdGenerator; |
| 108 | -import org.apache.activemq.util.IntrospectionSupport; |
| 109 | -import org.apache.activemq.util.JMSExceptionSupport; |
| 110 | -import org.apache.activemq.util.LongSequenceGenerator; |
| 111 | -import org.apache.activemq.util.ServiceSupport; |
| 112 | -import org.slf4j.Logger; |
| 113 | -import org.slf4j.LoggerFactory; |
| 114 | - |
| 115 | -public class ActiveMQConnection implements Connection, TopicConnection, QueueConnection, StatsCapable, Closeable, StreamConnection, TransportListener, EnhancedConnection { |
| 116 | - |
| 117 | - public static final String DEFAULT_USER = ActiveMQConnectionFactory.DEFAULT_USER; |
| 118 | - public static final String DEFAULT_PASSWORD = ActiveMQConnectionFactory.DEFAULT_PASSWORD; |
| 119 | - public static final String DEFAULT_BROKER_URL = ActiveMQConnectionFactory.DEFAULT_BROKER_URL; |
| 120 | - |
| 121 | - private static final Logger LOG = LoggerFactory.getLogger(ActiveMQConnection.class); |
| 122 | - private static final IdGenerator CONNECTION_ID_GENERATOR = new IdGenerator(); |
| 123 | - |
| 124 | - public final ConcurrentHashMap<ActiveMQTempDestination, ActiveMQTempDestination> activeTempDestinations = new ConcurrentHashMap<ActiveMQTempDestination, ActiveMQTempDestination>(); |
| 125 | - |
| 126 | - protected boolean dispatchAsync=true; |
| 127 | - protected boolean alwaysSessionAsync = true; |
| 128 | - |
| 129 | - private TaskRunnerFactory sessionTaskRunner; |
| 130 | - private final ThreadPoolExecutor executor; |
| 131 | - |
| 132 | - // Connection state variables |
| 133 | - private final ConnectionInfo info; |
| 134 | - private ExceptionListener exceptionListener; |
| 135 | - private ClientInternalExceptionListener clientInternalExceptionListener; |
| 136 | - private boolean clientIDSet; |
| 137 | - private boolean isConnectionInfoSentToBroker; |
| 138 | - private boolean userSpecifiedClientID; |
| 139 | - |
| 140 | - // Configuration options variables |
| 141 | - private ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy(); |
| 142 | - private BlobTransferPolicy blobTransferPolicy; |
| 143 | - private RedeliveryPolicy redeliveryPolicy; |
| 144 | - private MessageTransformer transformer; |
| 145 | - |
| 146 | - private boolean disableTimeStampsByDefault; |
| 147 | - private boolean optimizedMessageDispatch = true; |
| 148 | - private boolean copyMessageOnSend = true; |
| 149 | - private boolean useCompression; |
| 150 | - private boolean objectMessageSerializationDefered; |
| 151 | - private boolean useAsyncSend; |
| 152 | - private boolean optimizeAcknowledge; |
| 153 | - private boolean nestedMapAndListEnabled = true; |
| 154 | - private boolean useRetroactiveConsumer; |
| 155 | - private boolean exclusiveConsumer; |
| 156 | - private boolean alwaysSyncSend; |
| 157 | - private int closeTimeout = 15000; |
| 158 | - private boolean watchTopicAdvisories = true; |
| 159 | - private long warnAboutUnstartedConnectionTimeout = 500L; |
| 160 | - private int sendTimeout =0; |
| 161 | - private boolean sendAcksAsync=true; |
| 162 | - private boolean checkForDuplicates = true; |
| 163 | - |
| 164 | - private final Transport transport; |
| 165 | - private final IdGenerator clientIdGenerator; |
| 166 | - private final JMSStatsImpl factoryStats; |
| 167 | - private final JMSConnectionStatsImpl stats; |
| 168 | - |
| 169 | - private final AtomicBoolean started = new AtomicBoolean(false); |
| 170 | - private final AtomicBoolean closing = new AtomicBoolean(false); |
| 171 | - private final AtomicBoolean closed = new AtomicBoolean(false); |
| 172 | - private final AtomicBoolean transportFailed = new AtomicBoolean(false); |
| 173 | - private final CopyOnWriteArrayList<ActiveMQSession> sessions = new CopyOnWriteArrayList<ActiveMQSession>(); |
| 174 | - private final CopyOnWriteArrayList<ActiveMQConnectionConsumer> connectionConsumers = new CopyOnWriteArrayList<ActiveMQConnectionConsumer>(); |
| 175 | - private final CopyOnWriteArrayList<ActiveMQInputStream> inputStreams = new CopyOnWriteArrayList<ActiveMQInputStream>(); |
| 176 | - private final CopyOnWriteArrayList<ActiveMQOutputStream> outputStreams = new CopyOnWriteArrayList<ActiveMQOutputStream>(); |
| 177 | - private final CopyOnWriteArrayList<TransportListener> transportListeners = new CopyOnWriteArrayList<TransportListener>(); |
| 178 | - |
| 179 | - // Maps ConsumerIds to ActiveMQConsumer objects |
| 180 | - private final ConcurrentHashMap<ConsumerId, ActiveMQDispatcher> dispatchers = new ConcurrentHashMap<ConsumerId, ActiveMQDispatcher>(); |
| 181 | - private final ConcurrentHashMap<ProducerId, ActiveMQMessageProducer> producers = new ConcurrentHashMap<ProducerId, ActiveMQMessageProducer>(); |
| 182 | - private final LongSequenceGenerator sessionIdGenerator = new LongSequenceGenerator(); |
| 183 | - private final SessionId connectionSessionId; |
| 184 | - private final LongSequenceGenerator consumerIdGenerator = new LongSequenceGenerator(); |
| 185 | - private final LongSequenceGenerator producerIdGenerator = new LongSequenceGenerator(); |
| 186 | - private final LongSequenceGenerator tempDestinationIdGenerator = new LongSequenceGenerator(); |
| 187 | - private final LongSequenceGenerator localTransactionIdGenerator = new LongSequenceGenerator(); |
| 188 | - |
| 189 | - private AdvisoryConsumer advisoryConsumer; |
| 190 | - private final CountDownLatch brokerInfoReceived = new CountDownLatch(1); |
| 191 | - private BrokerInfo brokerInfo; |
| 192 | - private IOException firstFailureError; |
| 193 | - private int producerWindowSize = ActiveMQConnectionFactory.DEFAULT_PRODUCER_WINDOW_SIZE; |
| 194 | - |
| 195 | - // Assume that protocol is the latest. Change to the actual protocol |
| 196 | - // version when a WireFormatInfo is received. |
| 197 | - private final AtomicInteger protocolVersion = new AtomicInteger(CommandTypes.PROTOCOL_VERSION); |
| 198 | - private final long timeCreated; |
| 199 | - private final ConnectionAudit connectionAudit = new ConnectionAudit(); |
| 200 | - private DestinationSource destinationSource; |
| 201 | - private final Object ensureConnectionInfoSentMutex = new Object(); |
| 202 | - private boolean useDedicatedTaskRunner; |
| 203 | - protected volatile CountDownLatch transportInterruptionProcessingComplete; |
| 204 | - private long consumerFailoverRedeliveryWaitPeriod; |
| 205 | - private final Scheduler scheduler; |
| 206 | - private boolean messagePrioritySupported=true; |
| 207 | - |
| 208 | - /** |
| 209 | - * Construct an <code>ActiveMQConnection</code> |
| 210 | - * |
| 211 | - * @param transport |
| 212 | - * @param factoryStats |
| 213 | - * @throws Exception |
| 214 | - */ |
| 215 | - protected ActiveMQConnection(final Transport transport, IdGenerator clientIdGenerator, JMSStatsImpl factoryStats) throws Exception { |
| 216 | - |
| 217 | - this.transport = transport; |
| 218 | - this.clientIdGenerator = clientIdGenerator; |
| 219 | - this.factoryStats = factoryStats; |
| 220 | - |
| 221 | - // Configure a single threaded executor who's core thread can timeout if |
| 222 | - // idle |
| 223 | - executor = new ThreadPoolExecutor(1, 1, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new ThreadFactory() { |
| 224 | - public Thread newThread(Runnable r) { |
| 225 | - Thread thread = new Thread(r, "ActiveMQ Connection Executor: " + transport); |
| 226 | - thread.setDaemon(true); |
| 227 | - return thread; |
| 228 | - } |
| 229 | - }); |
| 230 | - // asyncConnectionThread.allowCoreThreadTimeOut(true); |
| 231 | - String uniqueId = CONNECTION_ID_GENERATOR.generateId(); |
| 232 | - this.info = new ConnectionInfo(new ConnectionId(uniqueId)); |
| 233 | - this.info.setManageable(true); |
| 234 | - this.info.setFaultTolerant(transport.isFaultTolerant()); |
| 235 | - this.connectionSessionId = new SessionId(info.getConnectionId(), -1); |
| 236 | - |
| 237 | - this.transport.setTransportListener(this); |
| 238 | - |
| 239 | - this.stats = new JMSConnectionStatsImpl(sessions, this instanceof XAConnection); |
| 240 | - this.factoryStats.addConnection(this); |
| 241 | - this.timeCreated = System.currentTimeMillis(); |
| 242 | - this.connectionAudit.setCheckForDuplicates(transport.isFaultTolerant()); |
| 243 | - this.scheduler = new Scheduler("ActiveMQConnection["+uniqueId+"] Scheduler"); |
| 244 | - this.scheduler.start(); |
| 245 | - } |
| 246 | - |
| 247 | - protected void setUserName(String userName) { |
| 248 | - this.info.setUserName(userName); |
| 249 | - } |
| 250 | - |
| 251 | - protected void setPassword(String password) { |
| 252 | - this.info.setPassword(password); |
| 253 | - } |
| 254 | - |
| 255 | - /** |
| 256 | - * A static helper method to create a new connection |
| 257 | - * |
| 258 | - * @return an ActiveMQConnection |
| 259 | - * @throws JMSException |
| 260 | - */ |
| 261 | - public static ActiveMQConnection makeConnection() throws JMSException { |
| 262 | - ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(); |
| 263 | - return (ActiveMQConnection)factory.createConnection(); |
| 264 | - } |
| 265 | - |
| 266 | - /** |
| 267 | - * A static helper method to create a new connection |
| 268 | - * |
| 269 | - * @param uri |
| 270 | - * @return and ActiveMQConnection |
| 271 | - * @throws JMSException |
| 272 | - */ |
| 273 | - public static ActiveMQConnection makeConnection(String uri) throws JMSException, URISyntaxException { |
| 274 | - ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(uri); |
| 275 | - return (ActiveMQConnection)factory.createConnection(); |
| 276 | - } |
| 277 | - |
| 278 | - /** |
| 279 | - * A static helper method to create a new connection |
| 280 | - * |
| 281 | - * @param user |
| 282 | - * @param password |
| 283 | - * @param uri |
| 284 | - * @return an ActiveMQConnection |
| 285 | - * @throws JMSException |
| 286 | - */ |
| 287 | - public static ActiveMQConnection makeConnection(String user, String password, String uri) throws JMSException, URISyntaxException { |
| 288 | - ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(user, password, new URI(uri)); |
| 289 | - return (ActiveMQConnection)factory.createConnection(); |
| 290 | - } |
| 291 | - |
| 292 | - /** |
| 293 | - * @return a number unique for this connection |
| 294 | - */ |
| 295 | - public JMSConnectionStatsImpl getConnectionStats() { |
| 296 | - return stats; |
| 297 | - } |
| 298 | - |
| 299 | - /** |
| 300 | - * Creates a <CODE>Session</CODE> object. |
| 301 | - * |
| 302 | - * @param transacted indicates whether the session is transacted |
| 303 | - * @param acknowledgeMode indicates whether the consumer or the client will |
| 304 | - * acknowledge any messages it receives; ignored if the |
| 305 | - * session is transacted. Legal values are |
| 306 | - * <code>Session.AUTO_ACKNOWLEDGE</code>, |
| 307 | - * <code>Session.CLIENT_ACKNOWLEDGE</code>, and |
| 308 | - * <code>Session.DUPS_OK_ACKNOWLEDGE</code>. |
| 309 | - * @return a newly created session |
| 310 | - * @throws JMSException if the <CODE>Connection</CODE> object fails to |
| 311 | - * create a session due to some internal error or lack of |
| 312 | - * support for the specific transaction and acknowledgement |
| 313 | - * mode. |
| 314 | - * @see Session#AUTO_ACKNOWLEDGE |
| 315 | - * @see Session#CLIENT_ACKNOWLEDGE |
| 316 | - * @see Session#DUPS_OK_ACKNOWLEDGE |
| 317 | - * @since 1.1 |
| 318 | - */ |
| 319 | - public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException { |
| 320 | - checkClosedOrFailed(); |
| 321 | - ensureConnectionInfoSent(); |
| 322 | - if(!transacted) { |
| 323 | - if (acknowledgeMode==Session.SESSION_TRANSACTED) { |
| 324 | - throw new JMSException("acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session"); |
| 325 | - } else if (acknowledgeMode < Session.SESSION_TRANSACTED || acknowledgeMode > ActiveMQSession.MAX_ACK_CONSTANT) { |
| 326 | - throw new JMSException("invalid acknowledgeMode: " + acknowledgeMode + ". Valid values are Session.AUTO_ACKNOWLEDGE (1), " + |
| 327 | - "Session.CLIENT_ACKNOWLEDGE (2), Session.DUPS_OK_ACKNOWLEDGE (3), ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE (4) or for transacted sessions Session.SESSION_TRANSACTED (0)"); |
| 328 | - } |
| 329 | - } |
| 330 | - return new ActiveMQSession(this, getNextSessionId(), transacted ? Session.SESSION_TRANSACTED : (acknowledgeMode == Session.SESSION_TRANSACTED |
| 331 | - ? Session.AUTO_ACKNOWLEDGE : acknowledgeMode), isDispatchAsync(), isAlwaysSessionAsync()); |
| 332 | - } |
| 333 | - |
| 334 | - /** |
| 335 | - * @return sessionId |
| 336 | - */ |
| 337 | - protected SessionId getNextSessionId() { |
| 338 | - return new SessionId(info.getConnectionId(), sessionIdGenerator.getNextSequenceId()); |
| 339 | - } |
| 340 | - |
| 341 | - /** |
| 342 | - * Gets the client identifier for this connection. |
| 343 | - * <P> |
| 344 | - * This value is specific to the JMS provider. It is either preconfigured by |
| 345 | - * an administrator in a <CODE> ConnectionFactory</CODE> object or assigned |
| 346 | - * dynamically by the application by calling the <code>setClientID</code> |
| 347 | - * method. |
| 348 | - * |
| 349 | - * @return the unique client identifier |
| 350 | - * @throws JMSException if the JMS provider fails to return the client ID |
| 351 | - * for this connection due to some internal error. |
| 352 | - */ |
| 353 | - public String getClientID() throws JMSException { |
| 354 | - checkClosedOrFailed(); |
| 355 | - return this.info.getClientId(); |
| 356 | - } |
| 357 | - |
| 358 | - /** |
| 359 | - * Sets the client identifier for this connection. |
| 360 | - * <P> |
| 361 | - * The preferred way to assign a JMS client's client identifier is for it to |
| 362 | - * be configured in a client-specific <CODE>ConnectionFactory</CODE> |
| 363 | - * object and transparently assigned to the <CODE>Connection</CODE> object |
| 364 | - * it creates. |
| 365 | - * <P> |
| 366 | - * Alternatively, a client can set a connection's client identifier using a |
| 367 | - * provider-specific value. The facility to set a connection's client |
| 368 | - * identifier explicitly is not a mechanism for overriding the identifier |
| 369 | - * that has been administratively configured. It is provided for the case |
| 370 | - * where no administratively specified identifier exists. If one does exist, |
| 371 | - * an attempt to change it by setting it must throw an |
| 372 | - * <CODE>IllegalStateException</CODE>. If a client sets the client |
| 373 | - * identifier explicitly, it must do so immediately after it creates the |
| 374 | - * connection and before any other action on the connection is taken. After |
| 375 | - * this point, setting the client identifier is a programming error that |
| 376 | - * should throw an <CODE>IllegalStateException</CODE>. |
| 377 | - * <P> |
| 378 | - * The purpose of the client identifier is to associate a connection and its |
| 379 | - * objects with a state maintained on behalf of the client by a provider. |
| 380 | - * The only such state identified by the JMS API is that required to support |
| 381 | - * durable subscriptions. |
| 382 | - * <P> |
| 383 | - * If another connection with the same <code>clientID</code> is already |
| 384 | - * running when this method is called, the JMS provider should detect the |
| 385 | - * duplicate ID and throw an <CODE>InvalidClientIDException</CODE>. |
| 386 | - * |
| 387 | - * @param newClientID the unique client identifier |
| 388 | - * @throws JMSException if the JMS provider fails to set the client ID for |
| 389 | - * this connection due to some internal error. |
| 390 | - * @throws javax.jms.InvalidClientIDException if the JMS client specifies an |
| 391 | - * invalid or duplicate client ID. |
| 392 | - * @throws javax.jms.IllegalStateException if the JMS client attempts to set |
| 393 | - * a connection's client ID at the wrong time or when it has |
| 394 | - * been administratively configured. |
| 395 | - */ |
| 396 | - public void setClientID(String newClientID) throws JMSException { |
| 397 | - checkClosedOrFailed(); |
| 398 | - |
| 399 | - if (this.clientIDSet) { |
| 400 | - throw new IllegalStateException("The clientID has already been set"); |
| 401 | - } |
| 402 | - |
| 403 | - if (this.isConnectionInfoSentToBroker) { |
| 404 | - throw new IllegalStateException("Setting clientID on a used Connection is not allowed"); |
| 405 | - } |
| 406 | - |
| 407 | - this.info.setClientId(newClientID); |
| 408 | - this.userSpecifiedClientID = true; |
| 409 | - ensureConnectionInfoSent(); |
| 410 | - } |
| 411 | - |
| 412 | - /** |
| 413 | - * Sets the default client id that the connection will use if explicitly not |
| 414 | - * set with the setClientId() call. |
| 415 | - */ |
| 416 | - public void setDefaultClientID(String clientID) throws JMSException { |
| 417 | - this.info.setClientId(clientID); |
| 418 | - this.userSpecifiedClientID = true; |
| 419 | - } |
| 420 | - |
| 421 | - /** |
| 422 | - * Gets the metadata for this connection. |
| 423 | - * |
| 424 | - * @return the connection metadata |
| 425 | - * @throws JMSException if the JMS provider fails to get the connection |
| 426 | - * metadata for this connection. |
| 427 | - * @see javax.jms.ConnectionMetaData |
| 428 | - */ |
| 429 | - public ConnectionMetaData getMetaData() throws JMSException { |
| 430 | - checkClosedOrFailed(); |
| 431 | - return ActiveMQConnectionMetaData.INSTANCE; |
| 432 | - } |
| 433 | - |
| 434 | - /** |
| 435 | - * Gets the <CODE>ExceptionListener</CODE> object for this connection. Not |
| 436 | - * every <CODE>Connection</CODE> has an <CODE>ExceptionListener</CODE> |
| 437 | - * associated with it. |
| 438 | - * |
| 439 | - * @return the <CODE>ExceptionListener</CODE> for this connection, or |
| 440 | - * null, if no <CODE>ExceptionListener</CODE> is associated with |
| 441 | - * this connection. |
| 442 | - * @throws JMSException if the JMS provider fails to get the |
| 443 | - * <CODE>ExceptionListener</CODE> for this connection. |
| 444 | - * @see javax.jms.Connection#setExceptionListener(ExceptionListener) |
| 445 | - */ |
| 446 | - public ExceptionListener getExceptionListener() throws JMSException { |
| 447 | - checkClosedOrFailed(); |
| 448 | - return this.exceptionListener; |
| 449 | - } |
| 450 | - |
| 451 | - /** |
| 452 | - * Sets an exception listener for this connection. |
| 453 | - * <P> |
| 454 | - * If a JMS provider detects a serious problem with a connection, it informs |
| 455 | - * the connection's <CODE> ExceptionListener</CODE>, if one has been |
| 456 | - * registered. It does this by calling the listener's <CODE>onException |
| 457 | - * </CODE> |
| 458 | - * method, passing it a <CODE>JMSException</CODE> object describing the |
| 459 | - * problem. |
| 460 | - * <P> |
| 461 | - * An exception listener allows a client to be notified of a problem |
| 462 | - * asynchronously. Some connections only consume messages, so they would |
| 463 | - * have no other way to learn their connection has failed. |
| 464 | - * <P> |
| 465 | - * A connection serializes execution of its <CODE>ExceptionListener</CODE>. |
| 466 | - * <P> |
| 467 | - * A JMS provider should attempt to resolve connection problems itself |
| 468 | - * before it notifies the client of them. |
| 469 | - * |
| 470 | - * @param listener the exception listener |
| 471 | - * @throws JMSException if the JMS provider fails to set the exception |
| 472 | - * listener for this connection. |
| 473 | - */ |
| 474 | - public void setExceptionListener(ExceptionListener listener) throws JMSException { |
| 475 | - checkClosedOrFailed(); |
| 476 | - this.exceptionListener = listener; |
| 477 | - } |
| 478 | - |
| 479 | - /** |
| 480 | - * Gets the <code>ClientInternalExceptionListener</code> object for this connection. |
| 481 | - * Not every <CODE>ActiveMQConnectionn</CODE> has a <CODE>ClientInternalExceptionListener</CODE> |
| 482 | - * associated with it. |
| 483 | - * |
| 484 | - * @return the listener or <code>null</code> if no listener is registered with the connection. |
| 485 | - */ |
| 486 | - public ClientInternalExceptionListener getClientInternalExceptionListener() |
| 487 | - { |
| 488 | - return clientInternalExceptionListener; |
| 489 | - } |
| 490 | - |
| 491 | - /** |
| 492 | - * Sets a client internal exception listener for this connection. |
| 493 | - * The connection will notify the listener, if one has been registered, of exceptions thrown by container components |
| 494 | - * (e.g. an EJB container in case of Message Driven Beans) during asynchronous processing of a message. |
| 495 | - * It does this by calling the listener's <code>onException()</code> method passing it a <code>Throwable</code> |
| 496 | - * describing the problem. |
| 497 | - * |
| 498 | - * @param listener the exception listener |
| 499 | - */ |
| 500 | - public void setClientInternalExceptionListener(ClientInternalExceptionListener listener) |
| 501 | - { |
| 502 | - this.clientInternalExceptionListener = listener; |
| 503 | - } |
| 504 | - |
| 505 | - /** |
| 506 | - * Starts (or restarts) a connection's delivery of incoming messages. A call |
| 507 | - * to <CODE>start</CODE> on a connection that has already been started is |
| 508 | - * ignored. |
| 509 | - * |
| 510 | - * @throws JMSException if the JMS provider fails to start message delivery |
| 511 | - * due to some internal error. |
| 512 | - * @see javax.jms.Connection#stop() |
| 513 | - */ |
| 514 | - public void start() throws JMSException { |
| 515 | - checkClosedOrFailed(); |
| 516 | - ensureConnectionInfoSent(); |
| 517 | - if (started.compareAndSet(false, true)) { |
| 518 | - for (Iterator<ActiveMQSession> i = sessions.iterator(); i.hasNext();) { |
| 519 | - ActiveMQSession session = i.next(); |
| 520 | - session.start(); |
| 521 | - } |
| 522 | - } |
| 523 | - } |
| 524 | - |
| 525 | - /** |
| 526 | - * Temporarily stops a connection's delivery of incoming messages. Delivery |
| 527 | - * can be restarted using the connection's <CODE>start</CODE> method. When |
| 528 | - * the connection is stopped, delivery to all the connection's message |
| 529 | - * consumers is inhibited: synchronous receives block, and messages are not |
| 530 | - * delivered to message listeners. |
| 531 | - * <P> |
| 532 | - * This call blocks until receives and/or message listeners in progress have |
| 533 | - * completed. |
| 534 | - * <P> |
| 535 | - * Stopping a connection has no effect on its ability to send messages. A |
| 536 | - * call to <CODE>stop</CODE> on a connection that has already been stopped |
| 537 | - * is ignored. |
| 538 | - * <P> |
| 539 | - * A call to <CODE>stop</CODE> must not return until delivery of messages |
| 540 | - * has paused. This means that a client can rely on the fact that none of |
| 541 | - * its message listeners will be called and that all threads of control |
| 542 | - * waiting for <CODE>receive</CODE> calls to return will not return with a |
| 543 | - * message until the connection is restarted. The receive timers for a |
| 544 | - * stopped connection continue to advance, so receives may time out while |
| 545 | - * the connection is stopped. |
| 546 | - * <P> |
| 547 | - * If message listeners are running when <CODE>stop</CODE> is invoked, the |
| 548 | - * <CODE>stop</CODE> call must wait until all of them have returned before |
| 549 | - * it may return. While these message listeners are completing, they must |
| 550 | - * have the full services of the connection available to them. |
| 551 | - * |
| 552 | - * @throws JMSException if the JMS provider fails to stop message delivery |
| 553 | - * due to some internal error. |
| 554 | - * @see javax.jms.Connection#start() |
| 555 | - */ |
| 556 | - public void stop() throws JMSException { |
| 557 | - checkClosedOrFailed(); |
| 558 | - if (started.compareAndSet(true, false)) { |
| 559 | - synchronized(sessions) { |
| 560 | - for (Iterator<ActiveMQSession> i = sessions.iterator(); i.hasNext();) { |
| 561 | - ActiveMQSession s = i.next(); |
| 562 | - s.stop(); |
| 563 | - } |
| 564 | - } |
| 565 | - } |
| 566 | - } |
| 567 | - |
| 568 | - /** |
| 569 | - * Closes the connection. |
| 570 | - * <P> |
| 571 | - * Since a provider typically allocates significant resources outside the |
| 572 | - * JVM on behalf of a connection, clients should close these resources when |
| 573 | - * they are not needed. Relying on garbage collection to eventually reclaim |
| 574 | - * these resources may not be timely enough. |
| 575 | - * <P> |
| 576 | - * There is no need to close the sessions, producers, and consumers of a |
| 577 | - * closed connection. |
| 578 | - * <P> |
| 579 | - * Closing a connection causes all temporary destinations to be deleted. |
| 580 | - * <P> |
| 581 | - * When this method is invoked, it should not return until message |
| 582 | - * processing has been shut down in an orderly fashion. This means that all |
| 583 | - * message listeners that may have been running have returned, and that all |
| 584 | - * pending receives have returned. A close terminates all pending message |
| 585 | - * receives on the connection's sessions' consumers. The receives may return |
| 586 | - * with a message or with null, depending on whether there was a message |
| 587 | - * available at the time of the close. If one or more of the connection's |
| 588 | - * sessions' message listeners is processing a message at the time when |
| 589 | - * connection <CODE>close</CODE> is invoked, all the facilities of the |
| 590 | - * connection and its sessions must remain available to those listeners |
| 591 | - * until they return control to the JMS provider. |
| 592 | - * <P> |
| 593 | - * Closing a connection causes any of its sessions' transactions in progress |
| 594 | - * to be rolled back. In the case where a session's work is coordinated by |
| 595 | - * an external transaction manager, a session's <CODE>commit</CODE> and |
| 596 | - * <CODE> rollback</CODE> methods are not used and the result of a closed |
| 597 | - * session's work is determined later by the transaction manager. Closing a |
| 598 | - * connection does NOT force an acknowledgment of client-acknowledged |
| 599 | - * sessions. |
| 600 | - * <P> |
| 601 | - * Invoking the <CODE>acknowledge</CODE> method of a received message from |
| 602 | - * a closed connection's session must throw an |
| 603 | - * <CODE>IllegalStateException</CODE>. Closing a closed connection must |
| 604 | - * NOT throw an exception. |
| 605 | - * |
| 606 | - * @throws JMSException if the JMS provider fails to close the connection |
| 607 | - * due to some internal error. For example, a failure to |
| 608 | - * release resources or to close a socket connection can |
| 609 | - * cause this exception to be thrown. |
| 610 | - */ |
| 611 | - public void close() throws JMSException { |
| 612 | - try { |
| 613 | - // If we were running, lets stop first. |
| 614 | - if (!closed.get() && !transportFailed.get()) { |
| 615 | - stop(); |
| 616 | - } |
| 617 | - |
| 618 | - synchronized (this) { |
| 619 | - if (!closed.get()) { |
| 620 | - closing.set(true); |
| 621 | - |
| 622 | - if (destinationSource != null) { |
| 623 | - destinationSource.stop(); |
| 624 | - destinationSource = null; |
| 625 | - } |
| 626 | - if (advisoryConsumer != null) { |
| 627 | - advisoryConsumer.dispose(); |
| 628 | - advisoryConsumer = null; |
| 629 | - } |
| 630 | - if (this.scheduler != null) { |
| 631 | - try { |
| 632 | - this.scheduler.stop(); |
| 633 | - } catch (Exception e) { |
| 634 | - JMSException ex = JMSExceptionSupport.create(e); |
| 635 | - throw ex; |
| 636 | - } |
| 637 | - } |
| 638 | - |
| 639 | - long lastDeliveredSequenceId = 0; |
| 640 | - for (Iterator<ActiveMQSession> i = this.sessions.iterator(); i.hasNext();) { |
| 641 | - ActiveMQSession s = i.next(); |
| 642 | - s.dispose(); |
| 643 | - lastDeliveredSequenceId = Math.max(lastDeliveredSequenceId, s.getLastDeliveredSequenceId()); |
| 644 | - } |
| 645 | - for (Iterator<ActiveMQConnectionConsumer> i = this.connectionConsumers.iterator(); i.hasNext();) { |
| 646 | - ActiveMQConnectionConsumer c = i.next(); |
| 647 | - c.dispose(); |
| 648 | - } |
| 649 | - for (Iterator<ActiveMQInputStream> i = this.inputStreams.iterator(); i.hasNext();) { |
| 650 | - ActiveMQInputStream c = i.next(); |
| 651 | - c.dispose(); |
| 652 | - } |
| 653 | - for (Iterator<ActiveMQOutputStream> i = this.outputStreams.iterator(); i.hasNext();) { |
| 654 | - ActiveMQOutputStream c = i.next(); |
| 655 | - c.dispose(); |
| 656 | - } |
| 657 | - |
| 658 | - // As TemporaryQueue and TemporaryTopic instances are bound |
| 659 | - // to a connection we should just delete them after the connection |
| 660 | - // is closed to free up memory |
| 661 | - for (Iterator<ActiveMQTempDestination> i = this.activeTempDestinations.values().iterator(); i.hasNext();) { |
| 662 | - ActiveMQTempDestination c = i.next(); |
| 663 | - c.delete(); |
| 664 | - } |
| 665 | - |
| 666 | - if (isConnectionInfoSentToBroker) { |
| 667 | - // If we announced ourselfs to the broker.. Try to let |
| 668 | - // the broker |
| 669 | - // know that the connection is being shutdown. |
| 670 | - RemoveInfo removeCommand = info.createRemoveCommand(); |
| 671 | - removeCommand.setLastDeliveredSequenceId(lastDeliveredSequenceId); |
| 672 | - doSyncSendPacket(info.createRemoveCommand(), closeTimeout); |
| 673 | - doAsyncSendPacket(new ShutdownInfo()); |
| 674 | - } |
| 675 | - |
| 676 | - ServiceSupport.dispose(this.transport); |
| 677 | - |
| 678 | - started.set(false); |
| 679 | - |
| 680 | - // TODO if we move the TaskRunnerFactory to the connection |
| 681 | - // factory |
| 682 | - // then we may need to call |
| 683 | - // factory.onConnectionClose(this); |
| 684 | - if (sessionTaskRunner != null) { |
| 685 | - sessionTaskRunner.shutdown(); |
| 686 | - } |
| 687 | - closed.set(true); |
| 688 | - closing.set(false); |
| 689 | - } |
| 690 | - } |
| 691 | - } finally { |
| 692 | - try { |
| 693 | - if (executor != null){ |
| 694 | - executor.shutdown(); |
| 695 | - } |
| 696 | - }catch(Throwable e) { |
| 697 | - LOG.error("Error shutting down thread pool " + e,e); |
| 698 | - } |
| 699 | - factoryStats.removeConnection(this); |
| 700 | - } |
| 701 | - } |
| 702 | - |
| 703 | - /** |
| 704 | - * Tells the broker to terminate its VM. This can be used to cleanly |
| 705 | - * terminate a broker running in a standalone java process. Server must have |
| 706 | - * property enable.vm.shutdown=true defined to allow this to work. |
| 707 | - */ |
| 708 | - // TODO : org.apache.activemq.message.BrokerAdminCommand not yet |
| 709 | - // implemented. |
| 710 | - /* |
| 711 | - * public void terminateBrokerVM() throws JMSException { BrokerAdminCommand |
| 712 | - * command = new BrokerAdminCommand(); |
| 713 | - * command.setCommand(BrokerAdminCommand.SHUTDOWN_SERVER_VM); |
| 714 | - * asyncSendPacket(command); } |
| 715 | - */ |
| 716 | - |
| 717 | - /** |
| 718 | - * Create a durable connection consumer for this connection (optional |
| 719 | - * operation). This is an expert facility not used by regular JMS clients. |
| 720 | - * |
| 721 | - * @param topic topic to access |
| 722 | - * @param subscriptionName durable subscription name |
| 723 | - * @param messageSelector only messages with properties matching the message |
| 724 | - * selector expression are delivered. A value of null or an |
| 725 | - * empty string indicates that there is no message selector |
| 726 | - * for the message consumer. |
| 727 | - * @param sessionPool the server session pool to associate with this durable |
| 728 | - * connection consumer |
| 729 | - * @param maxMessages the maximum number of messages that can be assigned to |
| 730 | - * a server session at one time |
| 731 | - * @return the durable connection consumer |
| 732 | - * @throws JMSException if the <CODE>Connection</CODE> object fails to |
| 733 | - * create a connection consumer due to some internal error |
| 734 | - * or invalid arguments for <CODE>sessionPool</CODE> and |
| 735 | - * <CODE>messageSelector</CODE>. |
| 736 | - * @throws javax.jms.InvalidDestinationException if an invalid destination |
| 737 | - * is specified. |
| 738 | - * @throws javax.jms.InvalidSelectorException if the message selector is |
| 739 | - * invalid. |
| 740 | - * @see javax.jms.ConnectionConsumer |
| 741 | - * @since 1.1 |
| 742 | - */ |
| 743 | - public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) |
| 744 | - throws JMSException { |
| 745 | - return this.createDurableConnectionConsumer(topic, subscriptionName, messageSelector, sessionPool, maxMessages, false); |
| 746 | - } |
| 747 | - |
| 748 | - /** |
| 749 | - * Create a durable connection consumer for this connection (optional |
| 750 | - * operation). This is an expert facility not used by regular JMS clients. |
| 751 | - * |
| 752 | - * @param topic topic to access |
| 753 | - * @param subscriptionName durable subscription name |
| 754 | - * @param messageSelector only messages with properties matching the message |
| 755 | - * selector expression are delivered. A value of null or an |
| 756 | - * empty string indicates that there is no message selector |
| 757 | - * for the message consumer. |
| 758 | - * @param sessionPool the server session pool to associate with this durable |
| 759 | - * connection consumer |
| 760 | - * @param maxMessages the maximum number of messages that can be assigned to |
| 761 | - * a server session at one time |
| 762 | - * @param noLocal set true if you want to filter out messages published |
| 763 | - * locally |
| 764 | - * @return the durable connection consumer |
| 765 | - * @throws JMSException if the <CODE>Connection</CODE> object fails to |
| 766 | - * create a connection consumer due to some internal error |
| 767 | - * or invalid arguments for <CODE>sessionPool</CODE> and |
| 768 | - * <CODE>messageSelector</CODE>. |
| 769 | - * @throws javax.jms.InvalidDestinationException if an invalid destination |
| 770 | - * is specified. |
| 771 | - * @throws javax.jms.InvalidSelectorException if the message selector is |
| 772 | - * invalid. |
| 773 | - * @see javax.jms.ConnectionConsumer |
| 774 | - * @since 1.1 |
| 775 | - */ |
| 776 | - public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages, |
| 777 | - boolean noLocal) throws JMSException { |
| 778 | - checkClosedOrFailed(); |
| 779 | - ensureConnectionInfoSent(); |
| 780 | - SessionId sessionId = new SessionId(info.getConnectionId(), -1); |
| 781 | - ConsumerInfo info = new ConsumerInfo(new ConsumerId(sessionId, consumerIdGenerator.getNextSequenceId())); |
| 782 | - info.setDestination(ActiveMQMessageTransformation.transformDestination(topic)); |
| 783 | - info.setSubscriptionName(subscriptionName); |
| 784 | - info.setSelector(messageSelector); |
| 785 | - info.setPrefetchSize(maxMessages); |
| 786 | - info.setDispatchAsync(isDispatchAsync()); |
| 787 | - |
| 788 | - // Allows the options on the destination to configure the consumerInfo |
| 789 | - if (info.getDestination().getOptions() != null) { |
| 790 | - Map<String, String> options = new HashMap<String, String>(info.getDestination().getOptions()); |
| 791 | - IntrospectionSupport.setProperties(this.info, options, "consumer."); |
| 792 | - } |
| 793 | - |
| 794 | - return new ActiveMQConnectionConsumer(this, sessionPool, info); |
| 795 | - } |
| 796 | - |
| 797 | - // Properties |
| 798 | - // ------------------------------------------------------------------------- |
| 799 | - |
| 800 | - /** |
| 801 | - * Returns true if this connection has been started |
| 802 | - * |
| 803 | - * @return true if this Connection is started |
| 804 | - */ |
| 805 | - public boolean isStarted() { |
| 806 | - return started.get(); |
| 807 | - } |
| 808 | - |
| 809 | - /** |
| 810 | - * Returns true if the connection is closed |
| 811 | - */ |
| 812 | - public boolean isClosed() { |
| 813 | - return closed.get(); |
| 814 | - } |
| 815 | - |
| 816 | - /** |
| 817 | - * Returns true if the connection is in the process of being closed |
| 818 | - */ |
| 819 | - public boolean isClosing() { |
| 820 | - return closing.get(); |
| 821 | - } |
| 822 | - |
| 823 | - /** |
| 824 | - * Returns true if the underlying transport has failed |
| 825 | - */ |
| 826 | - public boolean isTransportFailed() { |
| 827 | - return transportFailed.get(); |
| 828 | - } |
| 829 | - |
| 830 | - /** |
| 831 | - * @return Returns the prefetchPolicy. |
| 832 | - */ |
| 833 | - public ActiveMQPrefetchPolicy getPrefetchPolicy() { |
| 834 | - return prefetchPolicy; |
| 835 | - } |
| 836 | - |
| 837 | - /** |
| 838 | - * Sets the <a |
| 839 | - * href="http://activemq.apache.org/what-is-the-prefetch-limit-for.html">prefetch |
| 840 | - * policy</a> for consumers created by this connection. |
| 841 | - */ |
| 842 | - public void setPrefetchPolicy(ActiveMQPrefetchPolicy prefetchPolicy) { |
| 843 | - this.prefetchPolicy = prefetchPolicy; |
| 844 | - } |
| 845 | - |
| 846 | - /** |
| 847 | - */ |
| 848 | - public Transport getTransportChannel() { |
| 849 | - return transport; |
| 850 | - } |
| 851 | - |
| 852 | - /** |
| 853 | - * @return Returns the clientID of the connection, forcing one to be |
| 854 | - * generated if one has not yet been configured. |
| 855 | - */ |
| 856 | - public String getInitializedClientID() throws JMSException { |
| 857 | - ensureConnectionInfoSent(); |
| 858 | - return info.getClientId(); |
| 859 | - } |
| 860 | - |
| 861 | - /** |
| 862 | - * @return Returns the timeStampsDisableByDefault. |
| 863 | - */ |
| 864 | - public boolean isDisableTimeStampsByDefault() { |
| 865 | - return disableTimeStampsByDefault; |
| 866 | - } |
| 867 | - |
| 868 | - /** |
| 869 | - * Sets whether or not timestamps on messages should be disabled or not. If |
| 870 | - * you disable them it adds a small performance boost. |
| 871 | - */ |
| 872 | - public void setDisableTimeStampsByDefault(boolean timeStampsDisableByDefault) { |
| 873 | - this.disableTimeStampsByDefault = timeStampsDisableByDefault; |
| 874 | - } |
| 875 | - |
| 876 | - /** |
| 877 | - * @return Returns the dispatchOptimizedMessage. |
| 878 | - */ |
| 879 | - public boolean isOptimizedMessageDispatch() { |
| 880 | - return optimizedMessageDispatch; |
| 881 | - } |
| 882 | - |
| 883 | - /** |
| 884 | - * If this flag is set then an larger prefetch limit is used - only |
| 885 | - * applicable for durable topic subscribers. |
| 886 | - */ |
| 887 | - public void setOptimizedMessageDispatch(boolean dispatchOptimizedMessage) { |
| 888 | - this.optimizedMessageDispatch = dispatchOptimizedMessage; |
| 889 | - } |
| 890 | - |
| 891 | - /** |
| 892 | - * @return Returns the closeTimeout. |
| 893 | - */ |
| 894 | - public int getCloseTimeout() { |
| 895 | - return closeTimeout; |
| 896 | - } |
| 897 | - |
| 898 | - /** |
| 899 | - * Sets the timeout before a close is considered complete. Normally a |
| 900 | - * close() on a connection waits for confirmation from the broker; this |
| 901 | - * allows that operation to timeout to save the client hanging if there is |
| 902 | - * no broker |
| 903 | - */ |
| 904 | - public void setCloseTimeout(int closeTimeout) { |
| 905 | - this.closeTimeout = closeTimeout; |
| 906 | - } |
| 907 | - |
| 908 | - /** |
| 909 | - * @return ConnectionInfo |
| 910 | - */ |
| 911 | - public ConnectionInfo getConnectionInfo() { |
| 912 | - return this.info; |
| 913 | - } |
| 914 | - |
| 915 | - public boolean isUseRetroactiveConsumer() { |
| 916 | - return useRetroactiveConsumer; |
| 917 | - } |
| 918 | - |
| 919 | - /** |
| 920 | - * Sets whether or not retroactive consumers are enabled. Retroactive |
| 921 | - * consumers allow non-durable topic subscribers to receive old messages |
| 922 | - * that were published before the non-durable subscriber started. |
| 923 | - */ |
| 924 | - public void setUseRetroactiveConsumer(boolean useRetroactiveConsumer) { |
| 925 | - this.useRetroactiveConsumer = useRetroactiveConsumer; |
| 926 | - } |
| 927 | - |
| 928 | - public boolean isNestedMapAndListEnabled() { |
| 929 | - return nestedMapAndListEnabled; |
| 930 | - } |
| 931 | - |
| 932 | - /** |
| 933 | - * Enables/disables whether or not Message properties and MapMessage entries |
| 934 | - * support <a |
| 935 | - * href="http://activemq.apache.org/structured-message-properties-and-mapmessages.html">Nested |
| 936 | - * Structures</a> of Map and List objects |
| 937 | - */ |
| 938 | - public void setNestedMapAndListEnabled(boolean structuredMapsEnabled) { |
| 939 | - this.nestedMapAndListEnabled = structuredMapsEnabled; |
| 940 | - } |
| 941 | - |
| 942 | - public boolean isExclusiveConsumer() { |
| 943 | - return exclusiveConsumer; |
| 944 | - } |
| 945 | - |
| 946 | - /** |
| 947 | - * Enables or disables whether or not queue consumers should be exclusive or |
| 948 | - * not for example to preserve ordering when not using <a |
| 949 | - * href="http://activemq.apache.org/message-groups.html">Message Groups</a> |
| 950 | - * |
| 951 | - * @param exclusiveConsumer |
| 952 | - */ |
| 953 | - public void setExclusiveConsumer(boolean exclusiveConsumer) { |
| 954 | - this.exclusiveConsumer = exclusiveConsumer; |
| 955 | - } |
| 956 | - |
| 957 | - /** |
| 958 | - * Adds a transport listener so that a client can be notified of events in |
| 959 | - * the underlying transport |
| 960 | - */ |
| 961 | - public void addTransportListener(TransportListener transportListener) { |
| 962 | - transportListeners.add(transportListener); |
| 963 | - } |
| 964 | - |
| 965 | - public void removeTransportListener(TransportListener transportListener) { |
| 966 | - transportListeners.remove(transportListener); |
| 967 | - } |
| 968 | - |
| 969 | - public boolean isUseDedicatedTaskRunner() { |
| 970 | - return useDedicatedTaskRunner; |
| 971 | - } |
| 972 | - |
| 973 | - public void setUseDedicatedTaskRunner(boolean useDedicatedTaskRunner) { |
| 974 | - this.useDedicatedTaskRunner = useDedicatedTaskRunner; |
| 975 | - } |
| 976 | - |
| 977 | - public TaskRunnerFactory getSessionTaskRunner() { |
| 978 | - synchronized (this) { |
| 979 | - if (sessionTaskRunner == null) { |
| 980 | - sessionTaskRunner = new TaskRunnerFactory("ActiveMQ Session Task", ThreadPriorities.INBOUND_CLIENT_SESSION, false, 1000, isUseDedicatedTaskRunner()); |
| 981 | - } |
| 982 | - } |
| 983 | - return sessionTaskRunner; |
| 984 | - } |
| 985 | - |
| 986 | - public void setSessionTaskRunner(TaskRunnerFactory sessionTaskRunner) { |
| 987 | - this.sessionTaskRunner = sessionTaskRunner; |
| 988 | - } |
| 989 | - |
| 990 | - public MessageTransformer getTransformer() { |
| 991 | - return transformer; |
| 992 | - } |
| 993 | - |
| 994 | - /** |
| 995 | - * Sets the transformer used to transform messages before they are sent on |
| 996 | - * to the JMS bus or when they are received from the bus but before they are |
| 997 | - * delivered to the JMS client |
| 998 | - */ |
| 999 | - public void setTransformer(MessageTransformer transformer) { |
| 1000 | - this.transformer = transformer; |
| 1001 | - } |
| 1002 | - |
| 1003 | - /** |
| 1004 | - * @return the statsEnabled |
| 1005 | - */ |
| 1006 | - public boolean isStatsEnabled() { |
| 1007 | - return this.stats.isEnabled(); |
| 1008 | - } |
| 1009 | - |
| 1010 | - /** |
| 1011 | - * @param statsEnabled the statsEnabled to set |
| 1012 | - */ |
| 1013 | - public void setStatsEnabled(boolean statsEnabled) { |
| 1014 | - this.stats.setEnabled(statsEnabled); |
| 1015 | - } |
| 1016 | - |
| 1017 | - /** |
| 1018 | - * Returns the {@link DestinationSource} object which can be used to listen to destinations |
| 1019 | - * being created or destroyed or to enquire about the current destinations available on the broker |
| 1020 | - * |
| 1021 | - * @return a lazily created destination source |
| 1022 | - * @throws JMSException |
| 1023 | - */ |
| 1024 | - public DestinationSource getDestinationSource() throws JMSException { |
| 1025 | - if (destinationSource == null) { |
| 1026 | - destinationSource = new DestinationSource(this); |
| 1027 | - destinationSource.start(); |
| 1028 | - } |
| 1029 | - return destinationSource; |
| 1030 | - } |
| 1031 | - |
| 1032 | - // Implementation methods |
| 1033 | - // ------------------------------------------------------------------------- |
| 1034 | - |
| 1035 | - /** |
| 1036 | - * Used internally for adding Sessions to the Connection |
| 1037 | - * |
| 1038 | - * @param session |
| 1039 | - * @throws JMSException |
| 1040 | - * @throws JMSException |
| 1041 | - */ |
| 1042 | - protected void addSession(ActiveMQSession session) throws JMSException { |
| 1043 | - this.sessions.add(session); |
| 1044 | - if (sessions.size() > 1 || session.isTransacted()) { |
| 1045 | - optimizedMessageDispatch = false; |
| 1046 | - } |
| 1047 | - } |
| 1048 | - |
| 1049 | - /** |
| 1050 | - * Used interanlly for removing Sessions from a Connection |
| 1051 | - * |
| 1052 | - * @param session |
| 1053 | - */ |
| 1054 | - protected void removeSession(ActiveMQSession session) { |
| 1055 | - this.sessions.remove(session); |
| 1056 | - this.removeDispatcher(session); |
| 1057 | - } |
| 1058 | - |
| 1059 | - /** |
| 1060 | - * Add a ConnectionConsumer |
| 1061 | - * |
| 1062 | - * @param connectionConsumer |
| 1063 | - * @throws JMSException |
| 1064 | - */ |
| 1065 | - protected void addConnectionConsumer(ActiveMQConnectionConsumer connectionConsumer) throws JMSException { |
| 1066 | - this.connectionConsumers.add(connectionConsumer); |
| 1067 | - } |
| 1068 | - |
| 1069 | - /** |
| 1070 | - * Remove a ConnectionConsumer |
| 1071 | - * |
| 1072 | - * @param connectionConsumer |
| 1073 | - */ |
| 1074 | - protected void removeConnectionConsumer(ActiveMQConnectionConsumer connectionConsumer) { |
| 1075 | - this.connectionConsumers.remove(connectionConsumer); |
| 1076 | - this.removeDispatcher(connectionConsumer); |
| 1077 | - } |
| 1078 | - |
| 1079 | - /** |
| 1080 | - * Creates a <CODE>TopicSession</CODE> object. |
| 1081 | - * |
| 1082 | - * @param transacted indicates whether the session is transacted |
| 1083 | - * @param acknowledgeMode indicates whether the consumer or the client will |
| 1084 | - * acknowledge any messages it receives; ignored if the |
| 1085 | - * session is transacted. Legal values are |
| 1086 | - * <code>Session.AUTO_ACKNOWLEDGE</code>, |
| 1087 | - * <code>Session.CLIENT_ACKNOWLEDGE</code>, and |
| 1088 | - * <code>Session.DUPS_OK_ACKNOWLEDGE</code>. |
| 1089 | - * @return a newly created topic session |
| 1090 | - * @throws JMSException if the <CODE>TopicConnection</CODE> object fails |
| 1091 | - * to create a session due to some internal error or lack of |
| 1092 | - * support for the specific transaction and acknowledgement |
| 1093 | - * mode. |
| 1094 | - * @see Session#AUTO_ACKNOWLEDGE |
| 1095 | - * @see Session#CLIENT_ACKNOWLEDGE |
| 1096 | - * @see Session#DUPS_OK_ACKNOWLEDGE |
| 1097 | - */ |
| 1098 | - public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException { |
| 1099 | - return new ActiveMQTopicSession((ActiveMQSession)createSession(transacted, acknowledgeMode)); |
| 1100 | - } |
| 1101 | - |
| 1102 | - /** |
| 1103 | - * Creates a connection consumer for this connection (optional operation). |
| 1104 | - * This is an expert facility not used by regular JMS clients. |
| 1105 | - * |
| 1106 | - * @param topic the topic to access |
| 1107 | - * @param messageSelector only messages with properties matching the message |
| 1108 | - * selector expression are delivered. A value of null or an |
| 1109 | - * empty string indicates that there is no message selector |
| 1110 | - * for the message consumer. |
| 1111 | - * @param sessionPool the server session pool to associate with this |
| 1112 | - * connection consumer |
| 1113 | - * @param maxMessages the maximum number of messages that can be assigned to |
| 1114 | - * a server session at one time |
| 1115 | - * @return the connection consumer |
| 1116 | - * @throws JMSException if the <CODE>TopicConnection</CODE> object fails |
| 1117 | - * to create a connection consumer due to some internal |
| 1118 | - * error or invalid arguments for <CODE>sessionPool</CODE> |
| 1119 | - * and <CODE>messageSelector</CODE>. |
| 1120 | - * @throws javax.jms.InvalidDestinationException if an invalid topic is |
| 1121 | - * specified. |
| 1122 | - * @throws javax.jms.InvalidSelectorException if the message selector is |
| 1123 | - * invalid. |
| 1124 | - * @see javax.jms.ConnectionConsumer |
| 1125 | - */ |
| 1126 | - public ConnectionConsumer createConnectionConsumer(Topic topic, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException { |
| 1127 | - return createConnectionConsumer(topic, messageSelector, sessionPool, maxMessages, false); |
| 1128 | - } |
| 1129 | - |
| 1130 | - /** |
| 1131 | - * Creates a connection consumer for this connection (optional operation). |
| 1132 | - * This is an expert facility not used by regular JMS clients. |
| 1133 | - * |
| 1134 | - * @param queue the queue to access |
| 1135 | - * @param messageSelector only messages with properties matching the message |
| 1136 | - * selector expression are delivered. A value of null or an |
| 1137 | - * empty string indicates that there is no message selector |
| 1138 | - * for the message consumer. |
| 1139 | - * @param sessionPool the server session pool to associate with this |
| 1140 | - * connection consumer |
| 1141 | - * @param maxMessages the maximum number of messages that can be assigned to |
| 1142 | - * a server session at one time |
| 1143 | - * @return the connection consumer |
| 1144 | - * @throws JMSException if the <CODE>QueueConnection</CODE> object fails |
| 1145 | - * to create a connection consumer due to some internal |
| 1146 | - * error or invalid arguments for <CODE>sessionPool</CODE> |
| 1147 | - * and <CODE>messageSelector</CODE>. |
| 1148 | - * @throws javax.jms.InvalidDestinationException if an invalid queue is |
| 1149 | - * specified. |
| 1150 | - * @throws javax.jms.InvalidSelectorException if the message selector is |
| 1151 | - * invalid. |
| 1152 | - * @see javax.jms.ConnectionConsumer |
| 1153 | - */ |
| 1154 | - public ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException { |
| 1155 | - return createConnectionConsumer(queue, messageSelector, sessionPool, maxMessages, false); |
| 1156 | - } |
| 1157 | - |
| 1158 | - /** |
| 1159 | - * Creates a connection consumer for this connection (optional operation). |
| 1160 | - * This is an expert facility not used by regular JMS clients. |
| 1161 | - * |
| 1162 | - * @param destination the destination to access |
| 1163 | - * @param messageSelector only messages with properties matching the message |
| 1164 | - * selector expression are delivered. A value of null or an |
| 1165 | - * empty string indicates that there is no message selector |
| 1166 | - * for the message consumer. |
| 1167 | - * @param sessionPool the server session pool to associate with this |
| 1168 | - * connection consumer |
| 1169 | - * @param maxMessages the maximum number of messages that can be assigned to |
| 1170 | - * a server session at one time |
| 1171 | - * @return the connection consumer |
| 1172 | - * @throws JMSException if the <CODE>Connection</CODE> object fails to |
| 1173 | - * create a connection consumer due to some internal error |
| 1174 | - * or invalid arguments for <CODE>sessionPool</CODE> and |
| 1175 | - * <CODE>messageSelector</CODE>. |
| 1176 | - * @throws javax.jms.InvalidDestinationException if an invalid destination |
| 1177 | - * is specified. |
| 1178 | - * @throws javax.jms.InvalidSelectorException if the message selector is |
| 1179 | - * invalid. |
| 1180 | - * @see javax.jms.ConnectionConsumer |
| 1181 | - * @since 1.1 |
| 1182 | - */ |
| 1183 | - public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException { |
| 1184 | - return createConnectionConsumer(destination, messageSelector, sessionPool, maxMessages, false); |
| 1185 | - } |
| 1186 | - |
| 1187 | - public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages, boolean noLocal) |
| 1188 | - throws JMSException { |
| 1189 | - |
| 1190 | - checkClosedOrFailed(); |
| 1191 | - ensureConnectionInfoSent(); |
| 1192 | - |
| 1193 | - ConsumerId consumerId = createConsumerId(); |
| 1194 | - ConsumerInfo consumerInfo = new ConsumerInfo(consumerId); |
| 1195 | - consumerInfo.setDestination(ActiveMQMessageTransformation.transformDestination(destination)); |
| 1196 | - consumerInfo.setSelector(messageSelector); |
| 1197 | - consumerInfo.setPrefetchSize(maxMessages); |
| 1198 | - consumerInfo.setNoLocal(noLocal); |
| 1199 | - consumerInfo.setDispatchAsync(isDispatchAsync()); |
| 1200 | - |
| 1201 | - // Allows the options on the destination to configure the consumerInfo |
| 1202 | - if (consumerInfo.getDestination().getOptions() != null) { |
| 1203 | - Map<String, String> options = new HashMap<String, String>(consumerInfo.getDestination().getOptions()); |
| 1204 | - IntrospectionSupport.setProperties(consumerInfo, options, "consumer."); |
| 1205 | - } |
| 1206 | - |
| 1207 | - return new ActiveMQConnectionConsumer(this, sessionPool, consumerInfo); |
| 1208 | - } |
| 1209 | - |
| 1210 | - /** |
| 1211 | - * @return |
| 1212 | - */ |
| 1213 | - private ConsumerId createConsumerId() { |
| 1214 | - return new ConsumerId(connectionSessionId, consumerIdGenerator.getNextSequenceId()); |
| 1215 | - } |
| 1216 | - |
| 1217 | - /** |
| 1218 | - * @return |
| 1219 | - */ |
| 1220 | - private ProducerId createProducerId() { |
| 1221 | - return new ProducerId(connectionSessionId, producerIdGenerator.getNextSequenceId()); |
| 1222 | - } |
| 1223 | - |
| 1224 | - /** |
| 1225 | - * Creates a <CODE>QueueSession</CODE> object. |
| 1226 | - * |
| 1227 | - * @param transacted indicates whether the session is transacted |
| 1228 | - * @param acknowledgeMode indicates whether the consumer or the client will |
| 1229 | - * acknowledge any messages it receives; ignored if the |
| 1230 | - * session is transacted. Legal values are |
| 1231 | - * <code>Session.AUTO_ACKNOWLEDGE</code>, |
| 1232 | - * <code>Session.CLIENT_ACKNOWLEDGE</code>, and |
| 1233 | - * <code>Session.DUPS_OK_ACKNOWLEDGE</code>. |
| 1234 | - * @return a newly created queue session |
| 1235 | - * @throws JMSException if the <CODE>QueueConnection</CODE> object fails |
| 1236 | - * to create a session due to some internal error or lack of |
| 1237 | - * support for the specific transaction and acknowledgement |
| 1238 | - * mode. |
| 1239 | - * @see Session#AUTO_ACKNOWLEDGE |
| 1240 | - * @see Session#CLIENT_ACKNOWLEDGE |
| 1241 | - * @see Session#DUPS_OK_ACKNOWLEDGE |
| 1242 | - */ |
| 1243 | - public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException { |
| 1244 | - return new ActiveMQQueueSession((ActiveMQSession)createSession(transacted, acknowledgeMode)); |
| 1245 | - } |
| 1246 | - |
| 1247 | - /** |
| 1248 | - * Ensures that the clientID was manually specified and not auto-generated. |
| 1249 | - * If the clientID was not specified this method will throw an exception. |
| 1250 | - * This method is used to ensure that the clientID + durableSubscriber name |
| 1251 | - * are used correctly. |
| 1252 | - * |
| 1253 | - * @throws JMSException |
| 1254 | - */ |
| 1255 | - public void checkClientIDWasManuallySpecified() throws JMSException { |
| 1256 | - if (!userSpecifiedClientID) { |
| 1257 | - throw new JMSException("You cannot create a durable subscriber without specifying a unique clientID on a Connection"); |
| 1258 | - } |
| 1259 | - } |
| 1260 | - |
| 1261 | - /** |
| 1262 | - * send a Packet through the Connection - for internal use only |
| 1263 | - * |
| 1264 | - * @param command |
| 1265 | - * @throws JMSException |
| 1266 | - */ |
| 1267 | - public void asyncSendPacket(Command command) throws JMSException { |
| 1268 | - if (isClosed()) { |
| 1269 | - throw new ConnectionClosedException(); |
| 1270 | - } else { |
| 1271 | - doAsyncSendPacket(command); |
| 1272 | - } |
| 1273 | - } |
| 1274 | - |
| 1275 | - private void doAsyncSendPacket(Command command) throws JMSException { |
| 1276 | - try { |
| 1277 | - this.transport.oneway(command); |
| 1278 | - } catch (IOException e) { |
| 1279 | - throw JMSExceptionSupport.create(e); |
| 1280 | - } |
| 1281 | - } |
| 1282 | - |
| 1283 | - /** |
| 1284 | - * Send a packet through a Connection - for internal use only |
| 1285 | - * |
| 1286 | - * @param command |
| 1287 | - * @return |
| 1288 | - * @throws JMSException |
| 1289 | - */ |
| 1290 | - public Response syncSendPacket(Command command) throws JMSException { |
| 1291 | - if (isClosed()) { |
| 1292 | - throw new ConnectionClosedException(); |
| 1293 | - } else { |
| 1294 | - |
| 1295 | - try { |
| 1296 | - Response response = (Response)this.transport.request(command); |
| 1297 | - if (response.isException()) { |
| 1298 | - ExceptionResponse er = (ExceptionResponse)response; |
| 1299 | - if (er.getException() instanceof JMSException) { |
| 1300 | - throw (JMSException)er.getException(); |
| 1301 | - } else { |
| 1302 | - if (isClosed()||closing.get()) { |
| 1303 | - LOG.debug("Received an exception but connection is closing"); |
| 1304 | - } |
| 1305 | - JMSException jmsEx = null; |
| 1306 | - try { |
| 1307 | - jmsEx = JMSExceptionSupport.create(er.getException()); |
| 1308 | - }catch(Throwable e) { |
| 1309 | - LOG.error("Caught an exception trying to create a JMSException for " +er.getException(),e); |
| 1310 | - } |
| 1311 | - if(jmsEx !=null) { |
| 1312 | - throw jmsEx; |
| 1313 | - } |
| 1314 | - } |
| 1315 | - } |
| 1316 | - return response; |
| 1317 | - } catch (IOException e) { |
| 1318 | - throw JMSExceptionSupport.create(e); |
| 1319 | - } |
| 1320 | - } |
| 1321 | - } |
| 1322 | - |
| 1323 | - /** |
| 1324 | - * Send a packet through a Connection - for internal use only |
| 1325 | - * |
| 1326 | - * @param command |
| 1327 | - * @return |
| 1328 | - * @throws JMSException |
| 1329 | - */ |
| 1330 | - public Response syncSendPacket(Command command, int timeout) throws JMSException { |
| 1331 | - if (isClosed() || closing.get()) { |
| 1332 | - throw new ConnectionClosedException(); |
| 1333 | - } else { |
| 1334 | - return doSyncSendPacket(command, timeout); |
| 1335 | - } |
| 1336 | - } |
| 1337 | - |
| 1338 | - private Response doSyncSendPacket(Command command, int timeout) |
| 1339 | - throws JMSException { |
| 1340 | - try { |
| 1341 | - Response response = (Response) (timeout > 0 |
| 1342 | - ? this.transport.request(command, timeout) |
| 1343 | - : this.transport.request(command)); |
| 1344 | - if (response != null && response.isException()) { |
| 1345 | - ExceptionResponse er = (ExceptionResponse)response; |
| 1346 | - if (er.getException() instanceof JMSException) { |
| 1347 | - throw (JMSException)er.getException(); |
| 1348 | - } else { |
| 1349 | - throw JMSExceptionSupport.create(er.getException()); |
| 1350 | - } |
| 1351 | - } |
| 1352 | - return response; |
| 1353 | - } catch (IOException e) { |
| 1354 | - throw JMSExceptionSupport.create(e); |
| 1355 | - } |
| 1356 | - } |
| 1357 | - |
| 1358 | - /** |
| 1359 | - * @return statistics for this Connection |
| 1360 | - */ |
| 1361 | - public StatsImpl getStats() { |
| 1362 | - return stats; |
| 1363 | - } |
| 1364 | - |
| 1365 | - /** |
| 1366 | - * simply throws an exception if the Connection is already closed or the |
| 1367 | - * Transport has failed |
| 1368 | - * |
| 1369 | - * @throws JMSException |
| 1370 | - */ |
| 1371 | - protected synchronized void checkClosedOrFailed() throws JMSException { |
| 1372 | - checkClosed(); |
| 1373 | - if (transportFailed.get()) { |
| 1374 | - throw new ConnectionFailedException(firstFailureError); |
| 1375 | - } |
| 1376 | - } |
| 1377 | - |
| 1378 | - /** |
| 1379 | - * simply throws an exception if the Connection is already closed |
| 1380 | - * |
| 1381 | - * @throws JMSException |
| 1382 | - */ |
| 1383 | - protected synchronized void checkClosed() throws JMSException { |
| 1384 | - if (closed.get()) { |
| 1385 | - throw new ConnectionClosedException(); |
| 1386 | - } |
| 1387 | - } |
| 1388 | - |
| 1389 | - /** |
| 1390 | - * Send the ConnectionInfo to the Broker |
| 1391 | - * |
| 1392 | - * @throws JMSException |
| 1393 | - */ |
| 1394 | - protected void ensureConnectionInfoSent() throws JMSException { |
| 1395 | - synchronized(this.ensureConnectionInfoSentMutex) { |
| 1396 | - // Can we skip sending the ConnectionInfo packet?? |
| 1397 | - if (isConnectionInfoSentToBroker || closed.get()) { |
| 1398 | - return; |
| 1399 | - } |
| 1400 | - //TODO shouldn't this check be on userSpecifiedClientID rather than the value of clientID? |
| 1401 | - if (info.getClientId() == null || info.getClientId().trim().length() == 0) { |
| 1402 | - info.setClientId(clientIdGenerator.generateId()); |
| 1403 | - } |
| 1404 | - syncSendPacket(info.copy()); |
| 1405 | - |
| 1406 | - this.isConnectionInfoSentToBroker = true; |
| 1407 | - // Add a temp destination advisory consumer so that |
| 1408 | - // We know what the valid temporary destinations are on the |
| 1409 | - // broker without having to do an RPC to the broker. |
| 1410 | - |
| 1411 | - ConsumerId consumerId = new ConsumerId(new SessionId(info.getConnectionId(), -1), consumerIdGenerator.getNextSequenceId()); |
| 1412 | - if (watchTopicAdvisories) { |
| 1413 | - advisoryConsumer = new AdvisoryConsumer(this, consumerId); |
| 1414 | - } |
| 1415 | - } |
| 1416 | - } |
| 1417 | - |
| 1418 | - public synchronized boolean isWatchTopicAdvisories() { |
| 1419 | - return watchTopicAdvisories; |
| 1420 | - } |
| 1421 | - |
| 1422 | - public synchronized void setWatchTopicAdvisories(boolean watchTopicAdvisories) { |
| 1423 | - this.watchTopicAdvisories = watchTopicAdvisories; |
| 1424 | - } |
| 1425 | - |
| 1426 | - /** |
| 1427 | - * @return Returns the useAsyncSend. |
| 1428 | - */ |
| 1429 | - public boolean isUseAsyncSend() { |
| 1430 | - return useAsyncSend; |
| 1431 | - } |
| 1432 | - |
| 1433 | - /** |
| 1434 | - * Forces the use of <a |
| 1435 | - * href="http://activemq.apache.org/async-sends.html">Async Sends</a> which |
| 1436 | - * adds a massive performance boost; but means that the send() method will |
| 1437 | - * return immediately whether the message has been sent or not which could |
| 1438 | - * lead to message loss. |
| 1439 | - */ |
| 1440 | - public void setUseAsyncSend(boolean useAsyncSend) { |
| 1441 | - this.useAsyncSend = useAsyncSend; |
| 1442 | - } |
| 1443 | - |
| 1444 | - /** |
| 1445 | - * @return true if always sync send messages |
| 1446 | - */ |
| 1447 | - public boolean isAlwaysSyncSend() { |
| 1448 | - return this.alwaysSyncSend; |
| 1449 | - } |
| 1450 | - |
| 1451 | - /** |
| 1452 | - * Set true if always require messages to be sync sent |
| 1453 | - * |
| 1454 | - * @param alwaysSyncSend |
| 1455 | - */ |
| 1456 | - public void setAlwaysSyncSend(boolean alwaysSyncSend) { |
| 1457 | - this.alwaysSyncSend = alwaysSyncSend; |
| 1458 | - } |
| 1459 | - |
| 1460 | - /** |
| 1461 | - * @return the messagePrioritySupported |
| 1462 | - */ |
| 1463 | - public boolean isMessagePrioritySupported() { |
| 1464 | - return this.messagePrioritySupported; |
| 1465 | - } |
| 1466 | - |
| 1467 | - /** |
| 1468 | - * @param messagePrioritySupported the messagePrioritySupported to set |
| 1469 | - */ |
| 1470 | - public void setMessagePrioritySupported(boolean messagePrioritySupported) { |
| 1471 | - this.messagePrioritySupported = messagePrioritySupported; |
| 1472 | - } |
| 1473 | - |
| 1474 | - /** |
| 1475 | - * Cleans up this connection so that it's state is as if the connection was |
| 1476 | - * just created. This allows the Resource Adapter to clean up a connection |
| 1477 | - * so that it can be reused without having to close and recreate the |
| 1478 | - * connection. |
| 1479 | - */ |
| 1480 | - public void cleanup() throws JMSException { |
| 1481 | - |
| 1482 | - if (advisoryConsumer != null && !isTransportFailed()) { |
| 1483 | - advisoryConsumer.dispose(); |
| 1484 | - advisoryConsumer = null; |
| 1485 | - } |
| 1486 | - |
| 1487 | - for (Iterator<ActiveMQSession> i = this.sessions.iterator(); i.hasNext();) { |
| 1488 | - ActiveMQSession s = i.next(); |
| 1489 | - s.dispose(); |
| 1490 | - } |
| 1491 | - for (Iterator<ActiveMQConnectionConsumer> i = this.connectionConsumers.iterator(); i.hasNext();) { |
| 1492 | - ActiveMQConnectionConsumer c = i.next(); |
| 1493 | - c.dispose(); |
| 1494 | - } |
| 1495 | - for (Iterator<ActiveMQInputStream> i = this.inputStreams.iterator(); i.hasNext();) { |
| 1496 | - ActiveMQInputStream c = i.next(); |
| 1497 | - c.dispose(); |
| 1498 | - } |
| 1499 | - for (Iterator<ActiveMQOutputStream> i = this.outputStreams.iterator(); i.hasNext();) { |
| 1500 | - ActiveMQOutputStream c = i.next(); |
| 1501 | - c.dispose(); |
| 1502 | - } |
| 1503 | - |
| 1504 | - if (isConnectionInfoSentToBroker) { |
| 1505 | - if (!transportFailed.get() && !closing.get()) { |
| 1506 | - syncSendPacket(info.createRemoveCommand()); |
| 1507 | - } |
| 1508 | - isConnectionInfoSentToBroker = false; |
| 1509 | - } |
| 1510 | - if (userSpecifiedClientID) { |
| 1511 | - info.setClientId(null); |
| 1512 | - userSpecifiedClientID = false; |
| 1513 | - } |
| 1514 | - clientIDSet = false; |
| 1515 | - |
| 1516 | - started.set(false); |
| 1517 | - } |
| 1518 | - |
| 1519 | - /** |
| 1520 | - * Changes the associated username/password that is associated with this |
| 1521 | - * connection. If the connection has been used, you must called cleanup() |
| 1522 | - * before calling this method. |
| 1523 | - * |
| 1524 | - * @throws IllegalStateException if the connection is in used. |
| 1525 | - */ |
| 1526 | - public void changeUserInfo(String userName, String password) throws JMSException { |
| 1527 | - if (isConnectionInfoSentToBroker) { |
| 1528 | - throw new IllegalStateException("changeUserInfo used Connection is not allowed"); |
| 1529 | - } |
| 1530 | - this.info.setUserName(userName); |
| 1531 | - this.info.setPassword(password); |
| 1532 | - } |
| 1533 | - |
| 1534 | - /** |
| 1535 | - * @return Returns the resourceManagerId. |
| 1536 | - * @throws JMSException |
| 1537 | - */ |
| 1538 | - public String getResourceManagerId() throws JMSException { |
| 1539 | - waitForBrokerInfo(); |
| 1540 | - if (brokerInfo == null) { |
| 1541 | - throw new JMSException("Connection failed before Broker info was received."); |
| 1542 | - } |
| 1543 | - return brokerInfo.getBrokerId().getValue(); |
| 1544 | - } |
| 1545 | - |
| 1546 | - /** |
| 1547 | - * Returns the broker name if one is available or null if one is not |
| 1548 | - * available yet. |
| 1549 | - */ |
| 1550 | - public String getBrokerName() { |
| 1551 | - try { |
| 1552 | - brokerInfoReceived.await(5, TimeUnit.SECONDS); |
| 1553 | - if (brokerInfo == null) { |
| 1554 | - return null; |
| 1555 | - } |
| 1556 | - return brokerInfo.getBrokerName(); |
| 1557 | - } catch (InterruptedException e) { |
| 1558 | - Thread.currentThread().interrupt(); |
| 1559 | - return null; |
| 1560 | - } |
| 1561 | - } |
| 1562 | - |
| 1563 | - /** |
| 1564 | - * Returns the broker information if it is available or null if it is not |
| 1565 | - * available yet. |
| 1566 | - */ |
| 1567 | - public BrokerInfo getBrokerInfo() { |
| 1568 | - return brokerInfo; |
| 1569 | - } |
| 1570 | - |
| 1571 | - /** |
| 1572 | - * @return Returns the RedeliveryPolicy. |
| 1573 | - * @throws JMSException |
| 1574 | - */ |
| 1575 | - public RedeliveryPolicy getRedeliveryPolicy() throws JMSException { |
| 1576 | - return redeliveryPolicy; |
| 1577 | - } |
| 1578 | - |
| 1579 | - /** |
| 1580 | - * Sets the redelivery policy to be used when messages are rolled back |
| 1581 | - */ |
| 1582 | - public void setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy) { |
| 1583 | - this.redeliveryPolicy = redeliveryPolicy; |
| 1584 | - } |
| 1585 | - |
| 1586 | - public BlobTransferPolicy getBlobTransferPolicy() { |
| 1587 | - if (blobTransferPolicy == null) { |
| 1588 | - blobTransferPolicy = createBlobTransferPolicy(); |
| 1589 | - } |
| 1590 | - return blobTransferPolicy; |
| 1591 | - } |
| 1592 | - |
| 1593 | - /** |
| 1594 | - * Sets the policy used to describe how out-of-band BLOBs (Binary Large |
| 1595 | - * OBjects) are transferred from producers to brokers to consumers |
| 1596 | - */ |
| 1597 | - public void setBlobTransferPolicy(BlobTransferPolicy blobTransferPolicy) { |
| 1598 | - this.blobTransferPolicy = blobTransferPolicy; |
| 1599 | - } |
| 1600 | - |
| 1601 | - /** |
| 1602 | - * @return Returns the alwaysSessionAsync. |
| 1603 | - */ |
| 1604 | - public boolean isAlwaysSessionAsync() { |
| 1605 | - return alwaysSessionAsync; |
| 1606 | - } |
| 1607 | - |
| 1608 | - /** |
| 1609 | - * If this flag is set then a separate thread is not used for dispatching |
| 1610 | - * messages for each Session in the Connection. However, a separate thread |
| 1611 | - * is always used if there is more than one session, or the session isn't in |
| 1612 | - * auto acknowledge or duplicates ok mode |
| 1613 | - */ |
| 1614 | - public void setAlwaysSessionAsync(boolean alwaysSessionAsync) { |
| 1615 | - this.alwaysSessionAsync = alwaysSessionAsync; |
| 1616 | - } |
| 1617 | - |
| 1618 | - /** |
| 1619 | - * @return Returns the optimizeAcknowledge. |
| 1620 | - */ |
| 1621 | - public boolean isOptimizeAcknowledge() { |
| 1622 | - return optimizeAcknowledge; |
| 1623 | - } |
| 1624 | - |
| 1625 | - /** |
| 1626 | - * Enables an optimised acknowledgement mode where messages are acknowledged |
| 1627 | - * in batches rather than individually |
| 1628 | - * |
| 1629 | - * @param optimizeAcknowledge The optimizeAcknowledge to set. |
| 1630 | - */ |
| 1631 | - public void setOptimizeAcknowledge(boolean optimizeAcknowledge) { |
| 1632 | - this.optimizeAcknowledge = optimizeAcknowledge; |
| 1633 | - } |
| 1634 | - |
| 1635 | - public long getWarnAboutUnstartedConnectionTimeout() { |
| 1636 | - return warnAboutUnstartedConnectionTimeout; |
| 1637 | - } |
| 1638 | - |
| 1639 | - /** |
| 1640 | - * Enables the timeout from a connection creation to when a warning is |
| 1641 | - * generated if the connection is not properly started via {@link #start()} |
| 1642 | - * and a message is received by a consumer. It is a very common gotcha to |
| 1643 | - * forget to <a |
| 1644 | - * href="http://activemq.apache.org/i-am-not-receiving-any-messages-what-is-wrong.html">start |
| 1645 | - * the connection</a> so this option makes the default case to create a |
| 1646 | - * warning if the user forgets. To disable the warning just set the value to < |
| 1647 | - * 0 (say -1). |
| 1648 | - */ |
| 1649 | - public void setWarnAboutUnstartedConnectionTimeout(long warnAboutUnstartedConnectionTimeout) { |
| 1650 | - this.warnAboutUnstartedConnectionTimeout = warnAboutUnstartedConnectionTimeout; |
| 1651 | - } |
| 1652 | - |
| 1653 | - /** |
| 1654 | - * @return the sendTimeout |
| 1655 | - */ |
| 1656 | - public int getSendTimeout() { |
| 1657 | - return sendTimeout; |
| 1658 | - } |
| 1659 | - |
| 1660 | - /** |
| 1661 | - * @param sendTimeout the sendTimeout to set |
| 1662 | - */ |
| 1663 | - public void setSendTimeout(int sendTimeout) { |
| 1664 | - this.sendTimeout = sendTimeout; |
| 1665 | - } |
| 1666 | - |
| 1667 | - /** |
| 1668 | - * @return the sendAcksAsync |
| 1669 | - */ |
| 1670 | - public boolean isSendAcksAsync() { |
| 1671 | - return sendAcksAsync; |
| 1672 | - } |
| 1673 | - |
| 1674 | - /** |
| 1675 | - * @param sendAcksAsync the sendAcksAsync to set |
| 1676 | - */ |
| 1677 | - public void setSendAcksAsync(boolean sendAcksAsync) { |
| 1678 | - this.sendAcksAsync = sendAcksAsync; |
| 1679 | - } |
| 1680 | - |
| 1681 | - |
| 1682 | - /** |
| 1683 | - * Returns the time this connection was created |
| 1684 | - */ |
| 1685 | - public long getTimeCreated() { |
| 1686 | - return timeCreated; |
| 1687 | - } |
| 1688 | - |
| 1689 | - private void waitForBrokerInfo() throws JMSException { |
| 1690 | - try { |
| 1691 | - brokerInfoReceived.await(); |
| 1692 | - } catch (InterruptedException e) { |
| 1693 | - Thread.currentThread().interrupt(); |
| 1694 | - throw JMSExceptionSupport.create(e); |
| 1695 | - } |
| 1696 | - } |
| 1697 | - |
| 1698 | - // Package protected so that it can be used in unit tests |
| 1699 | - public Transport getTransport() { |
| 1700 | - return transport; |
| 1701 | - } |
| 1702 | - |
| 1703 | - public void addProducer(ProducerId producerId, ActiveMQMessageProducer producer) { |
| 1704 | - producers.put(producerId, producer); |
| 1705 | - } |
| 1706 | - |
| 1707 | - public void removeProducer(ProducerId producerId) { |
| 1708 | - producers.remove(producerId); |
| 1709 | - } |
| 1710 | - |
| 1711 | - public void addDispatcher(ConsumerId consumerId, ActiveMQDispatcher dispatcher) { |
| 1712 | - dispatchers.put(consumerId, dispatcher); |
| 1713 | - } |
| 1714 | - |
| 1715 | - public void removeDispatcher(ConsumerId consumerId) { |
| 1716 | - dispatchers.remove(consumerId); |
| 1717 | - } |
| 1718 | - |
| 1719 | - /** |
| 1720 | - * @param o - the command to consume |
| 1721 | - */ |
| 1722 | - public void onCommand(final Object o) { |
| 1723 | - final Command command = (Command)o; |
| 1724 | - if (!closed.get() && command != null) { |
| 1725 | - try { |
| 1726 | - command.visit(new CommandVisitorAdapter() { |
| 1727 | - @Override |
| 1728 | - public Response processMessageDispatch(MessageDispatch md) throws Exception { |
| 1729 | - waitForTransportInterruptionProcessingToComplete(); |
| 1730 | - ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId()); |
| 1731 | - if (dispatcher != null) { |
| 1732 | - // Copy in case a embedded broker is dispatching via |
| 1733 | - // vm:// |
| 1734 | - // md.getMessage() == null to signal end of queue |
| 1735 | - // browse. |
| 1736 | - Message msg = md.getMessage(); |
| 1737 | - if (msg != null) { |
| 1738 | - msg = msg.copy(); |
| 1739 | - msg.setReadOnlyBody(true); |
| 1740 | - msg.setReadOnlyProperties(true); |
| 1741 | - msg.setRedeliveryCounter(md.getRedeliveryCounter()); |
| 1742 | - msg.setConnection(ActiveMQConnection.this); |
| 1743 | - md.setMessage(msg); |
| 1744 | - } |
| 1745 | - dispatcher.dispatch(md); |
| 1746 | - } |
| 1747 | - return null; |
| 1748 | - } |
| 1749 | - |
| 1750 | - @Override |
| 1751 | - public Response processProducerAck(ProducerAck pa) throws Exception { |
| 1752 | - if (pa != null && pa.getProducerId() != null) { |
| 1753 | - ActiveMQMessageProducer producer = producers.get(pa.getProducerId()); |
| 1754 | - if (producer != null) { |
| 1755 | - producer.onProducerAck(pa); |
| 1756 | - } |
| 1757 | - } |
| 1758 | - return null; |
| 1759 | - } |
| 1760 | - |
| 1761 | - @Override |
| 1762 | - public Response processBrokerInfo(BrokerInfo info) throws Exception { |
| 1763 | - brokerInfo = info; |
| 1764 | - brokerInfoReceived.countDown(); |
| 1765 | - optimizeAcknowledge &= !brokerInfo.isFaultTolerantConfiguration(); |
| 1766 | - getBlobTransferPolicy().setBrokerUploadUrl(info.getBrokerUploadUrl()); |
| 1767 | - return null; |
| 1768 | - } |
| 1769 | - |
| 1770 | - @Override |
| 1771 | - public Response processConnectionError(final ConnectionError error) throws Exception { |
| 1772 | - executor.execute(new Runnable() { |
| 1773 | - public void run() { |
| 1774 | - onAsyncException(error.getException()); |
| 1775 | - } |
| 1776 | - }); |
| 1777 | - return null; |
| 1778 | - } |
| 1779 | - |
| 1780 | - @Override |
| 1781 | - public Response processControlCommand(ControlCommand command) throws Exception { |
| 1782 | - onControlCommand(command); |
| 1783 | - return null; |
| 1784 | - } |
| 1785 | - |
| 1786 | - @Override |
| 1787 | - public Response processConnectionControl(ConnectionControl control) throws Exception { |
| 1788 | - onConnectionControl((ConnectionControl)command); |
| 1789 | - return null; |
| 1790 | - } |
| 1791 | - |
| 1792 | - @Override |
| 1793 | - public Response processConsumerControl(ConsumerControl control) throws Exception { |
| 1794 | - onConsumerControl((ConsumerControl)command); |
| 1795 | - return null; |
| 1796 | - } |
| 1797 | - |
| 1798 | - @Override |
| 1799 | - public Response processWireFormat(WireFormatInfo info) throws Exception { |
| 1800 | - onWireFormatInfo((WireFormatInfo)command); |
| 1801 | - return null; |
| 1802 | - } |
| 1803 | - }); |
| 1804 | - } catch (Exception e) { |
| 1805 | - onClientInternalException(e); |
| 1806 | - } |
| 1807 | - |
| 1808 | - } |
| 1809 | - for (Iterator<TransportListener> iter = transportListeners.iterator(); iter.hasNext();) { |
| 1810 | - TransportListener listener = iter.next(); |
| 1811 | - listener.onCommand(command); |
| 1812 | - } |
| 1813 | - } |
| 1814 | - |
| 1815 | - protected void onWireFormatInfo(WireFormatInfo info) { |
| 1816 | - protocolVersion.set(info.getVersion()); |
| 1817 | - } |
| 1818 | - |
| 1819 | - /** |
| 1820 | - * Handles async client internal exceptions. |
| 1821 | - * A client internal exception is usually one that has been thrown |
| 1822 | - * by a container runtime component during asynchronous processing of a |
| 1823 | - * message that does not affect the connection itself. |
| 1824 | - * This method notifies the <code>ClientInternalExceptionListener</code> by invoking |
| 1825 | - * its <code>onException</code> method, if one has been registered with this connection. |
| 1826 | - * |
| 1827 | - * @param error the exception that the problem |
| 1828 | - */ |
| 1829 | - public void onClientInternalException(final Throwable error) { |
| 1830 | - if ( !closed.get() && !closing.get() ) { |
| 1831 | - if ( this.clientInternalExceptionListener != null ) { |
| 1832 | - executor.execute(new Runnable() { |
| 1833 | - public void run() { |
| 1834 | - ActiveMQConnection.this.clientInternalExceptionListener.onException(error); |
| 1835 | - } |
| 1836 | - }); |
| 1837 | - } else { |
| 1838 | - LOG.debug("Async client internal exception occurred with no exception listener registered: " |
| 1839 | - + error, error); |
| 1840 | - } |
| 1841 | - } |
| 1842 | - } |
| 1843 | - /** |
| 1844 | - * Used for handling async exceptions |
| 1845 | - * |
| 1846 | - * @param error |
| 1847 | - */ |
| 1848 | - public void onAsyncException(Throwable error) { |
| 1849 | - if (!closed.get() && !closing.get()) { |
| 1850 | - if (this.exceptionListener != null) { |
| 1851 | - |
| 1852 | - if (!(error instanceof JMSException)) { |
| 1853 | - error = JMSExceptionSupport.create(error); |
| 1854 | - } |
| 1855 | - final JMSException e = (JMSException)error; |
| 1856 | - |
| 1857 | - executor.execute(new Runnable() { |
| 1858 | - public void run() { |
| 1859 | - ActiveMQConnection.this.exceptionListener.onException(e); |
| 1860 | - } |
| 1861 | - }); |
| 1862 | - |
| 1863 | - } else { |
| 1864 | - LOG.debug("Async exception with no exception listener: " + error, error); |
| 1865 | - } |
| 1866 | - } |
| 1867 | - } |
| 1868 | - |
| 1869 | - public void onException(final IOException error) { |
| 1870 | - onAsyncException(error); |
| 1871 | - if (!closing.get() && !closed.get()) { |
| 1872 | - executor.execute(new Runnable() { |
| 1873 | - public void run() { |
| 1874 | - transportFailed(error); |
| 1875 | - ServiceSupport.dispose(ActiveMQConnection.this.transport); |
| 1876 | - brokerInfoReceived.countDown(); |
| 1877 | - try { |
| 1878 | - cleanup(); |
| 1879 | - } catch (JMSException e) { |
| 1880 | - LOG.warn("Exception during connection cleanup, " + e, e); |
| 1881 | - } |
| 1882 | - for (Iterator<TransportListener> iter = transportListeners |
| 1883 | - .iterator(); iter.hasNext();) { |
| 1884 | - TransportListener listener = iter.next(); |
| 1885 | - listener.onException(error); |
| 1886 | - } |
| 1887 | - } |
| 1888 | - }); |
| 1889 | - } |
| 1890 | - } |
| 1891 | - |
| 1892 | - public void transportInterupted() { |
| 1893 | - this.transportInterruptionProcessingComplete = new CountDownLatch(dispatchers.size() - (advisoryConsumer != null ? 1:0)); |
| 1894 | - if (LOG.isDebugEnabled()) { |
| 1895 | - LOG.debug("transport interrupted, dispatchers: " + transportInterruptionProcessingComplete.getCount()); |
| 1896 | - } |
| 1897 | - signalInterruptionProcessingNeeded(); |
| 1898 | - |
| 1899 | - for (Iterator<ActiveMQSession> i = this.sessions.iterator(); i.hasNext();) { |
| 1900 | - ActiveMQSession s = i.next(); |
| 1901 | - s.clearMessagesInProgress(); |
| 1902 | - } |
| 1903 | - |
| 1904 | - for (ActiveMQConnectionConsumer connectionConsumer : this.connectionConsumers) { |
| 1905 | - connectionConsumer.clearMessagesInProgress(); |
| 1906 | - } |
| 1907 | - |
| 1908 | - for (Iterator<TransportListener> iter = transportListeners.iterator(); iter.hasNext();) { |
| 1909 | - TransportListener listener = iter.next(); |
| 1910 | - listener.transportInterupted(); |
| 1911 | - } |
| 1912 | - } |
| 1913 | - |
| 1914 | - public void transportResumed() { |
| 1915 | - for (Iterator<TransportListener> iter = transportListeners.iterator(); iter.hasNext();) { |
| 1916 | - TransportListener listener = iter.next(); |
| 1917 | - listener.transportResumed(); |
| 1918 | - } |
| 1919 | - } |
| 1920 | - |
| 1921 | - /** |
| 1922 | - * Create the DestinationInfo object for the temporary destination. |
| 1923 | - * |
| 1924 | - * @param topic - if its true topic, else queue. |
| 1925 | - * @return DestinationInfo |
| 1926 | - * @throws JMSException |
| 1927 | - */ |
| 1928 | - protected ActiveMQTempDestination createTempDestination(boolean topic) throws JMSException { |
| 1929 | - |
| 1930 | - // Check if Destination info is of temporary type. |
| 1931 | - ActiveMQTempDestination dest; |
| 1932 | - if (topic) { |
| 1933 | - dest = new ActiveMQTempTopic(info.getConnectionId(), tempDestinationIdGenerator.getNextSequenceId()); |
| 1934 | - } else { |
| 1935 | - dest = new ActiveMQTempQueue(info.getConnectionId(), tempDestinationIdGenerator.getNextSequenceId()); |
| 1936 | - } |
| 1937 | - |
| 1938 | - DestinationInfo info = new DestinationInfo(); |
| 1939 | - info.setConnectionId(this.info.getConnectionId()); |
| 1940 | - info.setOperationType(DestinationInfo.ADD_OPERATION_TYPE); |
| 1941 | - info.setDestination(dest); |
| 1942 | - syncSendPacket(info); |
| 1943 | - |
| 1944 | - dest.setConnection(this); |
| 1945 | - activeTempDestinations.put(dest, dest); |
| 1946 | - return dest; |
| 1947 | - } |
| 1948 | - |
| 1949 | - /** |
| 1950 | - * @param destination |
| 1951 | - * @throws JMSException |
| 1952 | - */ |
| 1953 | - public void deleteTempDestination(ActiveMQTempDestination destination) throws JMSException { |
| 1954 | - |
| 1955 | - checkClosedOrFailed(); |
| 1956 | - |
| 1957 | - for (Iterator<ActiveMQSession> i = this.sessions.iterator(); i.hasNext();) { |
| 1958 | - ActiveMQSession s = i.next(); |
| 1959 | - if (s.isInUse(destination)) { |
| 1960 | - throw new JMSException("A consumer is consuming from the temporary destination"); |
| 1961 | - } |
| 1962 | - } |
| 1963 | - |
| 1964 | - activeTempDestinations.remove(destination); |
| 1965 | - |
| 1966 | - DestinationInfo destInfo = new DestinationInfo(); |
| 1967 | - destInfo.setConnectionId(this.info.getConnectionId()); |
| 1968 | - destInfo.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); |
| 1969 | - destInfo.setDestination(destination); |
| 1970 | - destInfo.setTimeout(0); |
| 1971 | - syncSendPacket(destInfo); |
| 1972 | - } |
| 1973 | - |
| 1974 | - public boolean isDeleted(ActiveMQDestination dest) { |
| 1975 | - |
| 1976 | - // If we are not watching the advisories.. then |
| 1977 | - // we will assume that the temp destination does exist. |
| 1978 | - if (advisoryConsumer == null) { |
| 1979 | - return false; |
| 1980 | - } |
| 1981 | - |
| 1982 | - return !activeTempDestinations.contains(dest); |
| 1983 | - } |
| 1984 | - |
| 1985 | - public boolean isCopyMessageOnSend() { |
| 1986 | - return copyMessageOnSend; |
| 1987 | - } |
| 1988 | - |
| 1989 | - public LongSequenceGenerator getLocalTransactionIdGenerator() { |
| 1990 | - return localTransactionIdGenerator; |
| 1991 | - } |
| 1992 | - |
| 1993 | - public boolean isUseCompression() { |
| 1994 | - return useCompression; |
| 1995 | - } |
| 1996 | - |
| 1997 | - /** |
| 1998 | - * Enables the use of compression of the message bodies |
| 1999 | - */ |
| 2000 | - public void setUseCompression(boolean useCompression) { |
| 2001 | - this.useCompression = useCompression; |
| 2002 | - } |
| 2003 | - |
| 2004 | - public void destroyDestination(ActiveMQDestination destination) throws JMSException { |
| 2005 | - |
| 2006 | - checkClosedOrFailed(); |
| 2007 | - ensureConnectionInfoSent(); |
| 2008 | - |
| 2009 | - DestinationInfo info = new DestinationInfo(); |
| 2010 | - info.setConnectionId(this.info.getConnectionId()); |
| 2011 | - info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE); |
| 2012 | - info.setDestination(destination); |
| 2013 | - info.setTimeout(0); |
| 2014 | - syncSendPacket(info); |
| 2015 | - |
| 2016 | - } |
| 2017 | - |
| 2018 | - public boolean isDispatchAsync() { |
| 2019 | - return dispatchAsync; |
| 2020 | - } |
| 2021 | - |
| 2022 | - /** |
| 2023 | - * Enables or disables the default setting of whether or not consumers have |
| 2024 | - * their messages <a |
| 2025 | - * href="http://activemq.apache.org/consumer-dispatch-async.html">dispatched |
| 2026 | - * synchronously or asynchronously by the broker</a>. For non-durable |
| 2027 | - * topics for example we typically dispatch synchronously by default to |
| 2028 | - * minimize context switches which boost performance. However sometimes its |
| 2029 | - * better to go slower to ensure that a single blocked consumer socket does |
| 2030 | - * not block delivery to other consumers. |
| 2031 | - * |
| 2032 | - * @param asyncDispatch If true then consumers created on this connection |
| 2033 | - * will default to having their messages dispatched |
| 2034 | - * asynchronously. The default value is false. |
| 2035 | - */ |
| 2036 | - public void setDispatchAsync(boolean asyncDispatch) { |
| 2037 | - this.dispatchAsync = asyncDispatch; |
| 2038 | - } |
| 2039 | - |
| 2040 | - public boolean isObjectMessageSerializationDefered() { |
| 2041 | - return objectMessageSerializationDefered; |
| 2042 | - } |
| 2043 | - |
| 2044 | - /** |
| 2045 | - * When an object is set on an ObjectMessage, the JMS spec requires the |
| 2046 | - * object to be serialized by that set method. Enabling this flag causes the |
| 2047 | - * object to not get serialized. The object may subsequently get serialized |
| 2048 | - * if the message needs to be sent over a socket or stored to disk. |
| 2049 | - */ |
| 2050 | - public void setObjectMessageSerializationDefered(boolean objectMessageSerializationDefered) { |
| 2051 | - this.objectMessageSerializationDefered = objectMessageSerializationDefered; |
| 2052 | - } |
| 2053 | - |
| 2054 | - public InputStream createInputStream(Destination dest) throws JMSException { |
| 2055 | - return createInputStream(dest, null); |
| 2056 | - } |
| 2057 | - |
| 2058 | - public InputStream createInputStream(Destination dest, String messageSelector) throws JMSException { |
| 2059 | - return createInputStream(dest, messageSelector, false); |
| 2060 | - } |
| 2061 | - |
| 2062 | - public InputStream createInputStream(Destination dest, String messageSelector, boolean noLocal) throws JMSException { |
| 2063 | - return createInputStream(dest, messageSelector, noLocal, -1); |
| 2064 | - } |
| 2065 | - |
| 2066 | - |
| 2067 | - |
| 2068 | - public InputStream createInputStream(Destination dest, String messageSelector, boolean noLocal, long timeout) throws JMSException { |
| 2069 | - return doCreateInputStream(dest, messageSelector, noLocal, null, timeout); |
| 2070 | - } |
| 2071 | - |
| 2072 | - public InputStream createDurableInputStream(Topic dest, String name) throws JMSException { |
| 2073 | - return createInputStream(dest, null, false); |
| 2074 | - } |
| 2075 | - |
| 2076 | - public InputStream createDurableInputStream(Topic dest, String name, String messageSelector) throws JMSException { |
| 2077 | - return createDurableInputStream(dest, name, messageSelector, false); |
| 2078 | - } |
| 2079 | - |
| 2080 | - public InputStream createDurableInputStream(Topic dest, String name, String messageSelector, boolean noLocal) throws JMSException { |
| 2081 | - return createDurableInputStream(dest, name, messageSelector, noLocal, -1); |
| 2082 | - } |
| 2083 | - |
| 2084 | - public InputStream createDurableInputStream(Topic dest, String name, String messageSelector, boolean noLocal, long timeout) throws JMSException { |
| 2085 | - return doCreateInputStream(dest, messageSelector, noLocal, name, timeout); |
| 2086 | - } |
| 2087 | - |
| 2088 | - private InputStream doCreateInputStream(Destination dest, String messageSelector, boolean noLocal, String subName, long timeout) throws JMSException { |
| 2089 | - checkClosedOrFailed(); |
| 2090 | - ensureConnectionInfoSent(); |
| 2091 | - return new ActiveMQInputStream(this, createConsumerId(), ActiveMQDestination.transform(dest), messageSelector, noLocal, subName, prefetchPolicy.getInputStreamPrefetch(), timeout); |
| 2092 | - } |
| 2093 | - |
| 2094 | - /** |
| 2095 | - * Creates a persistent output stream; individual messages will be written |
| 2096 | - * to disk/database by the broker |
| 2097 | - */ |
| 2098 | - public OutputStream createOutputStream(Destination dest) throws JMSException { |
| 2099 | - return createOutputStream(dest, null, ActiveMQMessage.DEFAULT_DELIVERY_MODE, ActiveMQMessage.DEFAULT_PRIORITY, ActiveMQMessage.DEFAULT_TIME_TO_LIVE); |
| 2100 | - } |
| 2101 | - |
| 2102 | - /** |
| 2103 | - * Creates a non persistent output stream; messages will not be written to |
| 2104 | - * disk |
| 2105 | - */ |
| 2106 | - public OutputStream createNonPersistentOutputStream(Destination dest) throws JMSException { |
| 2107 | - return createOutputStream(dest, null, DeliveryMode.NON_PERSISTENT, ActiveMQMessage.DEFAULT_PRIORITY, ActiveMQMessage.DEFAULT_TIME_TO_LIVE); |
| 2108 | - } |
| 2109 | - |
| 2110 | - /** |
| 2111 | - * Creates an output stream allowing full control over the delivery mode, |
| 2112 | - * the priority and time to live of the messages and the properties added to |
| 2113 | - * messages on the stream. |
| 2114 | - * |
| 2115 | - * @param streamProperties defines a map of key-value pairs where the keys |
| 2116 | - * are strings and the values are primitive values (numbers |
| 2117 | - * and strings) which are appended to the messages similarly |
| 2118 | - * to using the |
| 2119 | - * {@link javax.jms.Message#setObjectProperty(String, Object)} |
| 2120 | - * method |
| 2121 | - */ |
| 2122 | - public OutputStream createOutputStream(Destination dest, Map<String, Object> streamProperties, int deliveryMode, int priority, long timeToLive) throws JMSException { |
| 2123 | - checkClosedOrFailed(); |
| 2124 | - ensureConnectionInfoSent(); |
| 2125 | - return new ActiveMQOutputStream(this, createProducerId(), ActiveMQDestination.transform(dest), streamProperties, deliveryMode, priority, timeToLive); |
| 2126 | - } |
| 2127 | - |
| 2128 | - /** |
| 2129 | - * Unsubscribes a durable subscription that has been created by a client. |
| 2130 | - * <P> |
| 2131 | - * This method deletes the state being maintained on behalf of the |
| 2132 | - * subscriber by its provider. |
| 2133 | - * <P> |
| 2134 | - * It is erroneous for a client to delete a durable subscription while there |
| 2135 | - * is an active <CODE>MessageConsumer </CODE> or |
| 2136 | - * <CODE>TopicSubscriber</CODE> for the subscription, or while a consumed |
| 2137 | - * message is part of a pending transaction or has not been acknowledged in |
| 2138 | - * the session. |
| 2139 | - * |
| 2140 | - * @param name the name used to identify this subscription |
| 2141 | - * @throws JMSException if the session fails to unsubscribe to the durable |
| 2142 | - * subscription due to some internal error. |
| 2143 | - * @throws InvalidDestinationException if an invalid subscription name is |
| 2144 | - * specified. |
| 2145 | - * @since 1.1 |
| 2146 | - */ |
| 2147 | - public void unsubscribe(String name) throws InvalidDestinationException, JMSException { |
| 2148 | - checkClosedOrFailed(); |
| 2149 | - RemoveSubscriptionInfo rsi = new RemoveSubscriptionInfo(); |
| 2150 | - rsi.setConnectionId(getConnectionInfo().getConnectionId()); |
| 2151 | - rsi.setSubscriptionName(name); |
| 2152 | - rsi.setClientId(getConnectionInfo().getClientId()); |
| 2153 | - syncSendPacket(rsi); |
| 2154 | - } |
| 2155 | - |
| 2156 | - /** |
| 2157 | - * Internal send method optimized: - It does not copy the message - It can |
| 2158 | - * only handle ActiveMQ messages. - You can specify if the send is async or |
| 2159 | - * sync - Does not allow you to send /w a transaction. |
| 2160 | - */ |
| 2161 | - void send(ActiveMQDestination destination, ActiveMQMessage msg, MessageId messageId, int deliveryMode, int priority, long timeToLive, boolean async) throws JMSException { |
| 2162 | - checkClosedOrFailed(); |
| 2163 | - |
| 2164 | - if (destination.isTemporary() && isDeleted(destination)) { |
| 2165 | - throw new JMSException("Cannot publish to a deleted Destination: " + destination); |
| 2166 | - } |
| 2167 | - |
| 2168 | - msg.setJMSDestination(destination); |
| 2169 | - msg.setJMSDeliveryMode(deliveryMode); |
| 2170 | - long expiration = 0L; |
| 2171 | - |
| 2172 | - if (!isDisableTimeStampsByDefault()) { |
| 2173 | - long timeStamp = System.currentTimeMillis(); |
| 2174 | - msg.setJMSTimestamp(timeStamp); |
| 2175 | - if (timeToLive > 0) { |
| 2176 | - expiration = timeToLive + timeStamp; |
| 2177 | - } |
| 2178 | - } |
| 2179 | - |
| 2180 | - msg.setJMSExpiration(expiration); |
| 2181 | - msg.setJMSPriority(priority); |
| 2182 | - |
| 2183 | - msg.setJMSRedelivered(false); |
| 2184 | - msg.setMessageId(messageId); |
| 2185 | - |
| 2186 | - msg.onSend(); |
| 2187 | - |
| 2188 | - msg.setProducerId(msg.getMessageId().getProducerId()); |
| 2189 | - |
| 2190 | - if (LOG.isDebugEnabled()) { |
| 2191 | - LOG.debug("Sending message: " + msg); |
| 2192 | - } |
| 2193 | - |
| 2194 | - if (async) { |
| 2195 | - asyncSendPacket(msg); |
| 2196 | - } else { |
| 2197 | - syncSendPacket(msg); |
| 2198 | - } |
| 2199 | - |
| 2200 | - } |
| 2201 | - |
| 2202 | - public void addOutputStream(ActiveMQOutputStream stream) { |
| 2203 | - outputStreams.add(stream); |
| 2204 | - } |
| 2205 | - |
| 2206 | - public void removeOutputStream(ActiveMQOutputStream stream) { |
| 2207 | - outputStreams.remove(stream); |
| 2208 | - } |
| 2209 | - |
| 2210 | - public void addInputStream(ActiveMQInputStream stream) { |
| 2211 | - inputStreams.add(stream); |
| 2212 | - } |
| 2213 | - |
| 2214 | - public void removeInputStream(ActiveMQInputStream stream) { |
| 2215 | - inputStreams.remove(stream); |
| 2216 | - } |
| 2217 | - |
| 2218 | - protected void onControlCommand(ControlCommand command) { |
| 2219 | - String text = command.getCommand(); |
| 2220 | - if (text != null) { |
| 2221 | - if (text.equals("shutdown")) { |
| 2222 | - LOG.info("JVM told to shutdown"); |
| 2223 | - System.exit(0); |
| 2224 | - } |
| 2225 | - } |
| 2226 | - } |
| 2227 | - |
| 2228 | - protected void onConnectionControl(ConnectionControl command) { |
| 2229 | - if (command.isFaultTolerant()) { |
| 2230 | - this.optimizeAcknowledge = false; |
| 2231 | - for (Iterator<ActiveMQSession> i = this.sessions.iterator(); i.hasNext();) { |
| 2232 | - ActiveMQSession s = i.next(); |
| 2233 | - s.setOptimizeAcknowledge(false); |
| 2234 | - } |
| 2235 | - } |
| 2236 | - } |
| 2237 | - |
| 2238 | - protected void onConsumerControl(ConsumerControl command) { |
| 2239 | - if (command.isClose()) { |
| 2240 | - for (Iterator<ActiveMQSession> i = this.sessions.iterator(); i.hasNext();) { |
| 2241 | - ActiveMQSession s = i.next(); |
| 2242 | - s.close(command.getConsumerId()); |
| 2243 | - } |
| 2244 | - } else { |
| 2245 | - for (Iterator<ActiveMQSession> i = this.sessions.iterator(); i.hasNext();) { |
| 2246 | - ActiveMQSession s = i.next(); |
| 2247 | - s.setPrefetchSize(command.getConsumerId(), command.getPrefetch()); |
| 2248 | - } |
| 2249 | - } |
| 2250 | - } |
| 2251 | - |
| 2252 | - protected void transportFailed(IOException error) { |
| 2253 | - transportFailed.set(true); |
| 2254 | - if (firstFailureError == null) { |
| 2255 | - firstFailureError = error; |
| 2256 | - } |
| 2257 | - } |
| 2258 | - |
| 2259 | - /** |
| 2260 | - * Should a JMS message be copied to a new JMS Message object as part of the |
| 2261 | - * send() method in JMS. This is enabled by default to be compliant with the |
| 2262 | - * JMS specification. You can disable it if you do not mutate JMS messages |
| 2263 | - * after they are sent for a performance boost |
| 2264 | - */ |
| 2265 | - public void setCopyMessageOnSend(boolean copyMessageOnSend) { |
| 2266 | - this.copyMessageOnSend = copyMessageOnSend; |
| 2267 | - } |
| 2268 | - |
| 2269 | - @Override |
| 2270 | - public String toString() { |
| 2271 | - return "ActiveMQConnection {id=" + info.getConnectionId() + ",clientId=" + info.getClientId() + ",started=" + started.get() + "}"; |
| 2272 | - } |
| 2273 | - |
| 2274 | - protected BlobTransferPolicy createBlobTransferPolicy() { |
| 2275 | - return new BlobTransferPolicy(); |
| 2276 | - } |
| 2277 | - |
| 2278 | - public int getProtocolVersion() { |
| 2279 | - return protocolVersion.get(); |
| 2280 | - } |
| 2281 | - |
| 2282 | - public int getProducerWindowSize() { |
| 2283 | - return producerWindowSize; |
| 2284 | - } |
| 2285 | - |
| 2286 | - public void setProducerWindowSize(int producerWindowSize) { |
| 2287 | - this.producerWindowSize = producerWindowSize; |
| 2288 | - } |
| 2289 | - |
| 2290 | - public void setAuditDepth(int auditDepth) { |
| 2291 | - connectionAudit.setAuditDepth(auditDepth); |
| 2292 | - } |
| 2293 | - |
| 2294 | - public void setAuditMaximumProducerNumber(int auditMaximumProducerNumber) { |
| 2295 | - connectionAudit.setAuditMaximumProducerNumber(auditMaximumProducerNumber); |
| 2296 | - } |
| 2297 | - |
| 2298 | - protected void removeDispatcher(ActiveMQDispatcher dispatcher) { |
| 2299 | - connectionAudit.removeDispatcher(dispatcher); |
| 2300 | - } |
| 2301 | - |
| 2302 | - protected boolean isDuplicate(ActiveMQDispatcher dispatcher, Message message) { |
| 2303 | - return checkForDuplicates && connectionAudit.isDuplicate(dispatcher, message); |
| 2304 | - } |
| 2305 | - |
| 2306 | - protected void rollbackDuplicate(ActiveMQDispatcher dispatcher, Message message) { |
| 2307 | - connectionAudit.rollbackDuplicate(dispatcher, message); |
| 2308 | - } |
| 2309 | - |
| 2310 | - public IOException getFirstFailureError() { |
| 2311 | - return firstFailureError; |
| 2312 | - } |
| 2313 | - |
| 2314 | - protected void waitForTransportInterruptionProcessingToComplete() throws InterruptedException { |
| 2315 | - CountDownLatch cdl = this.transportInterruptionProcessingComplete; |
| 2316 | - if (cdl != null) { |
| 2317 | - if (!closed.get() && !transportFailed.get() && cdl.getCount()>0) { |
| 2318 | - LOG.warn("dispatch paused, waiting for outstanding dispatch interruption processing (" + cdl.getCount() + ") to complete.."); |
| 2319 | - cdl.await(10, TimeUnit.SECONDS); |
| 2320 | - } |
| 2321 | - signalInterruptionProcessingComplete(); |
| 2322 | - } |
| 2323 | - } |
| 2324 | - |
| 2325 | - protected void transportInterruptionProcessingComplete() { |
| 2326 | - CountDownLatch cdl = this.transportInterruptionProcessingComplete; |
| 2327 | - if (cdl != null) { |
| 2328 | - cdl.countDown(); |
| 2329 | - try { |
| 2330 | - signalInterruptionProcessingComplete(); |
| 2331 | - } catch (InterruptedException ignored) {} |
| 2332 | - } |
| 2333 | - } |
| 2334 | - |
| 2335 | - private void signalInterruptionProcessingComplete() throws InterruptedException { |
| 2336 | - CountDownLatch cdl = this.transportInterruptionProcessingComplete; |
| 2337 | - if (cdl.getCount()==0) { |
| 2338 | - if (LOG.isDebugEnabled()) { |
| 2339 | - LOG.debug("transportInterruptionProcessingComplete for: " + this.getConnectionInfo().getConnectionId()); |
| 2340 | - } |
| 2341 | - this.transportInterruptionProcessingComplete = null; |
| 2342 | - |
| 2343 | - FailoverTransport failoverTransport = transport.narrow(FailoverTransport.class); |
| 2344 | - if (failoverTransport != null) { |
| 2345 | - failoverTransport.connectionInterruptProcessingComplete(this.getConnectionInfo().getConnectionId()); |
| 2346 | - if (LOG.isDebugEnabled()) { |
| 2347 | - LOG.debug("notified failover transport (" + failoverTransport |
| 2348 | - + ") of interruption completion for: " + this.getConnectionInfo().getConnectionId()); |
| 2349 | - } |
| 2350 | - } |
| 2351 | - |
| 2352 | - } |
| 2353 | - } |
| 2354 | - |
| 2355 | - private void signalInterruptionProcessingNeeded() { |
| 2356 | - FailoverTransport failoverTransport = transport.narrow(FailoverTransport.class); |
| 2357 | - if (failoverTransport != null) { |
| 2358 | - failoverTransport.getStateTracker().transportInterrupted(this.getConnectionInfo().getConnectionId()); |
| 2359 | - if (LOG.isDebugEnabled()) { |
| 2360 | - LOG.debug("notified failover transport (" + failoverTransport |
| 2361 | - + ") of pending interruption processing for: " + this.getConnectionInfo().getConnectionId()); |
| 2362 | - } |
| 2363 | - } |
| 2364 | - } |
| 2365 | - |
| 2366 | - /* |
| 2367 | - * specify the amount of time in milliseconds that a consumer with a transaction pending recovery |
| 2368 | - * will wait to receive re dispatched messages. |
| 2369 | - * default value is 0 so there is no wait by default. |
| 2370 | - */ |
| 2371 | - public void setConsumerFailoverRedeliveryWaitPeriod(long consumerFailoverRedeliveryWaitPeriod) { |
| 2372 | - this.consumerFailoverRedeliveryWaitPeriod = consumerFailoverRedeliveryWaitPeriod; |
| 2373 | - } |
| 2374 | - |
| 2375 | - public long getConsumerFailoverRedeliveryWaitPeriod() { |
| 2376 | - return consumerFailoverRedeliveryWaitPeriod; |
| 2377 | - } |
| 2378 | - |
| 2379 | - protected Scheduler getScheduler() { |
| 2380 | - return this.scheduler; |
| 2381 | - } |
| 2382 | - |
| 2383 | - protected ThreadPoolExecutor getExecutor() { |
| 2384 | - return this.executor; |
| 2385 | - } |
| 2386 | - |
| 2387 | - /** |
| 2388 | - * @return the checkForDuplicates |
| 2389 | - */ |
| 2390 | - public boolean isCheckForDuplicates() { |
| 2391 | - return this.checkForDuplicates; |
| 2392 | - } |
| 2393 | - |
| 2394 | - /** |
| 2395 | - * @param checkForDuplicates the checkForDuplicates to set |
| 2396 | - */ |
| 2397 | - public void setCheckForDuplicates(boolean checkForDuplicates) { |
| 2398 | - this.checkForDuplicates = checkForDuplicates; |
| 2399 | - } |
| 2400 | - |
| 2401 | -} |
| 2402 | |
| 2403 | === removed directory '.pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq/broker' |
| 2404 | === removed file '.pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java' |
| 2405 | --- .pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java 2012-01-15 19:38:21 +0000 |
| 2406 | +++ .pc/CVE-2011-4605.diff/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java 1970-01-01 00:00:00 +0000 |
| 2407 | @@ -1,1449 +0,0 @@ |
| 2408 | -/** |
| 2409 | - * Licensed to the Apache Software Foundation (ASF) under one or more |
| 2410 | - * contributor license agreements. See the NOTICE file distributed with |
| 2411 | - * this work for additional information regarding copyright ownership. |
| 2412 | - * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 2413 | - * (the "License"); you may not use this file except in compliance with |
| 2414 | - * the License. You may obtain a copy of the License at |
| 2415 | - * |
| 2416 | - * http://www.apache.org/licenses/LICENSE-2.0 |
| 2417 | - * |
| 2418 | - * Unless required by applicable law or agreed to in writing, software |
| 2419 | - * distributed under the License is distributed on an "AS IS" BASIS, |
| 2420 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 2421 | - * See the License for the specific language governing permissions and |
| 2422 | - * limitations under the License. |
| 2423 | - */ |
| 2424 | -package org.apache.activemq.broker; |
| 2425 | - |
| 2426 | -import java.io.IOException; |
| 2427 | -import java.net.URI; |
| 2428 | -import java.util.HashMap; |
| 2429 | -import java.util.Iterator; |
| 2430 | -import java.util.LinkedList; |
| 2431 | -import java.util.List; |
| 2432 | -import java.util.Map; |
| 2433 | -import java.util.Properties; |
| 2434 | -import java.util.concurrent.ConcurrentHashMap; |
| 2435 | -import java.util.concurrent.CopyOnWriteArrayList; |
| 2436 | -import java.util.concurrent.CountDownLatch; |
| 2437 | -import java.util.concurrent.TimeUnit; |
| 2438 | -import java.util.concurrent.atomic.AtomicBoolean; |
| 2439 | -import java.util.concurrent.atomic.AtomicInteger; |
| 2440 | -import java.util.concurrent.atomic.AtomicReference; |
| 2441 | -import java.util.concurrent.locks.ReentrantReadWriteLock; |
| 2442 | - |
| 2443 | -import javax.management.ObjectName; |
| 2444 | -import javax.transaction.xa.XAResource; |
| 2445 | - |
| 2446 | -import org.apache.activemq.broker.ft.MasterBroker; |
| 2447 | -import org.apache.activemq.broker.region.ConnectionStatistics; |
| 2448 | -import org.apache.activemq.broker.region.RegionBroker; |
| 2449 | -import org.apache.activemq.command.BrokerId; |
| 2450 | -import org.apache.activemq.command.BrokerInfo; |
| 2451 | -import org.apache.activemq.command.Command; |
| 2452 | -import org.apache.activemq.command.CommandTypes; |
| 2453 | -import org.apache.activemq.command.ConnectionControl; |
| 2454 | -import org.apache.activemq.command.ConnectionError; |
| 2455 | -import org.apache.activemq.command.ConnectionId; |
| 2456 | -import org.apache.activemq.command.ConnectionInfo; |
| 2457 | -import org.apache.activemq.command.ConsumerControl; |
| 2458 | -import org.apache.activemq.command.ConsumerId; |
| 2459 | -import org.apache.activemq.command.ConsumerInfo; |
| 2460 | -import org.apache.activemq.command.ControlCommand; |
| 2461 | -import org.apache.activemq.command.DataArrayResponse; |
| 2462 | -import org.apache.activemq.command.DestinationInfo; |
| 2463 | -import org.apache.activemq.command.ExceptionResponse; |
| 2464 | -import org.apache.activemq.command.FlushCommand; |
| 2465 | -import org.apache.activemq.command.IntegerResponse; |
| 2466 | -import org.apache.activemq.command.KeepAliveInfo; |
| 2467 | -import org.apache.activemq.command.Message; |
| 2468 | -import org.apache.activemq.command.MessageAck; |
| 2469 | -import org.apache.activemq.command.MessageDispatch; |
| 2470 | -import org.apache.activemq.command.MessageDispatchNotification; |
| 2471 | -import org.apache.activemq.command.MessagePull; |
| 2472 | -import org.apache.activemq.command.ProducerAck; |
| 2473 | -import org.apache.activemq.command.ProducerId; |
| 2474 | -import org.apache.activemq.command.ProducerInfo; |
| 2475 | -import org.apache.activemq.command.RemoveSubscriptionInfo; |
| 2476 | -import org.apache.activemq.command.Response; |
| 2477 | -import org.apache.activemq.command.SessionId; |
| 2478 | -import org.apache.activemq.command.SessionInfo; |
| 2479 | -import org.apache.activemq.command.ShutdownInfo; |
| 2480 | -import org.apache.activemq.command.TransactionId; |
| 2481 | -import org.apache.activemq.command.TransactionInfo; |
| 2482 | -import org.apache.activemq.command.WireFormatInfo; |
| 2483 | -import org.apache.activemq.network.*; |
| 2484 | -import org.apache.activemq.security.MessageAuthorizationPolicy; |
| 2485 | -import org.apache.activemq.state.CommandVisitor; |
| 2486 | -import org.apache.activemq.state.ConnectionState; |
| 2487 | -import org.apache.activemq.state.ConsumerState; |
| 2488 | -import org.apache.activemq.state.ProducerState; |
| 2489 | -import org.apache.activemq.state.SessionState; |
| 2490 | -import org.apache.activemq.state.TransactionState; |
| 2491 | -import org.apache.activemq.thread.DefaultThreadPools; |
| 2492 | -import org.apache.activemq.thread.Task; |
| 2493 | -import org.apache.activemq.thread.TaskRunner; |
| 2494 | -import org.apache.activemq.thread.TaskRunnerFactory; |
| 2495 | -import org.apache.activemq.transaction.Transaction; |
| 2496 | -import org.apache.activemq.transport.DefaultTransportListener; |
| 2497 | -import org.apache.activemq.transport.ResponseCorrelator; |
| 2498 | -import org.apache.activemq.transport.Transport; |
| 2499 | -import org.apache.activemq.transport.TransportDisposedIOException; |
| 2500 | -import org.apache.activemq.transport.TransportFactory; |
| 2501 | -import org.apache.activemq.util.*; |
| 2502 | -import org.slf4j.Logger; |
| 2503 | -import org.slf4j.LoggerFactory; |
| 2504 | -import org.slf4j.MDC; |
| 2505 | - |
| 2506 | -public class TransportConnection implements Connection, Task, CommandVisitor { |
| 2507 | - private static final Logger LOG = LoggerFactory.getLogger(TransportConnection.class); |
| 2508 | - private static final Logger TRANSPORTLOG = LoggerFactory.getLogger(TransportConnection.class.getName() + ".Transport"); |
| 2509 | - private static final Logger SERVICELOG = LoggerFactory.getLogger(TransportConnection.class.getName() + ".Service"); |
| 2510 | - // Keeps track of the broker and connector that created this connection. |
| 2511 | - protected final Broker broker; |
| 2512 | - protected final TransportConnector connector; |
| 2513 | - // Keeps track of the state of the connections. |
| 2514 | - // protected final ConcurrentHashMap localConnectionStates=new |
| 2515 | - // ConcurrentHashMap(); |
| 2516 | - protected final Map<ConnectionId, ConnectionState> brokerConnectionStates; |
| 2517 | - // The broker and wireformat info that was exchanged. |
| 2518 | - protected BrokerInfo brokerInfo; |
| 2519 | - protected final List<Command> dispatchQueue = new LinkedList<Command>(); |
| 2520 | - protected TaskRunner taskRunner; |
| 2521 | - protected final AtomicReference<IOException> transportException = new AtomicReference<IOException>(); |
| 2522 | - protected AtomicBoolean dispatchStopped = new AtomicBoolean(false); |
| 2523 | - private MasterBroker masterBroker; |
| 2524 | - private final Transport transport; |
| 2525 | - private MessageAuthorizationPolicy messageAuthorizationPolicy; |
| 2526 | - private WireFormatInfo wireFormatInfo; |
| 2527 | - // Used to do async dispatch.. this should perhaps be pushed down into the |
| 2528 | - // transport layer.. |
| 2529 | - private boolean inServiceException; |
| 2530 | - private final ConnectionStatistics statistics = new ConnectionStatistics(); |
| 2531 | - private boolean manageable; |
| 2532 | - private boolean slow; |
| 2533 | - private boolean markedCandidate; |
| 2534 | - private boolean blockedCandidate; |
| 2535 | - private boolean blocked; |
| 2536 | - private boolean connected; |
| 2537 | - private boolean active; |
| 2538 | - private boolean starting; |
| 2539 | - private boolean pendingStop; |
| 2540 | - private long timeStamp; |
| 2541 | - private final AtomicBoolean stopping = new AtomicBoolean(false); |
| 2542 | - private final CountDownLatch stopped = new CountDownLatch(1); |
| 2543 | - private final AtomicBoolean asyncException = new AtomicBoolean(false); |
| 2544 | - private final Map<ProducerId, ProducerBrokerExchange> producerExchanges = new HashMap<ProducerId, ProducerBrokerExchange>(); |
| 2545 | - private final Map<ConsumerId, ConsumerBrokerExchange> consumerExchanges = new HashMap<ConsumerId, ConsumerBrokerExchange>(); |
| 2546 | - private final CountDownLatch dispatchStoppedLatch = new CountDownLatch(1); |
| 2547 | - private ConnectionContext context; |
| 2548 | - private boolean networkConnection; |
| 2549 | - private boolean faultTolerantConnection; |
| 2550 | - private final AtomicInteger protocolVersion = new AtomicInteger(CommandTypes.PROTOCOL_VERSION); |
| 2551 | - private DemandForwardingBridge duplexBridge; |
| 2552 | - private final TaskRunnerFactory taskRunnerFactory; |
| 2553 | - private TransportConnectionStateRegister connectionStateRegister = new SingleTransportConnectionStateRegister(); |
| 2554 | - private final ReentrantReadWriteLock serviceLock = new ReentrantReadWriteLock(); |
| 2555 | - private String duplexNetworkConnectorId; |
| 2556 | - |
| 2557 | - /** |
| 2558 | - * @param connector |
| 2559 | - * @param transport |
| 2560 | - * @param broker |
| 2561 | - * @param taskRunnerFactory |
| 2562 | - * - can be null if you want direct dispatch to the transport |
| 2563 | - * else commands are sent async. |
| 2564 | - */ |
| 2565 | - public TransportConnection(TransportConnector connector, final Transport transport, Broker broker, |
| 2566 | - TaskRunnerFactory taskRunnerFactory) { |
| 2567 | - this.connector = connector; |
| 2568 | - this.broker = broker; |
| 2569 | - this.messageAuthorizationPolicy = connector.getMessageAuthorizationPolicy(); |
| 2570 | - RegionBroker rb = (RegionBroker) broker.getAdaptor(RegionBroker.class); |
| 2571 | - brokerConnectionStates = rb.getConnectionStates(); |
| 2572 | - if (connector != null) { |
| 2573 | - this.statistics.setParent(connector.getStatistics()); |
| 2574 | - } |
| 2575 | - this.taskRunnerFactory = taskRunnerFactory; |
| 2576 | - this.transport = transport; |
| 2577 | - this.transport.setTransportListener(new DefaultTransportListener() { |
| 2578 | - @Override |
| 2579 | - public void onCommand(Object o) { |
| 2580 | - serviceLock.readLock().lock(); |
| 2581 | - try { |
| 2582 | - if (!(o instanceof Command)) { |
| 2583 | - throw new RuntimeException("Protocol violation - Command corrupted: " + o.toString()); |
| 2584 | - } |
| 2585 | - Command command = (Command) o; |
| 2586 | - Response response = service(command); |
| 2587 | - if (response != null) { |
| 2588 | - dispatchSync(response); |
| 2589 | - } |
| 2590 | - } finally { |
| 2591 | - serviceLock.readLock().unlock(); |
| 2592 | - } |
| 2593 | - } |
| 2594 | - |
| 2595 | - @Override |
| 2596 | - public void onException(IOException exception) { |
| 2597 | - serviceLock.readLock().lock(); |
| 2598 | - try { |
| 2599 | - serviceTransportException(exception); |
| 2600 | - } finally { |
| 2601 | - serviceLock.readLock().unlock(); |
| 2602 | - } |
| 2603 | - } |
| 2604 | - }); |
| 2605 | - connected = true; |
| 2606 | - } |
| 2607 | - |
| 2608 | - /** |
| 2609 | - * Returns the number of messages to be dispatched to this connection |
| 2610 | - * |
| 2611 | - * @return size of dispatch queue |
| 2612 | - */ |
| 2613 | - public int getDispatchQueueSize() { |
| 2614 | - synchronized (dispatchQueue) { |
| 2615 | - return dispatchQueue.size(); |
| 2616 | - } |
| 2617 | - } |
| 2618 | - |
| 2619 | - public void serviceTransportException(IOException e) { |
| 2620 | - BrokerService bService = connector.getBrokerService(); |
| 2621 | - if (bService.isShutdownOnSlaveFailure()) { |
| 2622 | - if (brokerInfo != null) { |
| 2623 | - if (brokerInfo.isSlaveBroker()) { |
| 2624 | - LOG.error("Slave has exception: " + e.getMessage() + " shutting down master now.", e); |
| 2625 | - try { |
| 2626 | - doStop(); |
| 2627 | - bService.stop(); |
| 2628 | - } catch (Exception ex) { |
| 2629 | - LOG.warn("Failed to stop the master", ex); |
| 2630 | - } |
| 2631 | - } |
| 2632 | - } |
| 2633 | - } |
| 2634 | - if (!stopping.get()) { |
| 2635 | - transportException.set(e); |
| 2636 | - if (TRANSPORTLOG.isDebugEnabled()) { |
| 2637 | - TRANSPORTLOG.debug("Transport failed: " + e, e); |
| 2638 | - } else if (TRANSPORTLOG.isInfoEnabled()) { |
| 2639 | - TRANSPORTLOG.info("Transport failed: " + e); |
| 2640 | - } |
| 2641 | - stopAsync(); |
| 2642 | - } |
| 2643 | - } |
| 2644 | - |
| 2645 | - /** |
| 2646 | - * Calls the serviceException method in an async thread. Since handling a |
| 2647 | - * service exception closes a socket, we should not tie up broker threads |
| 2648 | - * since client sockets may hang or cause deadlocks. |
| 2649 | - * |
| 2650 | - * @param e |
| 2651 | - */ |
| 2652 | - public void serviceExceptionAsync(final IOException e) { |
| 2653 | - if (asyncException.compareAndSet(false, true)) { |
| 2654 | - new Thread("Async Exception Handler") { |
| 2655 | - @Override |
| 2656 | - public void run() { |
| 2657 | - serviceException(e); |
| 2658 | - } |
| 2659 | - }.start(); |
| 2660 | - } |
| 2661 | - } |
| 2662 | - |
| 2663 | - /** |
| 2664 | - * Closes a clients connection due to a detected error. Errors are ignored |
| 2665 | - * if: the client is closing or broker is closing. Otherwise, the connection |
| 2666 | - * error transmitted to the client before stopping it's transport. |
| 2667 | - */ |
| 2668 | - public void serviceException(Throwable e) { |
| 2669 | - // are we a transport exception such as not being able to dispatch |
| 2670 | - // synchronously to a transport |
| 2671 | - if (e instanceof IOException) { |
| 2672 | - serviceTransportException((IOException) e); |
| 2673 | - } else if (e.getClass() == BrokerStoppedException.class) { |
| 2674 | - // Handle the case where the broker is stopped |
| 2675 | - // But the client is still connected. |
| 2676 | - if (!stopping.get()) { |
| 2677 | - if (SERVICELOG.isDebugEnabled()) { |
| 2678 | - SERVICELOG.debug("Broker has been stopped. Notifying client and closing his connection."); |
| 2679 | - } |
| 2680 | - ConnectionError ce = new ConnectionError(); |
| 2681 | - ce.setException(e); |
| 2682 | - dispatchSync(ce); |
| 2683 | - // Wait a little bit to try to get the output buffer to flush |
| 2684 | - // the exption notification to the client. |
| 2685 | - try { |
| 2686 | - Thread.sleep(500); |
| 2687 | - } catch (InterruptedException ie) { |
| 2688 | - Thread.currentThread().interrupt(); |
| 2689 | - } |
| 2690 | - // Worst case is we just kill the connection before the |
| 2691 | - // notification gets to him. |
| 2692 | - stopAsync(); |
| 2693 | - } |
| 2694 | - } else if (!stopping.get() && !inServiceException) { |
| 2695 | - inServiceException = true; |
| 2696 | - try { |
| 2697 | - SERVICELOG.warn("Async error occurred: " + e, e); |
| 2698 | - ConnectionError ce = new ConnectionError(); |
| 2699 | - ce.setException(e); |
| 2700 | - dispatchAsync(ce); |
| 2701 | - } finally { |
| 2702 | - inServiceException = false; |
| 2703 | - } |
| 2704 | - } |
| 2705 | - } |
| 2706 | - |
| 2707 | - public Response service(Command command) { |
| 2708 | - MDC.put("activemq.connector", connector.getUri().toString()); |
| 2709 | - Response response = null; |
| 2710 | - boolean responseRequired = command.isResponseRequired(); |
| 2711 | - int commandId = command.getCommandId(); |
| 2712 | - try { |
| 2713 | - response = command.visit(this); |
| 2714 | - } catch (Throwable e) { |
| 2715 | - if (SERVICELOG.isDebugEnabled() && e.getClass() != BrokerStoppedException.class) { |
| 2716 | - SERVICELOG.debug("Error occured while processing " + (responseRequired ? "sync" : "async") |
| 2717 | - + " command: " + command + ", exception: " + e, e); |
| 2718 | - } |
| 2719 | - if (responseRequired) { |
| 2720 | - response = new ExceptionResponse(e); |
| 2721 | - } else { |
| 2722 | - serviceException(e); |
| 2723 | - } |
| 2724 | - } |
| 2725 | - if (responseRequired) { |
| 2726 | - if (response == null) { |
| 2727 | - response = new Response(); |
| 2728 | - } |
| 2729 | - response.setCorrelationId(commandId); |
| 2730 | - } |
| 2731 | - // The context may have been flagged so that the response is not |
| 2732 | - // sent. |
| 2733 | - if (context != null) { |
| 2734 | - if (context.isDontSendReponse()) { |
| 2735 | - context.setDontSendReponse(false); |
| 2736 | - response = null; |
| 2737 | - } |
| 2738 | - context = null; |
| 2739 | - } |
| 2740 | - MDC.remove("activemq.connector"); |
| 2741 | - return response; |
| 2742 | - } |
| 2743 | - |
| 2744 | - public Response processKeepAlive(KeepAliveInfo info) throws Exception { |
| 2745 | - return null; |
| 2746 | - } |
| 2747 | - |
| 2748 | - public Response processRemoveSubscription(RemoveSubscriptionInfo info) throws Exception { |
| 2749 | - broker.removeSubscription(lookupConnectionState(info.getConnectionId()).getContext(), info); |
| 2750 | - return null; |
| 2751 | - } |
| 2752 | - |
| 2753 | - public Response processWireFormat(WireFormatInfo info) throws Exception { |
| 2754 | - wireFormatInfo = info; |
| 2755 | - protocolVersion.set(info.getVersion()); |
| 2756 | - return null; |
| 2757 | - } |
| 2758 | - |
| 2759 | - public Response processShutdown(ShutdownInfo info) throws Exception { |
| 2760 | - stopAsync(); |
| 2761 | - return null; |
| 2762 | - } |
| 2763 | - |
| 2764 | - public Response processFlush(FlushCommand command) throws Exception { |
| 2765 | - return null; |
| 2766 | - } |
| 2767 | - |
| 2768 | - public Response processBeginTransaction(TransactionInfo info) throws Exception { |
| 2769 | - TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); |
| 2770 | - context = null; |
| 2771 | - if (cs != null) { |
| 2772 | - context = cs.getContext(); |
| 2773 | - } |
| 2774 | - if (cs == null) { |
| 2775 | - throw new NullPointerException("Context is null"); |
| 2776 | - } |
| 2777 | - // Avoid replaying dup commands |
| 2778 | - if (cs.getTransactionState(info.getTransactionId()) == null) { |
| 2779 | - cs.addTransactionState(info.getTransactionId()); |
| 2780 | - broker.beginTransaction(context, info.getTransactionId()); |
| 2781 | - } |
| 2782 | - return null; |
| 2783 | - } |
| 2784 | - |
| 2785 | - public Response processEndTransaction(TransactionInfo info) throws Exception { |
| 2786 | - // No need to do anything. This packet is just sent by the client |
| 2787 | - // make sure he is synced with the server as commit command could |
| 2788 | - // come from a different connection. |
| 2789 | - return null; |
| 2790 | - } |
| 2791 | - |
| 2792 | - public Response processPrepareTransaction(TransactionInfo info) throws Exception { |
| 2793 | - TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); |
| 2794 | - context = null; |
| 2795 | - if (cs != null) { |
| 2796 | - context = cs.getContext(); |
| 2797 | - } |
| 2798 | - if (cs == null) { |
| 2799 | - throw new NullPointerException("Context is null"); |
| 2800 | - } |
| 2801 | - TransactionState transactionState = cs.getTransactionState(info.getTransactionId()); |
| 2802 | - if (transactionState == null) { |
| 2803 | - throw new IllegalStateException("Cannot prepare a transaction that had not been started or previously returned XA_RDONLY: " |
| 2804 | - + info.getTransactionId()); |
| 2805 | - } |
| 2806 | - // Avoid dups. |
| 2807 | - if (!transactionState.isPrepared()) { |
| 2808 | - transactionState.setPrepared(true); |
| 2809 | - int result = broker.prepareTransaction(context, info.getTransactionId()); |
| 2810 | - transactionState.setPreparedResult(result); |
| 2811 | - if (result == XAResource.XA_RDONLY) { |
| 2812 | - // we are done, no further rollback or commit from TM |
| 2813 | - cs.removeTransactionState(info.getTransactionId()); |
| 2814 | - } |
| 2815 | - IntegerResponse response = new IntegerResponse(result); |
| 2816 | - return response; |
| 2817 | - } else { |
| 2818 | - IntegerResponse response = new IntegerResponse(transactionState.getPreparedResult()); |
| 2819 | - return response; |
| 2820 | - } |
| 2821 | - } |
| 2822 | - |
| 2823 | - public Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception { |
| 2824 | - TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); |
| 2825 | - context = cs.getContext(); |
| 2826 | - cs.removeTransactionState(info.getTransactionId()); |
| 2827 | - broker.commitTransaction(context, info.getTransactionId(), true); |
| 2828 | - return null; |
| 2829 | - } |
| 2830 | - |
| 2831 | - public Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception { |
| 2832 | - TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); |
| 2833 | - context = cs.getContext(); |
| 2834 | - cs.removeTransactionState(info.getTransactionId()); |
| 2835 | - broker.commitTransaction(context, info.getTransactionId(), false); |
| 2836 | - return null; |
| 2837 | - } |
| 2838 | - |
| 2839 | - public Response processRollbackTransaction(TransactionInfo info) throws Exception { |
| 2840 | - TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); |
| 2841 | - context = cs.getContext(); |
| 2842 | - cs.removeTransactionState(info.getTransactionId()); |
| 2843 | - broker.rollbackTransaction(context, info.getTransactionId()); |
| 2844 | - return null; |
| 2845 | - } |
| 2846 | - |
| 2847 | - public Response processForgetTransaction(TransactionInfo info) throws Exception { |
| 2848 | - TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); |
| 2849 | - context = cs.getContext(); |
| 2850 | - broker.forgetTransaction(context, info.getTransactionId()); |
| 2851 | - return null; |
| 2852 | - } |
| 2853 | - |
| 2854 | - public Response processRecoverTransactions(TransactionInfo info) throws Exception { |
| 2855 | - TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); |
| 2856 | - context = cs.getContext(); |
| 2857 | - TransactionId[] preparedTransactions = broker.getPreparedTransactions(context); |
| 2858 | - return new DataArrayResponse(preparedTransactions); |
| 2859 | - } |
| 2860 | - |
| 2861 | - public Response processMessage(Message messageSend) throws Exception { |
| 2862 | - ProducerId producerId = messageSend.getProducerId(); |
| 2863 | - ProducerBrokerExchange producerExchange = getProducerBrokerExchange(producerId); |
| 2864 | - if (producerExchange.canDispatch(messageSend)) { |
| 2865 | - broker.send(producerExchange, messageSend); |
| 2866 | - } |
| 2867 | - return null; |
| 2868 | - } |
| 2869 | - |
| 2870 | - public Response processMessageAck(MessageAck ack) throws Exception { |
| 2871 | - ConsumerBrokerExchange consumerExchange = getConsumerBrokerExchange(ack.getConsumerId()); |
| 2872 | - broker.acknowledge(consumerExchange, ack); |
| 2873 | - return null; |
| 2874 | - } |
| 2875 | - |
| 2876 | - public Response processMessagePull(MessagePull pull) throws Exception { |
| 2877 | - return broker.messagePull(lookupConnectionState(pull.getConsumerId()).getContext(), pull); |
| 2878 | - } |
| 2879 | - |
| 2880 | - public Response processMessageDispatchNotification(MessageDispatchNotification notification) throws Exception { |
| 2881 | - broker.processDispatchNotification(notification); |
| 2882 | - return null; |
| 2883 | - } |
| 2884 | - |
| 2885 | - public Response processAddDestination(DestinationInfo info) throws Exception { |
| 2886 | - TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); |
| 2887 | - broker.addDestinationInfo(cs.getContext(), info); |
| 2888 | - if (info.getDestination().isTemporary()) { |
| 2889 | - cs.addTempDestination(info); |
| 2890 | - } |
| 2891 | - return null; |
| 2892 | - } |
| 2893 | - |
| 2894 | - public Response processRemoveDestination(DestinationInfo info) throws Exception { |
| 2895 | - TransportConnectionState cs = lookupConnectionState(info.getConnectionId()); |
| 2896 | - broker.removeDestinationInfo(cs.getContext(), info); |
| 2897 | - if (info.getDestination().isTemporary()) { |
| 2898 | - cs.removeTempDestination(info.getDestination()); |
| 2899 | - } |
| 2900 | - return null; |
| 2901 | - } |
| 2902 | - |
| 2903 | - public Response processAddProducer(ProducerInfo info) throws Exception { |
| 2904 | - SessionId sessionId = info.getProducerId().getParentId(); |
| 2905 | - ConnectionId connectionId = sessionId.getParentId(); |
| 2906 | - TransportConnectionState cs = lookupConnectionState(connectionId); |
| 2907 | - SessionState ss = cs.getSessionState(sessionId); |
| 2908 | - if (ss == null) { |
| 2909 | - throw new IllegalStateException("Cannot add a producer to a session that had not been registered: " |
| 2910 | - + sessionId); |
| 2911 | - } |
| 2912 | - // Avoid replaying dup commands |
| 2913 | - if (!ss.getProducerIds().contains(info.getProducerId())) { |
| 2914 | - broker.addProducer(cs.getContext(), info); |
| 2915 | - try { |
| 2916 | - ss.addProducer(info); |
| 2917 | - } catch (IllegalStateException e) { |
| 2918 | - broker.removeProducer(cs.getContext(), info); |
| 2919 | - } |
| 2920 | - } |
| 2921 | - return null; |
| 2922 | - } |
| 2923 | - |
| 2924 | - public Response processRemoveProducer(ProducerId id) throws Exception { |
| 2925 | - SessionId sessionId = id.getParentId(); |
| 2926 | - ConnectionId connectionId = sessionId.getParentId(); |
| 2927 | - TransportConnectionState cs = lookupConnectionState(connectionId); |
| 2928 | - SessionState ss = cs.getSessionState(sessionId); |
| 2929 | - if (ss == null) { |
| 2930 | - throw new IllegalStateException("Cannot remove a producer from a session that had not been registered: " |
| 2931 | - + sessionId); |
| 2932 | - } |
| 2933 | - ProducerState ps = ss.removeProducer(id); |
| 2934 | - if (ps == null) { |
| 2935 | - throw new IllegalStateException("Cannot remove a producer that had not been registered: " + id); |
| 2936 | - } |
| 2937 | - removeProducerBrokerExchange(id); |
| 2938 | - broker.removeProducer(cs.getContext(), ps.getInfo()); |
| 2939 | - return null; |
| 2940 | - } |
| 2941 | - |
| 2942 | - public Response processAddConsumer(ConsumerInfo info) throws Exception { |
| 2943 | - SessionId sessionId = info.getConsumerId().getParentId(); |
| 2944 | - ConnectionId connectionId = sessionId.getParentId(); |
| 2945 | - TransportConnectionState cs = lookupConnectionState(connectionId); |
| 2946 | - SessionState ss = cs.getSessionState(sessionId); |
| 2947 | - if (ss == null) { |
| 2948 | - throw new IllegalStateException(broker.getBrokerName() |
| 2949 | - + " Cannot add a consumer to a session that had not been registered: " + sessionId); |
| 2950 | - } |
| 2951 | - // Avoid replaying dup commands |
| 2952 | - if (!ss.getConsumerIds().contains(info.getConsumerId())) { |
| 2953 | - broker.addConsumer(cs.getContext(), info); |
| 2954 | - try { |
| 2955 | - ss.addConsumer(info); |
| 2956 | - } catch (IllegalStateException e) { |
| 2957 | - broker.removeConsumer(cs.getContext(), info); |
| 2958 | - } |
| 2959 | - } |
| 2960 | - return null; |
| 2961 | - } |
| 2962 | - |
| 2963 | - public Response processRemoveConsumer(ConsumerId id, long lastDeliveredSequenceId) throws Exception { |
| 2964 | - SessionId sessionId = id.getParentId(); |
| 2965 | - ConnectionId connectionId = sessionId.getParentId(); |
| 2966 | - TransportConnectionState cs = lookupConnectionState(connectionId); |
| 2967 | - if (cs == null) { |
| 2968 | - throw new IllegalStateException("Cannot remove a consumer from a connection that had not been registered: " |
| 2969 | - + connectionId); |
| 2970 | - } |
| 2971 | - SessionState ss = cs.getSessionState(sessionId); |
| 2972 | - if (ss == null) { |
| 2973 | - throw new IllegalStateException("Cannot remove a consumer from a session that had not been registered: " |
| 2974 | - + sessionId); |
| 2975 | - } |
| 2976 | - ConsumerState consumerState = ss.removeConsumer(id); |
| 2977 | - if (consumerState == null) { |
| 2978 | - throw new IllegalStateException("Cannot remove a consumer that had not been registered: " + id); |
| 2979 | - } |
| 2980 | - ConsumerInfo info = consumerState.getInfo(); |
| 2981 | - info.setLastDeliveredSequenceId(lastDeliveredSequenceId); |
| 2982 | - broker.removeConsumer(cs.getContext(), consumerState.getInfo()); |
| 2983 | - removeConsumerBrokerExchange(id); |
| 2984 | - return null; |
| 2985 | - } |
| 2986 | - |
| 2987 | - public Response processAddSession(SessionInfo info) throws Exception { |
| 2988 | - ConnectionId connectionId = info.getSessionId().getParentId(); |
| 2989 | - TransportConnectionState cs = lookupConnectionState(connectionId); |
| 2990 | - // Avoid replaying dup commands |
| 2991 | - if (cs != null && !cs.getSessionIds().contains(info.getSessionId())) { |
| 2992 | - broker.addSession(cs.getContext(), info); |
| 2993 | - try { |
| 2994 | - cs.addSession(info); |
| 2995 | - } catch (IllegalStateException e) { |
| 2996 | - e.printStackTrace(); |
| 2997 | - broker.removeSession(cs.getContext(), info); |
| 2998 | - } |
| 2999 | - } |
| 3000 | - return null; |
| 3001 | - } |
| 3002 | - |
| 3003 | - public Response processRemoveSession(SessionId id, long lastDeliveredSequenceId) throws Exception { |
| 3004 | - ConnectionId connectionId = id.getParentId(); |
| 3005 | - TransportConnectionState cs = lookupConnectionState(connectionId); |
| 3006 | - if (cs == null) { |
| 3007 | - throw new IllegalStateException("Cannot remove session from connection that had not been registered: " + connectionId); |
| 3008 | - } |
| 3009 | - SessionState session = cs.getSessionState(id); |
| 3010 | - if (session == null) { |
| 3011 | - throw new IllegalStateException("Cannot remove session that had not been registered: " + id); |
| 3012 | - } |
| 3013 | - // Don't let new consumers or producers get added while we are closing |
| 3014 | - // this down. |
| 3015 | - session.shutdown(); |
| 3016 | - // Cascade the connection stop to the consumers and producers. |
| 3017 | - for (Iterator iter = session.getConsumerIds().iterator(); iter.hasNext();) { |
| 3018 | - ConsumerId consumerId = (ConsumerId) iter.next(); |
| 3019 | - try { |
| 3020 | - processRemoveConsumer(consumerId, lastDeliveredSequenceId); |
| 3021 | - } catch (Throwable e) { |
| 3022 | - LOG.warn("Failed to remove consumer: " + consumerId + ". Reason: " + e, e); |
| 3023 | - } |
| 3024 | - } |
| 3025 | - for (Iterator iter = session.getProducerIds().iterator(); iter.hasNext();) { |
| 3026 | - ProducerId producerId = (ProducerId) iter.next(); |
| 3027 | - try { |
| 3028 | - processRemoveProducer(producerId); |
| 3029 | - } catch (Throwable e) { |
| 3030 | - LOG.warn("Failed to remove producer: " + producerId + ". Reason: " + e, e); |
| 3031 | - } |
| 3032 | - } |
| 3033 | - cs.removeSession(id); |
| 3034 | - broker.removeSession(cs.getContext(), session.getInfo()); |
| 3035 | - return null; |
| 3036 | - } |
| 3037 | - |
| 3038 | - public Response processAddConnection(ConnectionInfo info) throws Exception { |
| 3039 | - // if the broker service has slave attached, wait for the slave to be |
| 3040 | - // attached to allow client connection. slave connection is fine |
| 3041 | - if (!info.isBrokerMasterConnector() && connector.getBrokerService().isWaitForSlave() |
| 3042 | - && connector.getBrokerService().getSlaveStartSignal().getCount() == 1) { |
| 3043 | - ServiceSupport.dispose(transport); |
| 3044 | - return new ExceptionResponse(new Exception("Master's slave not attached yet.")); |
| 3045 | - } |
| 3046 | - // Older clients should have been defaulting this field to true.. but |
| 3047 | - // they were not. |
| 3048 | - if (wireFormatInfo != null && wireFormatInfo.getVersion() <= 2) { |
| 3049 | - info.setClientMaster(true); |
| 3050 | - } |
| 3051 | - TransportConnectionState state; |
| 3052 | - // Make sure 2 concurrent connections by the same ID only generate 1 |
| 3053 | - // TransportConnectionState object. |
| 3054 | - synchronized (brokerConnectionStates) { |
| 3055 | - state = (TransportConnectionState) brokerConnectionStates.get(info.getConnectionId()); |
| 3056 | - if (state == null) { |
| 3057 | - state = new TransportConnectionState(info, this); |
| 3058 | - brokerConnectionStates.put(info.getConnectionId(), state); |
| 3059 | - } |
| 3060 | - state.incrementReference(); |
| 3061 | - } |
| 3062 | - // If there are 2 concurrent connections for the same connection id, |
| 3063 | - // then last one in wins, we need to sync here |
| 3064 | - // to figure out the winner. |
| 3065 | - synchronized (state.getConnectionMutex()) { |
| 3066 | - if (state.getConnection() != this) { |
| 3067 | - LOG.debug("Killing previous stale connection: " + state.getConnection().getRemoteAddress()); |
| 3068 | - state.getConnection().stop(); |
| 3069 | - LOG.debug("Connection " + getRemoteAddress() + " taking over previous connection: " |
| 3070 | - + state.getConnection().getRemoteAddress()); |
| 3071 | - state.setConnection(this); |
| 3072 | - state.reset(info); |
| 3073 | - } |
| 3074 | - } |
| 3075 | - registerConnectionState(info.getConnectionId(), state); |
| 3076 | - LOG.debug("Setting up new connection id: " + info.getConnectionId() + ", address: " + getRemoteAddress()); |
| 3077 | - this.faultTolerantConnection=info.isFaultTolerant(); |
| 3078 | - // Setup the context. |
| 3079 | - String clientId = info.getClientId(); |
| 3080 | - context = new ConnectionContext(); |
| 3081 | - context.setBroker(broker); |
| 3082 | - context.setClientId(clientId); |
| 3083 | - context.setClientMaster(info.isClientMaster()); |
| 3084 | - context.setConnection(this); |
| 3085 | - context.setConnectionId(info.getConnectionId()); |
| 3086 | - context.setConnector(connector); |
| 3087 | - context.setMessageAuthorizationPolicy(getMessageAuthorizationPolicy()); |
| 3088 | - context.setNetworkConnection(networkConnection); |
| 3089 | - context.setFaultTolerant(faultTolerantConnection); |
| 3090 | - context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); |
| 3091 | - context.setUserName(info.getUserName()); |
| 3092 | - context.setWireFormatInfo(wireFormatInfo); |
| 3093 | - context.setReconnect(info.isFailoverReconnect()); |
| 3094 | - this.manageable = info.isManageable(); |
| 3095 | - state.setContext(context); |
| 3096 | - state.setConnection(this); |
| 3097 | - |
| 3098 | - try { |
| 3099 | - broker.addConnection(context, info); |
| 3100 | - } catch (Exception e) { |
| 3101 | - synchronized (brokerConnectionStates) { |
| 3102 | - brokerConnectionStates.remove(info.getConnectionId()); |
| 3103 | - } |
| 3104 | - unregisterConnectionState(info.getConnectionId()); |
| 3105 | - LOG.warn("Failed to add Connection " + info.getConnectionId() + ", reason: " + e.toString()); |
| 3106 | - if (LOG.isDebugEnabled()) { |
| 3107 | - LOG.debug("Exception detail:", e); |
| 3108 | - } |
| 3109 | - throw e; |
| 3110 | - } |
| 3111 | - if (info.isManageable()) { |
| 3112 | - // send ConnectionCommand |
| 3113 | - ConnectionControl command = this.connector.getConnectionControl(); |
| 3114 | - command.setFaultTolerant(broker.isFaultTolerantConfiguration()); |
| 3115 | - dispatchAsync(command); |
| 3116 | - } |
| 3117 | - return null; |
| 3118 | - } |
| 3119 | - |
| 3120 | - public synchronized Response processRemoveConnection(ConnectionId id, long lastDeliveredSequenceId) |
| 3121 | - throws InterruptedException { |
| 3122 | - LOG.debug("remove connection id: " + id); |
| 3123 | - TransportConnectionState cs = lookupConnectionState(id); |
| 3124 | - if (cs != null) { |
| 3125 | - // Don't allow things to be added to the connection state while we |
| 3126 | - // are |
| 3127 | - // shutting down. |
| 3128 | - cs.shutdown(); |
| 3129 | - // Cascade the connection stop to the sessions. |
| 3130 | - for (Iterator iter = cs.getSessionIds().iterator(); iter.hasNext();) { |
| 3131 | - SessionId sessionId = (SessionId) iter.next(); |
| 3132 | - try { |
| 3133 | - processRemoveSession(sessionId, lastDeliveredSequenceId); |
| 3134 | - } catch (Throwable e) { |
| 3135 | - SERVICELOG.warn("Failed to remove session " + sessionId, e); |
| 3136 | - } |
| 3137 | - } |
| 3138 | - // Cascade the connection stop to temp destinations. |
| 3139 | - for (Iterator iter = cs.getTempDestinations().iterator(); iter.hasNext();) { |
| 3140 | - DestinationInfo di = (DestinationInfo) iter.next(); |
| 3141 | - try { |
| 3142 | - broker.removeDestination(cs.getContext(), di.getDestination(), 0); |
| 3143 | - } catch (Throwable e) { |
| 3144 | - SERVICELOG.warn("Failed to remove tmp destination " + di.getDestination(), e); |
| 3145 | - } |
| 3146 | - iter.remove(); |
| 3147 | - } |
| 3148 | - try { |
| 3149 | - broker.removeConnection(cs.getContext(), cs.getInfo(), null); |
| 3150 | - } catch (Throwable e) { |
| 3151 | - SERVICELOG.warn("Failed to remove connection " + cs.getInfo() + ", reason: " + e.toString()); |
| 3152 | - if (LOG.isDebugEnabled()) { |
| 3153 | - SERVICELOG.debug("Exception detail:", e); |
| 3154 | - } |
| 3155 | - } |
| 3156 | - TransportConnectionState state = unregisterConnectionState(id); |
| 3157 | - if (state != null) { |
| 3158 | - synchronized (brokerConnectionStates) { |
| 3159 | - // If we are the last reference, we should remove the state |
| 3160 | - // from the broker. |
| 3161 | - if (state.decrementReference() == 0) { |
| 3162 | - brokerConnectionStates.remove(id); |
| 3163 | - } |
| 3164 | - } |
| 3165 | - } |
| 3166 | - } |
| 3167 | - return null; |
| 3168 | - } |
| 3169 | - |
| 3170 | - public Response processProducerAck(ProducerAck ack) throws Exception { |
| 3171 | - // A broker should not get ProducerAck messages. |
| 3172 | - return null; |
| 3173 | - } |
| 3174 | - |
| 3175 | - public Connector getConnector() { |
| 3176 | - return connector; |
| 3177 | - } |
| 3178 | - |
| 3179 | - public void dispatchSync(Command message) { |
| 3180 | - // getStatistics().getEnqueues().increment(); |
| 3181 | - try { |
| 3182 | - processDispatch(message); |
| 3183 | - } catch (IOException e) { |
| 3184 | - serviceExceptionAsync(e); |
| 3185 | - } |
| 3186 | - } |
| 3187 | - |
| 3188 | - public void dispatchAsync(Command message) { |
| 3189 | - if (!stopping.get()) { |
| 3190 | - // getStatistics().getEnqueues().increment(); |
| 3191 | - if (taskRunner == null) { |
| 3192 | - dispatchSync(message); |
| 3193 | - } else { |
| 3194 | - synchronized (dispatchQueue) { |
| 3195 | - dispatchQueue.add(message); |
| 3196 | - } |
| 3197 | - try { |
| 3198 | - taskRunner.wakeup(); |
| 3199 | - } catch (InterruptedException e) { |
| 3200 | - Thread.currentThread().interrupt(); |
| 3201 | - } |
| 3202 | - } |
| 3203 | - } else { |
| 3204 | - if (message.isMessageDispatch()) { |
| 3205 | - MessageDispatch md = (MessageDispatch) message; |
| 3206 | - Runnable sub = md.getTransmitCallback(); |
| 3207 | - broker.postProcessDispatch(md); |
| 3208 | - if (sub != null) { |
| 3209 | - sub.run(); |
| 3210 | - } |
| 3211 | - } |
| 3212 | - } |
| 3213 | - } |
| 3214 | - |
| 3215 | - protected void processDispatch(Command command) throws IOException { |
| 3216 | - final MessageDispatch messageDispatch = (MessageDispatch) (command.isMessageDispatch() ? command : null); |
| 3217 | - try { |
| 3218 | - if (!stopping.get()) { |
| 3219 | - if (messageDispatch != null) { |
| 3220 | - broker.preProcessDispatch(messageDispatch); |
| 3221 | - } |
| 3222 | - dispatch(command); |
| 3223 | - } |
| 3224 | - } finally { |
| 3225 | - if (messageDispatch != null) { |
| 3226 | - Runnable sub = messageDispatch.getTransmitCallback(); |
| 3227 | - broker.postProcessDispatch(messageDispatch); |
| 3228 | - if (sub != null) { |
| 3229 | - sub.run(); |
| 3230 | - } |
| 3231 | - } |
| 3232 | - // getStatistics().getDequeues().increment(); |
| 3233 | - } |
| 3234 | - } |
| 3235 | - |
| 3236 | - public boolean iterate() { |
| 3237 | - try { |
| 3238 | - if (stopping.get()) { |
| 3239 | - if (dispatchStopped.compareAndSet(false, true)) { |
| 3240 | - if (transportException.get() == null) { |
| 3241 | - try { |
| 3242 | - dispatch(new ShutdownInfo()); |
| 3243 | - } catch (Throwable ignore) { |
| 3244 | - } |
| 3245 | - } |
| 3246 | - dispatchStoppedLatch.countDown(); |
| 3247 | - } |
| 3248 | - return false; |
| 3249 | - } |
| 3250 | - if (!dispatchStopped.get()) { |
| 3251 | - Command command = null; |
| 3252 | - synchronized (dispatchQueue) { |
| 3253 | - if (dispatchQueue.isEmpty()) { |
| 3254 | - return false; |
| 3255 | - } |
| 3256 | - command = dispatchQueue.remove(0); |
| 3257 | - } |
| 3258 | - processDispatch(command); |
| 3259 | - return true; |
| 3260 | - } |
| 3261 | - return false; |
| 3262 | - } catch (IOException e) { |
| 3263 | - if (dispatchStopped.compareAndSet(false, true)) { |
| 3264 | - dispatchStoppedLatch.countDown(); |
| 3265 | - } |
| 3266 | - serviceExceptionAsync(e); |
| 3267 | - return false; |
| 3268 | - } |
| 3269 | - } |
| 3270 | - |
| 3271 | - /** |
| 3272 | - * Returns the statistics for this connection |
| 3273 | - */ |
| 3274 | - public ConnectionStatistics getStatistics() { |
| 3275 | - return statistics; |
| 3276 | - } |
| 3277 | - |
| 3278 | - public MessageAuthorizationPolicy getMessageAuthorizationPolicy() { |
| 3279 | - return messageAuthorizationPolicy; |
| 3280 | - } |
| 3281 | - |
| 3282 | - public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy) { |
| 3283 | - this.messageAuthorizationPolicy = messageAuthorizationPolicy; |
| 3284 | - } |
| 3285 | - |
| 3286 | - public boolean isManageable() { |
| 3287 | - return manageable; |
| 3288 | - } |
| 3289 | - |
| 3290 | - public void start() throws Exception { |
| 3291 | - starting = true; |
| 3292 | - try { |
| 3293 | - synchronized (this) { |
| 3294 | - if (taskRunnerFactory != null) { |
| 3295 | - taskRunner = taskRunnerFactory.createTaskRunner(this, "ActiveMQ Connection Dispatcher: " |
| 3296 | - + getRemoteAddress()); |
| 3297 | - } else { |
| 3298 | - taskRunner = null; |
| 3299 | - } |
| 3300 | - transport.start(); |
| 3301 | - active = true; |
| 3302 | - BrokerInfo info = connector.getBrokerInfo().copy(); |
| 3303 | - if (connector.isUpdateClusterClients()) { |
| 3304 | - info.setPeerBrokerInfos(this.broker.getPeerBrokerInfos()); |
| 3305 | - } else { |
| 3306 | - info.setPeerBrokerInfos(null); |
| 3307 | - } |
| 3308 | - dispatchAsync(info); |
| 3309 | - |
| 3310 | - connector.onStarted(this); |
| 3311 | - } |
| 3312 | - } catch (Exception e) { |
| 3313 | - // Force clean up on an error starting up. |
| 3314 | - stop(); |
| 3315 | - throw e; |
| 3316 | - } finally { |
| 3317 | - // stop() can be called from within the above block, |
| 3318 | - // but we want to be sure start() completes before |
| 3319 | - // stop() runs, so queue the stop until right now: |
| 3320 | - starting = false; |
| 3321 | - if (pendingStop) { |
| 3322 | - LOG.debug("Calling the delayed stop()"); |
| 3323 | - stop(); |
| 3324 | - } |
| 3325 | - } |
| 3326 | - } |
| 3327 | - |
| 3328 | - public void stop() throws Exception { |
| 3329 | - synchronized (this) { |
| 3330 | - pendingStop = true; |
| 3331 | - if (starting) { |
| 3332 | - LOG.debug("stop() called in the middle of start(). Delaying..."); |
| 3333 | - return; |
| 3334 | - } |
| 3335 | - } |
| 3336 | - stopAsync(); |
| 3337 | - while (!stopped.await(5, TimeUnit.SECONDS)) { |
| 3338 | - LOG.info("The connection to '" + transport.getRemoteAddress() + "' is taking a long time to shutdown."); |
| 3339 | - } |
| 3340 | - } |
| 3341 | - |
| 3342 | - public void stopAsync() { |
| 3343 | - // If we're in the middle of starting |
| 3344 | - // then go no further... for now. |
| 3345 | - if (stopping.compareAndSet(false, true)) { |
| 3346 | - // Let all the connection contexts know we are shutting down |
| 3347 | - // so that in progress operations can notice and unblock. |
| 3348 | - List<TransportConnectionState> connectionStates = listConnectionStates(); |
| 3349 | - for (TransportConnectionState cs : connectionStates) { |
| 3350 | - cs.getContext().getStopping().set(true); |
| 3351 | - } |
| 3352 | - try { |
| 3353 | - final Map context = MDCHelper.getCopyOfContextMap(); |
| 3354 | - DefaultThreadPools.getDefaultTaskRunnerFactory().execute(new Runnable(){ |
| 3355 | - public void run() { |
| 3356 | - serviceLock.writeLock().lock(); |
| 3357 | - try { |
| 3358 | - MDCHelper.setContextMap(context); |
| 3359 | - doStop(); |
| 3360 | - } catch (Throwable e) { |
| 3361 | - LOG.debug("Error occured while shutting down a connection to '" + transport.getRemoteAddress() |
| 3362 | - + "': ", e); |
| 3363 | - } finally { |
| 3364 | - stopped.countDown(); |
| 3365 | - serviceLock.writeLock().unlock(); |
| 3366 | - } |
| 3367 | - } |
| 3368 | - }, "StopAsync:" + transport.getRemoteAddress()); |
| 3369 | - } catch (Throwable t) { |
| 3370 | - LOG.warn("cannot create async transport stopper thread.. not waiting for stop to complete, reason:", t); |
| 3371 | - stopped.countDown(); |
| 3372 | - } |
| 3373 | - } |
| 3374 | - } |
| 3375 | - |
| 3376 | - @Override |
| 3377 | - public String toString() { |
| 3378 | - return "Transport Connection to: " + transport.getRemoteAddress(); |
| 3379 | - } |
| 3380 | - |
| 3381 | - protected void doStop() throws Exception, InterruptedException { |
| 3382 | - LOG.debug("Stopping connection: " + transport.getRemoteAddress()); |
| 3383 | - connector.onStopped(this); |
| 3384 | - try { |
| 3385 | - synchronized (this) { |
| 3386 | - if (masterBroker != null) { |
| 3387 | - masterBroker.stop(); |
| 3388 | - } |
| 3389 | - if (duplexBridge != null) { |
| 3390 | - duplexBridge.stop(); |
| 3391 | - } |
| 3392 | - } |
| 3393 | - } catch (Exception ignore) { |
| 3394 | - LOG.trace("Exception caught stopping", ignore); |
| 3395 | - } |
| 3396 | - try { |
| 3397 | - transport.stop(); |
| 3398 | - LOG.debug("Stopped transport: " + transport.getRemoteAddress()); |
| 3399 | - } catch (Exception e) { |
| 3400 | - LOG.debug("Could not stop transport: " + e, e); |
| 3401 | - } |
| 3402 | - if (taskRunner != null) { |
| 3403 | - taskRunner.shutdown(1); |
| 3404 | - } |
| 3405 | - active = false; |
| 3406 | - // Run the MessageDispatch callbacks so that message references get |
| 3407 | - // cleaned up. |
| 3408 | - synchronized (dispatchQueue) { |
| 3409 | - for (Iterator<Command> iter = dispatchQueue.iterator(); iter.hasNext();) { |
| 3410 | - Command command = iter.next(); |
| 3411 | - if (command.isMessageDispatch()) { |
| 3412 | - MessageDispatch md = (MessageDispatch) command; |
| 3413 | - Runnable sub = md.getTransmitCallback(); |
| 3414 | - broker.postProcessDispatch(md); |
| 3415 | - if (sub != null) { |
| 3416 | - sub.run(); |
| 3417 | - } |
| 3418 | - } |
| 3419 | - } |
| 3420 | - dispatchQueue.clear(); |
| 3421 | - } |
| 3422 | - // |
| 3423 | - // Remove all logical connection associated with this connection |
| 3424 | - // from the broker. |
| 3425 | - if (!broker.isStopped()) { |
| 3426 | - List<TransportConnectionState> connectionStates = listConnectionStates(); |
| 3427 | - connectionStates = listConnectionStates(); |
| 3428 | - for (TransportConnectionState cs : connectionStates) { |
| 3429 | - cs.getContext().getStopping().set(true); |
| 3430 | - try { |
| 3431 | - LOG.debug("Cleaning up connection resources: " + getRemoteAddress()); |
| 3432 | - processRemoveConnection(cs.getInfo().getConnectionId(), 0l); |
| 3433 | - } catch (Throwable ignore) { |
| 3434 | - ignore.printStackTrace(); |
| 3435 | - } |
| 3436 | - } |
| 3437 | - } |
| 3438 | - LOG.debug("Connection Stopped: " + getRemoteAddress()); |
| 3439 | - } |
| 3440 | - |
| 3441 | - /** |
| 3442 | - * @return Returns the blockedCandidate. |
| 3443 | - */ |
| 3444 | - public boolean isBlockedCandidate() { |
| 3445 | - return blockedCandidate; |
| 3446 | - } |
| 3447 | - |
| 3448 | - /** |
| 3449 | - * @param blockedCandidate |
| 3450 | - * The blockedCandidate to set. |
| 3451 | - */ |
| 3452 | - public void setBlockedCandidate(boolean blockedCandidate) { |
| 3453 | - this.blockedCandidate = blockedCandidate; |
| 3454 | - } |
| 3455 | - |
| 3456 | - /** |
| 3457 | - * @return Returns the markedCandidate. |
| 3458 | - */ |
| 3459 | - public boolean isMarkedCandidate() { |
| 3460 | - return markedCandidate; |
| 3461 | - } |
| 3462 | - |
| 3463 | - /** |
| 3464 | - * @param markedCandidate |
| 3465 | - * The markedCandidate to set. |
| 3466 | - */ |
| 3467 | - public void setMarkedCandidate(boolean markedCandidate) { |
| 3468 | - this.markedCandidate = markedCandidate; |
| 3469 | - if (!markedCandidate) { |
| 3470 | - timeStamp = 0; |
| 3471 | - blockedCandidate = false; |
| 3472 | - } |
| 3473 | - } |
| 3474 | - |
| 3475 | - /** |
| 3476 | - * @param slow |
| 3477 | - * The slow to set. |
| 3478 | - */ |
| 3479 | - public void setSlow(boolean slow) { |
| 3480 | - this.slow = slow; |
| 3481 | - } |
| 3482 | - |
| 3483 | - /** |
| 3484 | - * @return true if the Connection is slow |
| 3485 | - */ |
| 3486 | - public boolean isSlow() { |
| 3487 | - return slow; |
| 3488 | - } |
| 3489 | - |
| 3490 | - /** |
| 3491 | - * @return true if the Connection is potentially blocked |
| 3492 | - */ |
| 3493 | - public boolean isMarkedBlockedCandidate() { |
| 3494 | - return markedCandidate; |
| 3495 | - } |
| 3496 | - |
| 3497 | - /** |
| 3498 | - * Mark the Connection, so we can deem if it's collectable on the next sweep |
| 3499 | - */ |
| 3500 | - public void doMark() { |
| 3501 | - if (timeStamp == 0) { |
| 3502 | - timeStamp = System.currentTimeMillis(); |
| 3503 | - } |
| 3504 | - } |
| 3505 | - |
| 3506 | - /** |
| 3507 | - * @return if after being marked, the Connection is still writing |
| 3508 | - */ |
| 3509 | - public boolean isBlocked() { |
| 3510 | - return blocked; |
| 3511 | - } |
| 3512 | - |
| 3513 | - /** |
| 3514 | - * @return true if the Connection is connected |
| 3515 | - */ |
| 3516 | - public boolean isConnected() { |
| 3517 | - return connected; |
| 3518 | - } |
| 3519 | - |
| 3520 | - /** |
| 3521 | - * @param blocked |
| 3522 | - * The blocked to set. |
| 3523 | - */ |
| 3524 | - public void setBlocked(boolean blocked) { |
| 3525 | - this.blocked = blocked; |
| 3526 | - } |
| 3527 | - |
| 3528 | - /** |
| 3529 | - * @param connected |
| 3530 | - * The connected to set. |
| 3531 | - */ |
| 3532 | - public void setConnected(boolean connected) { |
| 3533 | - this.connected = connected; |
| 3534 | - } |
| 3535 | - |
| 3536 | - /** |
| 3537 | - * @return true if the Connection is active |
| 3538 | - */ |
| 3539 | - public boolean isActive() { |
| 3540 | - return active; |
| 3541 | - } |
| 3542 | - |
| 3543 | - /** |
| 3544 | - * @param active |
| 3545 | - * The active to set. |
| 3546 | - */ |
| 3547 | - public void setActive(boolean active) { |
| 3548 | - this.active = active; |
| 3549 | - } |
| 3550 | - |
| 3551 | - /** |
| 3552 | - * @return true if the Connection is starting |
| 3553 | - */ |
| 3554 | - public synchronized boolean isStarting() { |
| 3555 | - return starting; |
| 3556 | - } |
| 3557 | - |
| 3558 | - public synchronized boolean isNetworkConnection() { |
| 3559 | - return networkConnection; |
| 3560 | - } |
| 3561 | - |
| 3562 | - public boolean isFaultTolerantConnection() { |
| 3563 | - return this.faultTolerantConnection; |
| 3564 | - } |
| 3565 | - |
| 3566 | - protected synchronized void setStarting(boolean starting) { |
| 3567 | - this.starting = starting; |
| 3568 | - } |
| 3569 | - |
| 3570 | - /** |
| 3571 | - * @return true if the Connection needs to stop |
| 3572 | - */ |
| 3573 | - public synchronized boolean isPendingStop() { |
| 3574 | - return pendingStop; |
| 3575 | - } |
| 3576 | - |
| 3577 | - protected synchronized void setPendingStop(boolean pendingStop) { |
| 3578 | - this.pendingStop = pendingStop; |
| 3579 | - } |
| 3580 | - |
| 3581 | - public Response processBrokerInfo(BrokerInfo info) { |
| 3582 | - if (info.isSlaveBroker()) { |
| 3583 | - BrokerService bService = connector.getBrokerService(); |
| 3584 | - // Do we only support passive slaves - or does the slave want to be |
| 3585 | - // passive ? |
| 3586 | - boolean passive = bService.isPassiveSlave() || info.isPassiveSlave(); |
| 3587 | - if (passive == false) { |
| 3588 | - |
| 3589 | - // stream messages from this broker (the master) to |
| 3590 | - // the slave |
| 3591 | - MutableBrokerFilter parent = (MutableBrokerFilter) broker.getAdaptor(MutableBrokerFilter.class); |
| 3592 | - masterBroker = new MasterBroker(parent, transport); |
| 3593 | - masterBroker.startProcessing(); |
| 3594 | - } |
| 3595 | - LOG.info((passive?"Passive":"Active")+" Slave Broker " + info.getBrokerName() + " is attached"); |
| 3596 | - bService.slaveConnectionEstablished(); |
| 3597 | - } else if (info.isNetworkConnection() && info.isDuplexConnection()) { |
| 3598 | - // so this TransportConnection is the rear end of a network bridge |
| 3599 | - // We have been requested to create a two way pipe ... |
| 3600 | - try { |
| 3601 | - Properties properties = MarshallingSupport.stringToProperties(info.getNetworkProperties()); |
| 3602 | - Map<String, String> props = createMap(properties); |
| 3603 | - NetworkBridgeConfiguration config = new NetworkBridgeConfiguration(); |
| 3604 | - IntrospectionSupport.setProperties(config, props, ""); |
| 3605 | - config.setBrokerName(broker.getBrokerName()); |
| 3606 | - |
| 3607 | - // check for existing duplex connection hanging about |
| 3608 | - |
| 3609 | - // We first look if existing network connection already exists for the same broker Id and network connector name |
| 3610 | - // It's possible in case of brief network fault to have this transport connector side of the connection always active |
| 3611 | - // and the duplex network connector side wanting to open a new one |
| 3612 | - // In this case, the old connection must be broken |
| 3613 | - String duplexNetworkConnectorId = config.getName() + "@" + info.getBrokerId(); |
| 3614 | - CopyOnWriteArrayList<TransportConnection> connections = this.connector.getConnections(); |
| 3615 | - synchronized (connections) { |
| 3616 | - for (Iterator<TransportConnection> iter = connections.iterator(); iter.hasNext();) { |
| 3617 | - TransportConnection c = iter.next(); |
| 3618 | - if ((c != this) && (duplexNetworkConnectorId.equals(c.getDuplexNetworkConnectorId()))) { |
| 3619 | - LOG.warn("Stopping an existing active duplex connection [" + c + "] for network connector (" + duplexNetworkConnectorId + ")."); |
| 3620 | - c.stopAsync(); |
| 3621 | - // better to wait for a bit rather than get connection id already in use and failure to start new bridge |
| 3622 | - c.getStopped().await(1, TimeUnit.SECONDS); |
| 3623 | - } |
| 3624 | - } |
| 3625 | - setDuplexNetworkConnectorId(duplexNetworkConnectorId); |
| 3626 | - } |
| 3627 | - URI uri = broker.getVmConnectorURI(); |
| 3628 | - HashMap<String, String> map = new HashMap<String, String>(URISupport.parseParameters(uri)); |
| 3629 | - map.put("network", "true"); |
| 3630 | - map.put("async", "false"); |
| 3631 | - uri = URISupport.createURIWithQuery(uri, URISupport.createQueryString(map)); |
| 3632 | - Transport localTransport = TransportFactory.connect(uri); |
| 3633 | - Transport remoteBridgeTransport = new ResponseCorrelator(transport); |
| 3634 | - String duplexName = localTransport.toString(); |
| 3635 | - if (duplexName.contains("#")) { |
| 3636 | - duplexName = duplexName.substring(duplexName.lastIndexOf("#")); |
| 3637 | - } |
| 3638 | - MBeanNetworkListener listener = new MBeanNetworkListener(broker.getBrokerService(), broker.getBrokerService().createDuplexNetworkConnectorObjectName(duplexName)); |
| 3639 | - listener.setCreatedByDuplex(true); |
| 3640 | - duplexBridge = NetworkBridgeFactory.createBridge(config, localTransport, remoteBridgeTransport, listener); |
| 3641 | - duplexBridge.setBrokerService(broker.getBrokerService()); |
| 3642 | - // now turn duplex off this side |
| 3643 | - info.setDuplexConnection(false); |
| 3644 | - duplexBridge.setCreatedByDuplex(true); |
| 3645 | - duplexBridge.duplexStart(this, brokerInfo, info); |
| 3646 | - LOG.info("Started responder end of duplex bridge " + duplexNetworkConnectorId); |
| 3647 | - return null; |
| 3648 | - } catch (TransportDisposedIOException e) { |
| 3649 | - LOG.warn("Duplex bridge " + duplexNetworkConnectorId + " was stopped before it was correctly started."); |
| 3650 | - return null; |
| 3651 | - } catch (Exception e) { |
| 3652 | - LOG.error("Failed to create responder end of duplex network bridge " + duplexNetworkConnectorId , e); |
| 3653 | - return null; |
| 3654 | - } |
| 3655 | - } |
| 3656 | - // We only expect to get one broker info command per connection |
| 3657 | - if (this.brokerInfo != null) { |
| 3658 | - LOG.warn("Unexpected extra broker info command received: " + info); |
| 3659 | - } |
| 3660 | - this.brokerInfo = info; |
| 3661 | - networkConnection = true; |
| 3662 | - List<TransportConnectionState> connectionStates = listConnectionStates(); |
| 3663 | - for (TransportConnectionState cs : connectionStates) { |
| 3664 | - cs.getContext().setNetworkConnection(true); |
| 3665 | - } |
| 3666 | - return null; |
| 3667 | - } |
| 3668 | - |
| 3669 | - @SuppressWarnings("unchecked") |
| 3670 | - private HashMap<String, String> createMap(Properties properties) { |
| 3671 | - return new HashMap(properties); |
| 3672 | - } |
| 3673 | - |
| 3674 | - protected void dispatch(Command command) throws IOException { |
| 3675 | - try { |
| 3676 | - setMarkedCandidate(true); |
| 3677 | - transport.oneway(command); |
| 3678 | - } finally { |
| 3679 | - setMarkedCandidate(false); |
| 3680 | - } |
| 3681 | - } |
| 3682 | - |
| 3683 | - public String getRemoteAddress() { |
| 3684 | - return transport.getRemoteAddress(); |
| 3685 | - } |
| 3686 | - |
| 3687 | - public String getConnectionId() { |
| 3688 | - List<TransportConnectionState> connectionStates = listConnectionStates(); |
| 3689 | - for (TransportConnectionState cs : connectionStates) { |
| 3690 | - if (cs.getInfo().getClientId() != null) { |
| 3691 | - return cs.getInfo().getClientId(); |
| 3692 | - } |
| 3693 | - return cs.getInfo().getConnectionId().toString(); |
| 3694 | - } |
| 3695 | - return null; |
| 3696 | - } |
| 3697 | - |
| 3698 | - public void updateClient(ConnectionControl control) { |
| 3699 | - if (isActive() && isBlocked() == false && isFaultTolerantConnection() && this.wireFormatInfo != null |
| 3700 | - && this.wireFormatInfo.getVersion() >= 6) { |
| 3701 | - dispatchAsync(control); |
| 3702 | - } |
| 3703 | - } |
| 3704 | - |
| 3705 | - private ProducerBrokerExchange getProducerBrokerExchange(ProducerId id) throws IOException { |
| 3706 | - ProducerBrokerExchange result = producerExchanges.get(id); |
| 3707 | - if (result == null) { |
| 3708 | - synchronized (producerExchanges) { |
| 3709 | - result = new ProducerBrokerExchange(); |
| 3710 | - TransportConnectionState state = lookupConnectionState(id); |
| 3711 | - context = state.getContext(); |
| 3712 | - if (context.isReconnect()) { |
| 3713 | - result.setLastStoredSequenceId(broker.getBrokerService().getPersistenceAdapter().getLastProducerSequenceId(id)); |
| 3714 | - } |
| 3715 | - result.setConnectionContext(context); |
| 3716 | - SessionState ss = state.getSessionState(id.getParentId()); |
| 3717 | - if (ss != null) { |
| 3718 | - result.setProducerState(ss.getProducerState(id)); |
| 3719 | - ProducerState producerState = ss.getProducerState(id); |
| 3720 | - if (producerState != null && producerState.getInfo() != null) { |
| 3721 | - ProducerInfo info = producerState.getInfo(); |
| 3722 | - result.setMutable(info.getDestination() == null || info.getDestination().isComposite()); |
| 3723 | - } |
| 3724 | - } |
| 3725 | - producerExchanges.put(id, result); |
| 3726 | - } |
| 3727 | - } else { |
| 3728 | - context = result.getConnectionContext(); |
| 3729 | - } |
| 3730 | - return result; |
| 3731 | - } |
| 3732 | - |
| 3733 | - private void removeProducerBrokerExchange(ProducerId id) { |
| 3734 | - synchronized (producerExchanges) { |
| 3735 | - producerExchanges.remove(id); |
| 3736 | - } |
| 3737 | - } |
| 3738 | - |
| 3739 | - private ConsumerBrokerExchange getConsumerBrokerExchange(ConsumerId id) { |
| 3740 | - ConsumerBrokerExchange result = consumerExchanges.get(id); |
| 3741 | - if (result == null) { |
| 3742 | - synchronized (consumerExchanges) { |
| 3743 | - result = new ConsumerBrokerExchange(); |
| 3744 | - TransportConnectionState state = lookupConnectionState(id); |
| 3745 | - context = state.getContext(); |
| 3746 | - result.setConnectionContext(context); |
| 3747 | - SessionState ss = state.getSessionState(id.getParentId()); |
| 3748 | - if (ss != null) { |
| 3749 | - ConsumerState cs = ss.getConsumerState(id); |
| 3750 | - if (cs != null) { |
| 3751 | - ConsumerInfo info = cs.getInfo(); |
| 3752 | - if (info != null) { |
| 3753 | - if (info.getDestination() != null && info.getDestination().isPattern()) { |
| 3754 | - result.setWildcard(true); |
| 3755 | - } |
| 3756 | - } |
| 3757 | - } |
| 3758 | - } |
| 3759 | - consumerExchanges.put(id, result); |
| 3760 | - } |
| 3761 | - } |
| 3762 | - return result; |
| 3763 | - } |
| 3764 | - |
| 3765 | - private void removeConsumerBrokerExchange(ConsumerId id) { |
| 3766 | - synchronized (consumerExchanges) { |
| 3767 | - consumerExchanges.remove(id); |
| 3768 | - } |
| 3769 | - } |
| 3770 | - |
| 3771 | - public int getProtocolVersion() { |
| 3772 | - return protocolVersion.get(); |
| 3773 | - } |
| 3774 | - |
| 3775 | - public Response processControlCommand(ControlCommand command) throws Exception { |
| 3776 | - String control = command.getCommand(); |
| 3777 | - if (control != null && control.equals("shutdown")) { |
| 3778 | - System.exit(0); |
| 3779 | - } |
| 3780 | - return null; |
| 3781 | - } |
| 3782 | - |
| 3783 | - public Response processMessageDispatch(MessageDispatch dispatch) throws Exception { |
| 3784 | - return null; |
| 3785 | - } |
| 3786 | - |
| 3787 | - public Response processConnectionControl(ConnectionControl control) throws Exception { |
| 3788 | - if (control != null) { |
| 3789 | - faultTolerantConnection = control.isFaultTolerant(); |
| 3790 | - } |
| 3791 | - return null; |
| 3792 | - } |
| 3793 | - |
| 3794 | - public Response processConnectionError(ConnectionError error) throws Exception { |
| 3795 | - return null; |
| 3796 | - } |
| 3797 | - |
| 3798 | - public Response processConsumerControl(ConsumerControl control) throws Exception { |
| 3799 | - ConsumerBrokerExchange consumerExchange = getConsumerBrokerExchange(control.getConsumerId()); |
| 3800 | - broker.processConsumerControl(consumerExchange, control); |
| 3801 | - return null; |
| 3802 | - } |
| 3803 | - |
| 3804 | - protected synchronized TransportConnectionState registerConnectionState(ConnectionId connectionId, |
| 3805 | - TransportConnectionState state) { |
| 3806 | - TransportConnectionState cs = null; |
| 3807 | - if (!connectionStateRegister.isEmpty() && !connectionStateRegister.doesHandleMultipleConnectionStates()) { |
| 3808 | - // swap implementations |
| 3809 | - TransportConnectionStateRegister newRegister = new MapTransportConnectionStateRegister(); |
| 3810 | - newRegister.intialize(connectionStateRegister); |
| 3811 | - connectionStateRegister = newRegister; |
| 3812 | - } |
| 3813 | - cs = connectionStateRegister.registerConnectionState(connectionId, state); |
| 3814 | - return cs; |
| 3815 | - } |
| 3816 | - |
| 3817 | - protected synchronized TransportConnectionState unregisterConnectionState(ConnectionId connectionId) { |
| 3818 | - return connectionStateRegister.unregisterConnectionState(connectionId); |
| 3819 | - } |
| 3820 | - |
| 3821 | - protected synchronized List<TransportConnectionState> listConnectionStates() { |
| 3822 | - return connectionStateRegister.listConnectionStates(); |
| 3823 | - } |
| 3824 | - |
| 3825 | - protected synchronized TransportConnectionState lookupConnectionState(String connectionId) { |
| 3826 | - return connectionStateRegister.lookupConnectionState(connectionId); |
| 3827 | - } |
| 3828 | - |
| 3829 | - protected synchronized TransportConnectionState lookupConnectionState(ConsumerId id) { |
| 3830 | - return connectionStateRegister.lookupConnectionState(id); |
| 3831 | - } |
| 3832 | - |
| 3833 | - protected synchronized TransportConnectionState lookupConnectionState(ProducerId id) { |
| 3834 | - return connectionStateRegister.lookupConnectionState(id); |
| 3835 | - } |
| 3836 | - |
| 3837 | - protected synchronized TransportConnectionState lookupConnectionState(SessionId id) { |
| 3838 | - return connectionStateRegister.lookupConnectionState(id); |
| 3839 | - } |
| 3840 | - |
| 3841 | - protected synchronized TransportConnectionState lookupConnectionState(ConnectionId connectionId) { |
| 3842 | - return connectionStateRegister.lookupConnectionState(connectionId); |
| 3843 | - } |
| 3844 | - |
| 3845 | - protected synchronized void setDuplexNetworkConnectorId(String duplexNetworkConnectorId) { |
| 3846 | - this.duplexNetworkConnectorId = duplexNetworkConnectorId; |
| 3847 | - } |
| 3848 | - |
| 3849 | - protected synchronized String getDuplexNetworkConnectorId() { |
| 3850 | - return this.duplexNetworkConnectorId; |
| 3851 | - } |
| 3852 | - |
| 3853 | - protected CountDownLatch getStopped() { |
| 3854 | - return stopped; |
| 3855 | - } |
| 3856 | -} |
| 3857 | |
| 3858 | === removed directory '.pc/activemq-admin.patch' |
| 3859 | === removed directory '.pc/activemq-admin.patch/assembly' |
| 3860 | === removed directory '.pc/activemq-admin.patch/assembly/src' |
| 3861 | === removed directory '.pc/activemq-admin.patch/assembly/src/release' |
| 3862 | === removed directory '.pc/activemq-admin.patch/assembly/src/release/bin' |
| 3863 | === removed file '.pc/activemq-admin.patch/assembly/src/release/bin/activemq-admin' |
| 3864 | --- .pc/activemq-admin.patch/assembly/src/release/bin/activemq-admin 2012-04-01 20:26:10 +0000 |
| 3865 | +++ .pc/activemq-admin.patch/assembly/src/release/bin/activemq-admin 1970-01-01 00:00:00 +0000 |
| 3866 | @@ -1,155 +0,0 @@ |
| 3867 | -#!/bin/sh |
| 3868 | -# ------------------------------------------------------------------------ |
| 3869 | -# Licensed to the Apache Software Foundation (ASF) under one or more |
| 3870 | -# contributor license agreements. See the NOTICE file distributed with |
| 3871 | -# this work for additional information regarding copyright ownership. |
| 3872 | -# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 3873 | -# (the "License"); you may not use this file except in compliance with |
| 3874 | -# the License. You may obtain a copy of the License at |
| 3875 | -# |
| 3876 | -# http://www.apache.org/licenses/LICENSE-2.0 |
| 3877 | -# |
| 3878 | -# Unless required by applicable law or agreed to in writing, software |
| 3879 | -# distributed under the License is distributed on an "AS IS" BASIS, |
| 3880 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 3881 | -# See the License for the specific language governing permissions and |
| 3882 | -# limitations under the License. |
| 3883 | -# ------------------------------------------------------------------------ |
| 3884 | - |
| 3885 | -# load system-wide activemq configuration |
| 3886 | -if [ -f "/etc/activemq.conf" ] ; then |
| 3887 | - . /etc/activemq.conf |
| 3888 | -fi |
| 3889 | - |
| 3890 | -# provide default values for people who don't use RPMs |
| 3891 | -if [ -z "$usejikes" ] ; then |
| 3892 | - usejikes=false; |
| 3893 | -fi |
| 3894 | - |
| 3895 | -# load user activemq configuration |
| 3896 | -if [ -f "$HOME/.activemqrc" ] ; then |
| 3897 | - . "$HOME/.activemqrc" |
| 3898 | -fi |
| 3899 | - |
| 3900 | -# OS specific support. $var _must_ be set to either true or false. |
| 3901 | -cygwin=false; |
| 3902 | -darwin=false; |
| 3903 | -case "`uname`" in |
| 3904 | - CYGWIN*) cygwin=true ;; |
| 3905 | - Darwin*) darwin=true |
| 3906 | - if [ -z "$JAVA_HOME" ] ; then |
| 3907 | - JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home |
| 3908 | - fi |
| 3909 | - ;; |
| 3910 | -esac |
| 3911 | - |
| 3912 | -if [ -z "$ACTIVEMQ_HOME" ] ; then |
| 3913 | - # try to find ACTIVEMQ |
| 3914 | - if [ -d /opt/activemq ] ; then |
| 3915 | - ACTIVEMQ_HOME=/opt/activemq |
| 3916 | - fi |
| 3917 | - |
| 3918 | - if [ -d "${HOME}/opt/activemq" ] ; then |
| 3919 | - ACTIVEMQ_HOME="${HOME}/opt/activemq" |
| 3920 | - fi |
| 3921 | - |
| 3922 | - ## resolve links - $0 may be a link to activemq's home |
| 3923 | - PRG="$0" |
| 3924 | - progname=`basename "$0"` |
| 3925 | - saveddir=`pwd` |
| 3926 | - |
| 3927 | - # need this for relative symlinks |
| 3928 | - dirname_prg=`dirname "$PRG"` |
| 3929 | - cd "$dirname_prg" |
| 3930 | - |
| 3931 | - while [ -h "$PRG" ] ; do |
| 3932 | - ls=`ls -ld "$PRG"` |
| 3933 | - link=`expr "$ls" : '.*-> \(.*\)$'` |
| 3934 | - if expr "$link" : '.*/.*' > /dev/null; then |
| 3935 | - PRG="$link" |
| 3936 | - else |
| 3937 | - PRG=`dirname "$PRG"`"/$link" |
| 3938 | - fi |
| 3939 | - done |
| 3940 | - |
| 3941 | - ACTIVEMQ_HOME=`dirname "$PRG"`/.. |
| 3942 | - |
| 3943 | - cd "$saveddir" |
| 3944 | - |
| 3945 | - # make it fully qualified |
| 3946 | - ACTIVEMQ_HOME=`cd "$ACTIVEMQ_HOME" && pwd` |
| 3947 | -fi |
| 3948 | - |
| 3949 | -# For Cygwin, ensure paths are in UNIX format before anything is touched |
| 3950 | -if $cygwin ; then |
| 3951 | - [ -n "$ACTIVEMQ_HOME" ] && |
| 3952 | - ACTIVEMQ_HOME=`cygpath --unix "$ACTIVEMQ_HOME"` |
| 3953 | - [ -n "$JAVA_HOME" ] && |
| 3954 | - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` |
| 3955 | - [ -n "$CLASSPATH" ] && |
| 3956 | - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` |
| 3957 | -fi |
| 3958 | - |
| 3959 | -if [ -z "$JAVACMD" ] ; then |
| 3960 | - if [ -n "$JAVA_HOME" ] ; then |
| 3961 | - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
| 3962 | - # IBM's JDK on AIX uses strange locations for the executables |
| 3963 | - JAVACMD="$JAVA_HOME/jre/sh/java" |
| 3964 | - else |
| 3965 | - JAVACMD="$JAVA_HOME/bin/java" |
| 3966 | - fi |
| 3967 | - else |
| 3968 | - JAVACMD=`which java 2> /dev/null ` |
| 3969 | - if [ -z "$JAVACMD" ] ; then |
| 3970 | - JAVACMD=java |
| 3971 | - fi |
| 3972 | - fi |
| 3973 | -fi |
| 3974 | - |
| 3975 | -if [ ! -x "$JAVACMD" ] ; then |
| 3976 | - echo "Error: JAVA_HOME is not defined correctly." |
| 3977 | - echo " We cannot execute $JAVACMD" |
| 3978 | - exit 1 |
| 3979 | -fi |
| 3980 | - |
| 3981 | -if [ -z "$ACTIVEMQ_BASE" ] ; then |
| 3982 | - ACTIVEMQ_BASE="$ACTIVEMQ_HOME" |
| 3983 | -fi |
| 3984 | - |
| 3985 | -# For Cygwin, switch paths to Windows format before running java |
| 3986 | -if $cygwin; then |
| 3987 | - ACTIVEMQ_HOME=`cygpath --windows "$ACTIVEMQ_HOME"` |
| 3988 | - ACTIVEMQ_BASE=`cygpath --windows "$ACTIVEMQ_BASE"` |
| 3989 | - ACTIVEMQ_CLASSPATH=`cygpath --path --windows "$ACTIVEMQ_CLASSPATH"` |
| 3990 | - JAVA_HOME=`cygpath --windows "$JAVA_HOME"` |
| 3991 | - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` |
| 3992 | - CYGHOME=`cygpath --windows "$HOME"` |
| 3993 | -fi |
| 3994 | - |
| 3995 | -# Set default classpath |
| 3996 | -ACTIVEMQ_CLASSPATH="${ACTIVEMQ_BASE}/conf;"$ACTIVEMQ_CLASSPATH |
| 3997 | - |
| 3998 | -if [ $1 = "start" ] ; then |
| 3999 | - if [ -z "$ACTIVEMQ_OPTS" ] ; then |
| 4000 | - ACTIVEMQ_OPTS="-Xmx512M -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties" |
| 4001 | - fi |
| 4002 | - |
| 4003 | - if [ -z "$SUNJMX" ] ; then |
| 4004 | - #SUNJMX="-Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" |
| 4005 | - SUNJMX="-Dcom.sun.management.jmxremote" |
| 4006 | - fi |
| 4007 | - |
| 4008 | - ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $SUNJMX $SSL_OPTS" |
| 4009 | -fi |
| 4010 | - |
| 4011 | -# Uncomment to enable YourKit profiling |
| 4012 | -#ACTIVEMQ_DEBUG_OPTS="-agentlib:yjpagent" |
| 4013 | - |
| 4014 | -# Uncomment to enable remote debugging |
| 4015 | -#ACTIVEMQ_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" |
| 4016 | - |
| 4017 | -if [ -n "$CYGHOME" ]; then |
| 4018 | - exec "$JAVACMD" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS -Dactivemq.classpath="${ACTIVEMQ_CLASSPATH}" -Dactivemq.home="${ACTIVEMQ_HOME}" -Dactivemq.base="${ACTIVEMQ_BASE}" -Dcygwin.user.home="$CYGHOME" -jar "${ACTIVEMQ_HOME}/bin/run.jar" $@ |
| 4019 | -else |
| 4020 | - exec "$JAVACMD" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS -Dactivemq.classpath="${ACTIVEMQ_CLASSPATH}" -Dactivemq.home="${ACTIVEMQ_HOME}" -Dactivemq.base="${ACTIVEMQ_BASE}" -jar "${ACTIVEMQ_HOME}/bin/run.jar" $@ |
| 4021 | -fi |
| 4022 | |
| 4023 | === removed file '.pc/applied-patches' |
| 4024 | --- .pc/applied-patches 2012-04-01 20:26:10 +0000 |
| 4025 | +++ .pc/applied-patches 1970-01-01 00:00:00 +0000 |
| 4026 | @@ -1,8 +0,0 @@ |
| 4027 | -drop_derby_use.diff |
| 4028 | -disable_some_modules.diff |
| 4029 | -exclude_geronimo_jca.diff |
| 4030 | -exclude_spring_osgi.diff |
| 4031 | -javadoc_links.diff |
| 4032 | -init_debian_default_values.diff |
| 4033 | -CVE-2011-4605.diff |
| 4034 | -activemq-admin.patch |
| 4035 | |
| 4036 | === removed directory '.pc/disable_some_modules.diff' |
| 4037 | === removed file '.pc/disable_some_modules.diff/pom.xml' |
| 4038 | --- .pc/disable_some_modules.diff/pom.xml 2011-06-21 00:32:12 +0000 |
| 4039 | +++ .pc/disable_some_modules.diff/pom.xml 1970-01-01 00:00:00 +0000 |
| 4040 | @@ -1,1320 +0,0 @@ |
| 4041 | -<?xml version="1.0" encoding="UTF-8"?> |
| 4042 | -<!-- |
| 4043 | - Licensed to the Apache Software Foundation (ASF) under one or more |
| 4044 | - contributor license agreements. See the NOTICE file distributed with |
| 4045 | - this work for additional information regarding copyright ownership. |
| 4046 | - The ASF licenses this file to You under the Apache License, Version 2.0 |
| 4047 | - (the "License"); you may not use this file except in compliance with |
| 4048 | - the License. You may obtain a copy of the License at |
| 4049 | - |
| 4050 | - http://www.apache.org/licenses/LICENSE-2.0 |
| 4051 | - |
| 4052 | - Unless required by applicable law or agreed to in writing, software |
| 4053 | - distributed under the License is distributed on an "AS IS" BASIS, |
| 4054 | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 4055 | - See the License for the specific language governing permissions and |
| 4056 | - limitations under the License. |
| 4057 | ---> |
| 4058 | -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
| 4059 | - <parent> |
| 4060 | - <groupId>org.apache</groupId> |
| 4061 | - <artifactId>apache</artifactId> |
| 4062 | - <version>7</version> |
| 4063 | - </parent> |
| 4064 | - <modelVersion>4.0.0</modelVersion> |
| 4065 | - |
| 4066 | - <groupId>org.apache.activemq</groupId> |
| 4067 | - <artifactId>activemq-parent</artifactId> |
| 4068 | - <version>5.5.0</version> |
| 4069 | - <packaging>pom</packaging> |
| 4070 | - <name>ActiveMQ</name> |
| 4071 | - <inceptionYear>2005</inceptionYear> |
| 4072 | - |
| 4073 | - <properties> |
| 4074 | - <activemq-version>5.5.0</activemq-version> |
| 4075 | - <siteId>activemq-${activemq-version}</siteId> |
| 4076 | - <projectName>Apache ActiveMQ</projectName> |
| 4077 | - <!-- base url for site deployment. See distribution management for full url. Override this in settings.xml for staging --> |
| 4078 | - <staging.siteURL>scp://people.apache.org/x1/www/activemq.apache.org</staging.siteURL> |
| 4079 | - <spring-version>3.0.3.RELEASE</spring-version> |
| 4080 | - <spring-osgi-version>1.2.1</spring-osgi-version> |
| 4081 | - <activesoap-version>1.3</activesoap-version> |
| 4082 | - <annogen-version>0.1.0</annogen-version> |
| 4083 | - <ant-version>1.7.1</ant-version> |
| 4084 | - <aopalliance-version>1.0</aopalliance-version> |
| 4085 | - <aries-version>0.2-incubating</aries-version> |
| 4086 | - <axion-version>1.0-M3-dev</axion-version> |
| 4087 | - <axis-version>1.2-RC1</axis-version> |
| 4088 | - <camel-version>2.7.0</camel-version> |
| 4089 | - <cglib-version>2.0</cglib-version> |
| 4090 | - <commons-beanutils-version>1.6.1</commons-beanutils-version> |
| 4091 | - <commons-collections-version>3.2.1</commons-collections-version> |
| 4092 | - <openjpa-version>1.2.0</openjpa-version> |
| 4093 | - <commons-dbcp-version>1.2.2</commons-dbcp-version> |
| 4094 | - <commons-httpclient-version>3.1</commons-httpclient-version> |
| 4095 | - <commons-io-version>1.4</commons-io-version> |
| 4096 | - <commons-lang-version>2.4</commons-lang-version> |
| 4097 | - <commons-logging-version>1.1</commons-logging-version> |
| 4098 | - <commons-pool-version>1.5.4</commons-pool-version> |
| 4099 | - <commons-primitives-version>1.0</commons-primitives-version> |
| 4100 | - <directory-version>1.5.5</directory-version> |
| 4101 | - <geronimo-version>1.0</geronimo-version> |
| 4102 | - <howl-version>0.1.8</howl-version> |
| 4103 | - <hsqldb-version>1.7.2.2</hsqldb-version> |
| 4104 | - <jasypt-version>1.7</jasypt-version> |
| 4105 | - <jdom-version>1.0</jdom-version> |
| 4106 | - <jetty-version>7.1.6.v20100715</jetty-version> |
| 4107 | - <jsp-version>2.1.v20100127</jsp-version> |
| 4108 | - <jettison-version>1.2</jettison-version> |
| 4109 | - <jmock-version>2.5.1</jmock-version> |
| 4110 | - <junit-version>4.5</junit-version> |
| 4111 | - <jxta-version>2.0</jxta-version> |
| 4112 | - <karaf-version>2.2.0</karaf-version> |
| 4113 | - <log4j-version>1.2.14</log4j-version> |
| 4114 | - <org-apache-derby-version>10.1.3.1</org-apache-derby-version> |
| 4115 | - <p2psockets-version>1.1.2</p2psockets-version> |
| 4116 | - <regexp-version>1.3</regexp-version> |
| 4117 | - <rome-version>0.8</rome-version> |
| 4118 | - <!-- pax-logging (osgi) dont support slf4j 1.6.x --> |
| 4119 | - <slf4j-version>1.5.11</slf4j-version> |
| 4120 | - <spring-oxm-version>1.5.8</spring-oxm-version> |
| 4121 | - <stax-api-version>1.0.1</stax-api-version> |
| 4122 | - <stax-version>1.2.0</stax-version> |
| 4123 | - <xalan-version>2.6.0</xalan-version> |
| 4124 | - <xmlbeans-version>2.0.0-beta1</xmlbeans-version> |
| 4125 | - <xpp3-version>1.1.4c</xpp3-version> |
| 4126 | - <xstream-version>1.3.1</xstream-version> |
| 4127 | - <xbean-version>3.7</xbean-version> |
| 4128 | - <velocity-version>1.6.2</velocity-version> |
| 4129 | - <maven-bundle-plugin-version>2.1.0</maven-bundle-plugin-version> |
| 4130 | - <maven-surefire-plugin-version>2.5</maven-surefire-plugin-version> |
| 4131 | - <commons-net-version>2.0</commons-net-version> |
| 4132 | - <ftpserver-version>1.0.0</ftpserver-version> |
| 4133 | - <activemq-protobuf-version>1.1</activemq-protobuf-version> |
| 4134 | - <site-repo-url>scpexe://people.apache.org/www/activemq.apache.org/maven/</site-repo-url> |
| 4135 | - <!-- OSGi bundles properties --> |
| 4136 | - <activemq.osgi.import.pkg>*</activemq.osgi.import.pkg> |
| 4137 | - <activemq.osgi.export.pkg>org.apache.activemq*</activemq.osgi.export.pkg> |
| 4138 | - <activemq.osgi.private.pkg>!*</activemq.osgi.private.pkg> |
| 4139 | - <activemq.osgi.export>${activemq.osgi.export.pkg}*;version=${activemq.osgi.export.version};-noimport:=true</activemq.osgi.export> |
| 4140 | - <activemq.osgi.export.version>${project.version}</activemq.osgi.export.version> |
| 4141 | - <activemq.osgi.import>${activemq.osgi.import.pkg}</activemq.osgi.import> |
| 4142 | - <activemq.osgi.dynamic.import /> |
| 4143 | - <activemq.osgi.symbolic.name>${project.groupId}.${project.artifactId}</activemq.osgi.symbolic.name> |
| 4144 | -<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 4145 | - </properties> |
| 4146 | - <prerequisites> |
| 4147 | - <maven>2.0.9</maven> |
| 4148 | - </prerequisites> |
| 4149 | - |
| 4150 | - <url>http://activemq.apache.org</url> |
| 4151 | - |
| 4152 | - <mailingLists> |
| 4153 | - <mailingList> |
| 4154 | - <name>Development List</name> |
| 4155 | - <subscribe>dev-subscribe@activemq.apache.org</subscribe> |
| 4156 | - <unsubscribe>dev-unsubscribe@activemq.apache.org</unsubscribe> |
| 4157 | - <post>dev@activemq.apache.org</post> |
| 4158 | - </mailingList> |
| 4159 | - </mailingLists> |
| 4160 | - |
| 4161 | - <distributionManagement> |
| 4162 | - <site> |
| 4163 | - <!-- this needs to match a server in your settings.xml with upload settings --> |
| 4164 | - <id>activemq-website</id> |
| 4165 | - <!-- set the staging.siteURL in your ~/.m2/settings.xml in a release or other profile --> |
| 4166 | - <url>${staging.siteURL}/maven/${activemq-version}</url> |
| 4167 | - <!--<url>${site-repo-url}</url>--> |
| 4168 | - </site> |
| 4169 | - <snapshotRepository> |
| 4170 | - <id>apache.snapshots.https</id> |
| 4171 | - <name>Apache Development Snapshot Repository</name> |
| 4172 | - <url>https://repository.apache.org/content/repositories/snapshots</url> |
| 4173 | - <uniqueVersion>false</uniqueVersion> |
| 4174 | - </snapshotRepository> |
| 4175 | - </distributionManagement> |
| 4176 | - |
| 4177 | - <modules> |
| 4178 | - <module>activemq-all</module> |
| 4179 | - <module>activemq-camel</module> |
| 4180 | - <module>activemq-console</module> |
| 4181 | - <module>activemq-core</module> |
| 4182 | - <module>activemq-fileserver</module> |
| 4183 | - <module>activemq-jaas</module> |
| 4184 | - <module>activemq-blueprint</module> |
| 4185 | - <module>activemq-karaf</module> |
| 4186 | - <module>activemq-openwire-generator</module> |
| 4187 | - <module>activemq-optional</module> |
| 4188 | - <module>activemq-pool</module> |
| 4189 | - <module>activemq-ra</module> |
| 4190 | - <module>activemq-rar</module> |
| 4191 | - <module>activemq-run</module> |
| 4192 | - <module>activemq-spring</module> |
| 4193 | - <module>activemq-tooling</module> |
| 4194 | - <module>activemq-web</module> |
| 4195 | - <module>activemq-web-demo</module> |
| 4196 | - <module>activemq-web-console</module> |
| 4197 | - <module>activemq-xmpp</module> |
| 4198 | - <module>assembly</module> |
| 4199 | - <module>activemq-jmdns_1.0</module> |
| 4200 | - <module>kahadb</module> |
| 4201 | - </modules> |
| 4202 | - |
| 4203 | - <scm> |
| 4204 | - <connection>scm:svn:https://svn.apache.org/repos/asf/activemq/tags/activemq-5.5.0</connection> |
| 4205 | - <developerConnection>scm:svn:https://svn.apache.org/repos/asf/activemq/tags/activemq-5.5.0</developerConnection> |
| 4206 | - <url>http://svn.apache.org/viewvc/activemq/tags/activemq-5.5.0</url> |
| 4207 | - </scm> |
| 4208 | - |
| 4209 | - <repositories> |
| 4210 | - <repository> |
| 4211 | - <id>com.springsource.repository.bundles.external</id> |
| 4212 | - <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name> |
| 4213 | - <url>http://repository.springsource.com/maven/bundles/external</url> |
| 4214 | - </repository> |
| 4215 | - <repository> |
| 4216 | - <id>apache.snapshots</id> |
| 4217 | - <url>https://repository.apache.org/content/repositories/snapshots/</url> |
| 4218 | - <releases> |
| 4219 | - <enabled>false</enabled> |
| 4220 | - </releases> |
| 4221 | - </repository> |
| 4222 | - </repositories> |
| 4223 | - |
| 4224 | - <!-- This is only here since the activemq-protobuf plugin has not been released yet --> |
| 4225 | - <pluginRepositories> |
| 4226 | - <pluginRepository> |
| 4227 | - <id>apache.snapshots</id> |
| 4228 | - <url>https://repository.apache.org/content/repositories/snapshots/</url> |
| 4229 | - </pluginRepository> |
| 4230 | - </pluginRepositories> |
| 4231 | - |
| 4232 | - <dependencyManagement> |
| 4233 | - <dependencies> |
| 4234 | - <!-- =============================== --> |
| 4235 | - <!-- Internal ActiveMQ Dependencies --> |
| 4236 | - <!-- =============================== --> |
| 4237 | - <dependency> |
| 4238 | - <groupId>org.apache.activemq</groupId> |
| 4239 | - <artifactId>activemq-all</artifactId> |
| 4240 | - <version>${activemq-version}</version> |
| 4241 | - </dependency> |
| 4242 | - <dependency> |
| 4243 | - <groupId>org.apache.activemq</groupId> |
| 4244 | - <artifactId>activemq-camel</artifactId> |
| 4245 | - <version>${activemq-version}</version> |
| 4246 | - </dependency> |
| 4247 | - <dependency> |
| 4248 | - <groupId>org.apache.activemq</groupId> |
| 4249 | - <artifactId>activemq-core</artifactId> |
| 4250 | - <version>${activemq-version}</version> |
| 4251 | - </dependency> |
| 4252 | - <dependency> |
| 4253 | - <groupId>org.apache.activemq</groupId> |
| 4254 | - <artifactId>activemq-core</artifactId> |
| 4255 | - <version>${activemq-version}</version> |
| 4256 | - <type>test-jar</type> |
| 4257 | - <scope>test</scope> |
| 4258 | - </dependency> |
| 4259 | - <dependency> |
| 4260 | - <groupId>org.apache.activemq</groupId> |
| 4261 | - <artifactId>activemq-jaas</artifactId> |
| 4262 | - <version>${activemq-version}</version> |
| 4263 | - </dependency> |
| 4264 | - <dependency> |
| 4265 | - <groupId>org.apache.activemq</groupId> |
| 4266 | - <artifactId>activemq-jmdns_1.0</artifactId> |
| 4267 | - <version>${activemq-version}</version> |
| 4268 | - </dependency> |
| 4269 | - <dependency> |
| 4270 | - <groupId>org.apache.activemq</groupId> |
| 4271 | - <artifactId>activemq-pool</artifactId> |
| 4272 | - <version>${activemq-version}</version> |
| 4273 | - </dependency> |
| 4274 | - <dependency> |
| 4275 | - <groupId>org.apache.activemq</groupId> |
| 4276 | - <artifactId>activemq-spring</artifactId> |
| 4277 | - <version>${activemq-version}</version> |
| 4278 | - </dependency> |
| 4279 | - <dependency> |
| 4280 | - <groupId>org.apache.activemq</groupId> |
| 4281 | - <artifactId>activemq-web</artifactId> |
| 4282 | - <version>${activemq-version}</version> |
| 4283 | - </dependency> |
| 4284 | - <dependency> |
| 4285 | - <groupId>org.apache.activemq</groupId> |
| 4286 | - <artifactId>activemq-xmpp</artifactId> |
| 4287 | - <version>${activemq-version}</version> |
| 4288 | - </dependency> |
| 4289 | - <dependency> |
| 4290 | - <groupId>org.apache.activemq</groupId> |
| 4291 | - <artifactId>activemq-web-demo</artifactId> |
| 4292 | - <version>${activemq-version}</version> |
| 4293 | - <type>war</type> |
| 4294 | - </dependency> |
| 4295 | - <dependency> |
| 4296 | - <groupId>org.apache.activemq</groupId> |
| 4297 | - <artifactId>activemq-web-console</artifactId> |
| 4298 | - <version>${activemq-version}</version> |
| 4299 | - <type>war</type> |
| 4300 | - </dependency> |
| 4301 | - <dependency> |
| 4302 | - <groupId>org.apache.activemq</groupId> |
| 4303 | - <artifactId>activemq-console</artifactId> |
| 4304 | - <version>${activemq-version}</version> |
| 4305 | - </dependency> |
| 4306 | - <dependency> |
| 4307 | - <groupId>org.apache.activemq</groupId> |
| 4308 | - <artifactId>activemq-fileserver</artifactId> |
| 4309 | - <version>${activemq-version}</version> |
| 4310 | - <type>war</type> |
| 4311 | - </dependency> |
| 4312 | - <dependency> |
| 4313 | - <groupId>org.apache.activemq</groupId> |
| 4314 | - <artifactId>activemq-optional</artifactId> |
| 4315 | - <version>${activemq-version}</version> |
| 4316 | - </dependency> |
| 4317 | - <dependency> |
| 4318 | - <groupId>org.apache.activemq</groupId> |
| 4319 | - <artifactId>activemq-ra</artifactId> |
| 4320 | - <version>${activemq-version}</version> |
| 4321 | - </dependency> |
| 4322 | - <dependency> |
| 4323 | - <groupId>org.apache.activemq</groupId> |
| 4324 | - <artifactId>activemq-rar</artifactId> |
| 4325 | - <version>${activemq-version}</version> |
| 4326 | - <type>rar</type> |
| 4327 | - </dependency> |
| 4328 | - <dependency> |
| 4329 | - <groupId>org.apache.activemq</groupId> |
| 4330 | - <artifactId>activemq-run</artifactId> |
| 4331 | - <version>${activemq-version}</version> |
| 4332 | - </dependency> |
| 4333 | - <dependency> |
| 4334 | - <groupId>org.apache.activemq</groupId> |
| 4335 | - <artifactId>activemq-web</artifactId> |
| 4336 | - <version>${activemq-version}</version> |
| 4337 | - <type>war</type> |
| 4338 | - </dependency> |
| 4339 | - <dependency> |
| 4340 | - <groupId>org.apache.activemq</groupId> |
| 4341 | - <artifactId>activeio-core</artifactId> |
| 4342 | - <version>3.1.2</version> |
| 4343 | - </dependency> |
| 4344 | - <dependency> |
| 4345 | - <groupId>org.apache.activemq</groupId> |
| 4346 | - <artifactId>activeio-core</artifactId> |
| 4347 | - <version>3.1.2</version> |
| 4348 | - <type>test-jar</type> |
| 4349 | - <scope>test</scope> |
| 4350 | - </dependency> |
| 4351 | - <dependency> |
| 4352 | - <groupId>org.apache.activemq</groupId> |
| 4353 | - <artifactId>activemq-openwire-generator</artifactId> |
| 4354 | - <version>${activemq-version}</version> |
| 4355 | - </dependency> |
| 4356 | - <dependency> |
| 4357 | - <groupId>org.apache.activemq</groupId> |
| 4358 | - <artifactId>kahadb</artifactId> |
| 4359 | - <version>${activemq-version}</version> |
| 4360 | - </dependency> |
| 4361 | - <dependency> |
| 4362 | - <groupId>org.apache.activemq</groupId> |
| 4363 | - <artifactId>activemq-karaf</artifactId> |
| 4364 | - <version>${activemq-version}</version> |
| 4365 | - </dependency> |
| 4366 | - <dependency> |
| 4367 | - <groupId>org.apache.activemq.protobuf</groupId> |
| 4368 | - <artifactId>activemq-protobuf</artifactId> |
| 4369 | - <version>${activemq-protobuf-version}</version> |
| 4370 | - </dependency> |
| 4371 | - |
| 4372 | - <!-- =============================== --> |
| 4373 | - <!-- Required dependencies --> |
| 4374 | - <!-- =============================== --> |
| 4375 | - <dependency> |
| 4376 | - <groupId>commons-logging</groupId> |
| 4377 | - <artifactId>commons-logging</artifactId> |
| 4378 | - <version>${commons-logging-version}</version> |
| 4379 | - <exclusions> |
| 4380 | - <exclusion> |
| 4381 | - <groupId>avalon-framework</groupId> |
| 4382 | - <artifactId>avalon-framework</artifactId> |
| 4383 | - </exclusion> |
| 4384 | - <exclusion> |
| 4385 | - <groupId>logkit</groupId> |
| 4386 | - <artifactId>logkit</artifactId> |
| 4387 | - </exclusion> |
| 4388 | - <exclusion> |
| 4389 | - <groupId>log4j</groupId> |
| 4390 | - <artifactId>log4j</artifactId> |
| 4391 | - </exclusion> |
| 4392 | - <exclusion> |
| 4393 | - <groupId>javax.servlet</groupId> |
| 4394 | - <artifactId>servlet-api</artifactId> |
| 4395 | - </exclusion> |
| 4396 | - </exclusions> |
| 4397 | - </dependency> |
| 4398 | - |
| 4399 | - <dependency> |
| 4400 | - <groupId>org.apache.geronimo.specs</groupId> |
| 4401 | - <artifactId>geronimo-jms_1.1_spec</artifactId> |
| 4402 | - <version>1.1.1</version> |
| 4403 | - </dependency> |
| 4404 | - |
| 4405 | - <dependency> |
| 4406 | - <groupId>org.apache.geronimo.specs</groupId> |
| 4407 | - <artifactId>geronimo-jta_1.0.1B_spec</artifactId> |
| 4408 | - <version>1.0.1</version> |
| 4409 | - </dependency> |
| 4410 | - |
| 4411 | - <dependency> |
| 4412 | - <groupId>org.apache.geronimo.specs</groupId> |
| 4413 | - <artifactId>geronimo-j2ee-management_1.1_spec</artifactId> |
| 4414 | - <version>1.0.1</version> |
| 4415 | - </dependency> |
| 4416 | - |
| 4417 | - <dependency> |
| 4418 | - <groupId>org.apache.geronimo.specs</groupId> |
| 4419 | - <artifactId>geronimo-jacc_1.1_spec</artifactId> |
| 4420 | - <version>1.0.1</version> |
| 4421 | - </dependency> |
| 4422 | - |
| 4423 | - <dependency> |
| 4424 | - <groupId>org.apache.geronimo.specs</groupId> |
| 4425 | - <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId> |
| 4426 | - <version>2.0.0</version> |
| 4427 | - </dependency> |
| 4428 | - |
| 4429 | - <dependency> |
| 4430 | - <groupId>org.apache.geronimo.specs</groupId> |
| 4431 | - <artifactId>geronimo-jsp_2.1_spec</artifactId> |
| 4432 | - <version>1.0.1</version> |
| 4433 | - </dependency> |
| 4434 | - |
| 4435 | - <dependency> |
| 4436 | - <groupId>org.apache.geronimo.specs</groupId> |
| 4437 | - <artifactId>geronimo-servlet_2.5_spec</artifactId> |
| 4438 | - <version>1.2</version> |
| 4439 | - </dependency> |
| 4440 | - |
| 4441 | - <dependency> |
| 4442 | - <groupId>org.apache.geronimo.specs</groupId> |
| 4443 | - <artifactId>geronimo-annotation_1.0_spec</artifactId> |
| 4444 | - <version>1.1.1</version> |
| 4445 | - </dependency> |
| 4446 | - |
| 4447 | - |
| 4448 | - <!-- =============================== --> |
| 4449 | - <!-- Optional dependencies --> |
| 4450 | - <!-- =============================== --> |
| 4451 | - |
| 4452 | - <dependency> |
| 4453 | - <groupId>org.apache.camel</groupId> |
| 4454 | - <artifactId>camel-core</artifactId> |
| 4455 | - <version>${camel-version}</version> |
| 4456 | - </dependency> |
| 4457 | - <dependency> |
| 4458 | - <groupId>org.apache.camel</groupId> |
| 4459 | - <artifactId>camel-spring</artifactId> |
| 4460 | - <version>${camel-version}</version> |
| 4461 | - </dependency> |
| 4462 | - <dependency> |
| 4463 | - <groupId>org.apache.camel</groupId> |
| 4464 | - <artifactId>camel-jetty</artifactId> |
| 4465 | - <version>${camel-version}</version> |
| 4466 | - </dependency> |
| 4467 | - <dependency> |
| 4468 | - <groupId>org.apache.camel</groupId> |
| 4469 | - <artifactId>camel-jms</artifactId> |
| 4470 | - <version>${camel-version}</version> |
| 4471 | - </dependency> |
| 4472 | - <dependency> |
| 4473 | - <groupId>org.apache.camel</groupId> |
| 4474 | - <artifactId>camel-web</artifactId> |
| 4475 | - <version>2.4.0</version> |
| 4476 | - <type>war</type> |
| 4477 | - </dependency> |
| 4478 | - |
| 4479 | - <dependency> |
| 4480 | - <groupId>org.osgi</groupId> |
| 4481 | - <artifactId>org.osgi.core</artifactId> |
| 4482 | - <version>4.1.0</version> |
| 4483 | - </dependency> |
| 4484 | - |
| 4485 | - <dependency> |
| 4486 | - <groupId>org.apache.hadoop.zookeeper</groupId> |
| 4487 | - <artifactId>zookeeper</artifactId> |
| 4488 | - <version>3.0.0</version> |
| 4489 | - <optional>true</optional> |
| 4490 | - </dependency> |
| 4491 | - |
| 4492 | - <!-- For jsvc support --> |
| 4493 | - <dependency> |
| 4494 | - <groupId>commons-daemon</groupId> |
| 4495 | - <artifactId>commons-daemon</artifactId> |
| 4496 | - <version>1.0.3</version> |
| 4497 | - </dependency> |
| 4498 | - |
| 4499 | - <!-- for the XML parsing --> |
| 4500 | - <dependency> |
| 4501 | - <groupId>javax.xml.bind</groupId> |
| 4502 | - <artifactId>jaxb-api</artifactId> |
| 4503 | - <version>2.1</version> |
| 4504 | - <exclusions> |
| 4505 | - <exclusion> |
| 4506 | - <groupId>javax.xml</groupId> |
| 4507 | - <artifactId>jsr173</artifactId> |
| 4508 | - </exclusion> |
| 4509 | - </exclusions> |
| 4510 | - </dependency> |
| 4511 | - <dependency> |
| 4512 | - <groupId>com.sun.xml.bind</groupId> |
| 4513 | - <artifactId>jaxb-impl</artifactId> |
| 4514 | - <version>2.1.6</version> |
| 4515 | - <exclusions> |
| 4516 | - <exclusion> |
| 4517 | - <groupId>javax.jws</groupId> |
| 4518 | - <artifactId>jsr181-api</artifactId> |
| 4519 | - </exclusion> |
| 4520 | - </exclusions> |
| 4521 | - </dependency> |
| 4522 | - |
| 4523 | - <!-- camel testing --> |
| 4524 | - <dependency> |
| 4525 | - <groupId>org.apache.camel</groupId> |
| 4526 | - <artifactId>camel-core</artifactId> |
| 4527 | - <version>${camel-version}</version> |
| 4528 | - <type>test-jar</type> |
| 4529 | - <scope>test</scope> |
| 4530 | - </dependency> |
| 4531 | - <dependency> |
| 4532 | - <groupId>org.apache.camel</groupId> |
| 4533 | - <artifactId>camel-spring</artifactId> |
| 4534 | - <version>${camel-version}</version> |
| 4535 | - <type>test-jar</type> |
| 4536 | - <scope>test</scope> |
| 4537 | - </dependency> |
| 4538 | - |
| 4539 | - |
| 4540 | - <!-- for custom XML parsing --> |
| 4541 | - <dependency> |
| 4542 | - <groupId>org.apache.xbean</groupId> |
| 4543 | - <artifactId>xbean-spring</artifactId> |
| 4544 | - <version>${xbean-version}</version> |
| 4545 | - <optional>true</optional> |
| 4546 | - <exclusions> |
| 4547 | - <exclusion> |
| 4548 | - <groupId>qdox</groupId> |
| 4549 | - <artifactId>qdox</artifactId> |
| 4550 | - </exclusion> |
| 4551 | - </exclusions> |
| 4552 | - |
| 4553 | - </dependency> |
| 4554 | - |
| 4555 | - <!-- Used to configure the activemq logs --> |
| 4556 | - <dependency> |
| 4557 | - <groupId>log4j</groupId> |
| 4558 | - <artifactId>log4j</artifactId> |
| 4559 | - <version>${log4j-version}</version> |
| 4560 | - <scope>runtime</scope> |
| 4561 | - </dependency> |
| 4562 | - |
| 4563 | - <!-- used to support optional transport configuration via URI query strings --> |
| 4564 | - |
| 4565 | - <dependency> |
| 4566 | - <groupId>commons-beanutils</groupId> |
| 4567 | - <artifactId>commons-beanutils</artifactId> |
| 4568 | - <version>${commons-beanutils-version}</version> |
| 4569 | - </dependency> |
| 4570 | - |
| 4571 | - <dependency> |
| 4572 | - <groupId>commons-collections</groupId> |
| 4573 | - <artifactId>commons-collections</artifactId> |
| 4574 | - <version>${commons-collections-version}</version> |
| 4575 | - </dependency> |
| 4576 | - |
| 4577 | - <dependency> |
| 4578 | - <groupId>org.apache.openjpa</groupId> |
| 4579 | - <artifactId>openjpa-persistence-jdbc</artifactId> |
| 4580 | - <version>${openjpa-version}</version> |
| 4581 | - </dependency> |
| 4582 | - |
| 4583 | - <!-- Optional Spring Support --> |
| 4584 | - <dependency> |
| 4585 | - <groupId>org.springframework</groupId> |
| 4586 | - <artifactId>spring-aop</artifactId> |
| 4587 | - <version>${spring-version}</version> |
| 4588 | - <optional>true</optional> |
| 4589 | - </dependency> |
| 4590 | - <dependency> |
| 4591 | - <groupId>org.springframework</groupId> |
| 4592 | - <artifactId>spring-beans</artifactId> |
| 4593 | - <version>${spring-version}</version> |
| 4594 | - <optional>true</optional> |
| 4595 | - </dependency> |
| 4596 | - <dependency> |
| 4597 | - <groupId>org.springframework</groupId> |
| 4598 | - <artifactId>spring-context</artifactId> |
| 4599 | - <version>${spring-version}</version> |
| 4600 | - <optional>true</optional> |
| 4601 | - </dependency> |
| 4602 | - <dependency> |
| 4603 | - <groupId>org.springframework</groupId> |
| 4604 | - <artifactId>spring-core</artifactId> |
| 4605 | - <version>${spring-version}</version> |
| 4606 | - <optional>true</optional> |
| 4607 | - </dependency> |
| 4608 | - <dependency> |
| 4609 | - <groupId>org.springframework</groupId> |
| 4610 | - <artifactId>spring-jms</artifactId> |
| 4611 | - <version>${spring-version}</version> |
| 4612 | - <optional>true</optional> |
| 4613 | - </dependency> |
| 4614 | - <dependency> |
| 4615 | - <groupId>org.springframework</groupId> |
| 4616 | - <artifactId>spring-tx</artifactId> |
| 4617 | - <version>${spring-version}</version> |
| 4618 | - <optional>true</optional> |
| 4619 | - </dependency> |
| 4620 | - <!-- |
| 4621 | - <dependency> |
| 4622 | - <groupId>org.springframework</groupId> |
| 4623 | - <artifactId>spring</artifactId> |
| 4624 | - <version>${spring-version}</version> |
| 4625 | - <optional>true</optional> |
| 4626 | - <exclusions> |
| 4627 | - <exclusion> |
| 4628 | - <groupId>javax.mail</groupId> |
| 4629 | - <artifactId>mail</artifactId> |
| 4630 | - </exclusion> |
| 4631 | - <exclusion> |
| 4632 | - <groupId>javax.resource</groupId> |
| 4633 | - <artifactId>connector</artifactId> |
| 4634 | - </exclusion> |
| 4635 | - <exclusion> |
| 4636 | - <groupId>javax.transaction</groupId> |
| 4637 | - <artifactId>jta</artifactId> |
| 4638 | - </exclusion> |
| 4639 | - <exclusion> |
| 4640 | - <groupId>org.springframework</groupId> |
| 4641 | - <artifactId>spring-support</artifactId> |
| 4642 | - </exclusion> |
| 4643 | - <exclusion> |
| 4644 | - <groupId>org.springframework</groupId> |
| 4645 | - <artifactId>spring-orm</artifactId> |
| 4646 | - </exclusion> |
| 4647 | - <exclusion> |
| 4648 | - <groupId>org.springframework</groupId> |
| 4649 | - <artifactId>spring-hibernate</artifactId> |
| 4650 | - </exclusion> |
| 4651 | - <exclusion> |
| 4652 | - <groupId>org.springframework</groupId> |
| 4653 | - <artifactId>spring-remoting</artifactId> |
| 4654 | - </exclusion> |
| 4655 | - <exclusion> |
| 4656 | - <groupId>org.springframework</groupId> |
| 4657 | - <artifactId>spring-core</artifactId> |
| 4658 | - </exclusion> |
| 4659 | - </exclusions> |
| 4660 | - </dependency> |
| 4661 | - --> |
| 4662 | - <dependency> |
| 4663 | - <groupId>org.springframework</groupId> |
| 4664 | - <artifactId>spring-webmvc</artifactId> |
| 4665 | - <version>${spring-version}</version> |
| 4666 | - </dependency> |
| 4667 | - <dependency> |
| 4668 | - <groupId>org.springframework</groupId> |
| 4669 | - <artifactId>spring-web</artifactId> |
| 4670 | - <version>${spring-version}</version> |
| 4671 | - </dependency> |
| 4672 | - <dependency> |
| 4673 | - <groupId>org.springframework</groupId> |
| 4674 | - <artifactId>spring-test</artifactId> |
| 4675 | - <version>${spring-version}</version> |
| 4676 | - </dependency> |
| 4677 | - <dependency> |
| 4678 | - <groupId>org.springframework.ws</groupId> |
| 4679 | - <artifactId>spring-oxm-tiger</artifactId> |
| 4680 | - <version>${spring-oxm-version}</version> |
| 4681 | - </dependency> |
| 4682 | - <dependency> |
| 4683 | - <groupId>org.springframework.osgi</groupId> |
| 4684 | - <artifactId>spring-osgi-core</artifactId> |
| 4685 | - <version>${spring-osgi-version}</version> |
| 4686 | - </dependency> |
| 4687 | - |
| 4688 | - <!-- Optional Derby support--> |
| 4689 | - <dependency> |
| 4690 | - <groupId>org.apache.derby</groupId> |
| 4691 | - <artifactId>derby</artifactId> |
| 4692 | - <version>${org-apache-derby-version}</version> |
| 4693 | - <optional>true</optional> |
| 4694 | - </dependency> |
| 4695 | - <dependency> |
| 4696 | - <groupId>org.apache.derby</groupId> |
| 4697 | - <artifactId>derbynet</artifactId> |
| 4698 | - <version>${org-apache-derby-version}</version> |
| 4699 | - <optional>true</optional> |
| 4700 | - </dependency> |
| 4701 | - |
| 4702 | - <!-- Optional Axion support --> |
| 4703 | - <dependency> |
| 4704 | - <groupId>axion</groupId> |
| 4705 | - <artifactId>axion</artifactId> |
| 4706 | - <version>${axion-version}</version> |
| 4707 | - <optional>true</optional> |
| 4708 | - </dependency> |
| 4709 | - |
| 4710 | - <dependency> |
| 4711 | - <groupId>commons-primitives</groupId> |
| 4712 | - <artifactId>commons-primitives</artifactId> |
| 4713 | - <version>${commons-primitives-version}</version> |
| 4714 | - <optional>true</optional> |
| 4715 | - </dependency> |
| 4716 | - |
| 4717 | - <dependency> |
| 4718 | - <groupId>regexp</groupId> |
| 4719 | - <artifactId>regexp</artifactId> |
| 4720 | - <version>${regexp-version}</version> |
| 4721 | - <optional>true</optional> |
| 4722 | - </dependency> |
| 4723 | - |
| 4724 | - <!-- Optional HSQL DB Support --> |
| 4725 | - <!-- |
| 4726 | - <dependency> |
| 4727 | - <groupId>hsqldb</groupId> |
| 4728 | - <artifactId>hsqldb</artifactId> |
| 4729 | - <version>${hsqldb-version}</version> |
| 4730 | - <optional>true</optional> |
| 4731 | - </dependency> |
| 4732 | - --> |
| 4733 | - |
| 4734 | - <dependency> |
| 4735 | - <groupId>commons-dbcp</groupId> |
| 4736 | - <artifactId>commons-dbcp</artifactId> |
| 4737 | - <version>${commons-dbcp-version}</version> |
| 4738 | - <optional>true</optional> |
| 4739 | - </dependency> |
| 4740 | - |
| 4741 | - <dependency> |
| 4742 | - <groupId>commons-pool</groupId> |
| 4743 | - <artifactId>commons-pool</artifactId> |
| 4744 | - <version>${commons-pool-version}</version> |
| 4745 | - <optional>true</optional> |
| 4746 | - </dependency> |
| 4747 | - |
| 4748 | - <!-- Optional Journal Implementation --> |
| 4749 | - <!-- |
| 4750 | - <dependency> |
| 4751 | - <groupId>howl</groupId> |
| 4752 | - <artifactId>howl-logger</artifactId> |
| 4753 | - <version>${howl-version}</version> |
| 4754 | - <optional>true</optional> |
| 4755 | - </dependency> |
| 4756 | - --> |
| 4757 | - |
| 4758 | - <!-- Optional Jabber support --> |
| 4759 | - <dependency> |
| 4760 | - <groupId>activemq</groupId> |
| 4761 | - <artifactId>smack</artifactId> |
| 4762 | - <version>1.5.0</version> |
| 4763 | - <optional>true</optional> |
| 4764 | - </dependency> |
| 4765 | - |
| 4766 | - <dependency> |
| 4767 | - <groupId>activemq</groupId> |
| 4768 | - <artifactId>smackx</artifactId> |
| 4769 | - <version>1.5.0</version> |
| 4770 | - <optional>true</optional> |
| 4771 | - </dependency> |
| 4772 | - |
| 4773 | - <!-- =============================== --> |
| 4774 | - <!-- XML processing dependencies --> |
| 4775 | - <!-- =============================== --> |
| 4776 | - <!-- For XMLBeans --> |
| 4777 | - <dependency> |
| 4778 | - <groupId>xmlbeans</groupId> |
| 4779 | - <artifactId>xbean</artifactId> |
| 4780 | - <version>${xmlbeans-version}</version> |
| 4781 | - </dependency> |
| 4782 | - <dependency> |
| 4783 | - <groupId>xmlbeans</groupId> |
| 4784 | - <artifactId>xmlpublic</artifactId> |
| 4785 | - <version>${xmlbeans-version}</version> |
| 4786 | - </dependency> |
| 4787 | - <dependency> |
| 4788 | - <groupId>xmlbeans</groupId> |
| 4789 | - <artifactId>xbean_xpath</artifactId> |
| 4790 | - <version>${xmlbeans-version}</version> |
| 4791 | - </dependency> |
| 4792 | - |
| 4793 | - <!-- For Stax --> |
| 4794 | - <dependency> |
| 4795 | - <groupId>stax</groupId> |
| 4796 | - <artifactId>stax-api</artifactId> |
| 4797 | - <version>${stax-api-version}</version> |
| 4798 | - </dependency> |
| 4799 | - <dependency> |
| 4800 | - <groupId>stax</groupId> |
| 4801 | - <artifactId>stax</artifactId> |
| 4802 | - <version>${stax-version}</version> |
| 4803 | - </dependency> |
| 4804 | - |
| 4805 | - <!-- To use XPath using JAXP 1.3 (std in Java 5) --> |
| 4806 | - <dependency> |
| 4807 | - <groupId>activesoap</groupId> |
| 4808 | - <artifactId>jaxp-api</artifactId> |
| 4809 | - <version>${activesoap-version}</version> |
| 4810 | - </dependency> |
| 4811 | - |
| 4812 | - <dependency> |
| 4813 | - <groupId>xalan</groupId> |
| 4814 | - <artifactId>xalan</artifactId> |
| 4815 | - <version>2.6.0</version> |
| 4816 | - </dependency> |
| 4817 | - |
| 4818 | - <dependency> |
| 4819 | - <groupId>com.thoughtworks.xstream</groupId> |
| 4820 | - <artifactId>xstream</artifactId> |
| 4821 | - <version>${xstream-version}</version> |
| 4822 | - <exclusions> |
| 4823 | - <exclusion> |
| 4824 | - <!-- xom is an optional dependency of xstream. Its also |
| 4825 | - LGPL, so its really not ASF compatible. --> |
| 4826 | - <groupId>xom</groupId> |
| 4827 | - <artifactId>xom</artifactId> |
| 4828 | - </exclusion> |
| 4829 | - </exclusions> |
| 4830 | - </dependency> |
| 4831 | - |
| 4832 | - <dependency> |
| 4833 | - <groupId>xpp3</groupId> |
| 4834 | - <artifactId>xpp3</artifactId> |
| 4835 | - <version>${xpp3-version}</version> |
| 4836 | - </dependency> |
| 4837 | - |
| 4838 | - <dependency> |
| 4839 | - <groupId>org.mortbay.jetty</groupId> |
| 4840 | - <artifactId>jsp-2.1-glassfish</artifactId> |
| 4841 | - <version>${jsp-version}</version> |
| 4842 | - </dependency> |
| 4843 | - |
| 4844 | - <dependency> |
| 4845 | - <groupId>org.eclipse.jetty.aggregate</groupId> |
| 4846 | - <artifactId>jetty-all-server</artifactId> |
| 4847 | - <version>${jetty-version}</version> |
| 4848 | - </dependency> |
| 4849 | - |
| 4850 | - <dependency> |
| 4851 | - <groupId>axis</groupId> |
| 4852 | - <artifactId>axis</artifactId> |
| 4853 | - <version>${axis-version}</version> |
| 4854 | - </dependency> |
| 4855 | - |
| 4856 | - <dependency> |
| 4857 | - <groupId>commons-httpclient</groupId> |
| 4858 | - <artifactId>commons-httpclient</artifactId> |
| 4859 | - <version>${commons-httpclient-version}</version> |
| 4860 | - </dependency> |
| 4861 | - |
| 4862 | - <dependency> |
| 4863 | - <groupId>aopalliance</groupId> |
| 4864 | - <artifactId>aopalliance</artifactId> |
| 4865 | - <version>${aopalliance-version}</version> |
| 4866 | - </dependency> |
| 4867 | - |
| 4868 | - <dependency> |
| 4869 | - <groupId>org.jasypt</groupId> |
| 4870 | - <artifactId>jasypt</artifactId> |
| 4871 | - <version>${jasypt-version}</version> |
| 4872 | - </dependency> |
| 4873 | - |
| 4874 | - <!-- testing dependencies --> |
| 4875 | - <dependency> |
| 4876 | - <groupId>junit</groupId> |
| 4877 | - <artifactId>junit</artifactId> |
| 4878 | - <version>${junit-version}</version> |
| 4879 | - <scope>test</scope> |
| 4880 | - </dependency> |
| 4881 | - <dependency> |
| 4882 | - <groupId>org.jmock</groupId> |
| 4883 | - <artifactId>jmock-junit4</artifactId> |
| 4884 | - <version>${jmock-version}</version> |
| 4885 | - <scope>test</scope> |
| 4886 | - </dependency> |
| 4887 | - <dependency> |
| 4888 | - <groupId>org.jmock</groupId> |
| 4889 | - <artifactId>jmock-legacy</artifactId> |
| 4890 | - <version>${jmock-version}</version> |
| 4891 | - <scope>test</scope> |
| 4892 | - </dependency> |
| 4893 | - <dependency> |
| 4894 | - <groupId>org.hamcrest</groupId> |
| 4895 | - <artifactId>hamcrest-all</artifactId> |
| 4896 | - <version>1.1</version> |
| 4897 | - <scope>test</scope> |
| 4898 | - </dependency> |
| 4899 | - <dependency> |
| 4900 | - <groupId>org.codehaus.jettison</groupId> |
| 4901 | - <artifactId>jettison</artifactId> |
| 4902 | - <version>${jettison-version}</version> |
| 4903 | - </dependency> |
| 4904 | - |
| 4905 | - <dependency> |
| 4906 | - <groupId>annogen</groupId> |
| 4907 | - <artifactId>annogen</artifactId> |
| 4908 | - <version>${annogen-version}</version> |
| 4909 | - </dependency> |
| 4910 | - |
| 4911 | - <dependency> |
| 4912 | - <groupId>commons-io</groupId> |
| 4913 | - <artifactId>commons-io</artifactId> |
| 4914 | - <version>${commons-io-version}</version> |
| 4915 | - </dependency> |
| 4916 | - |
| 4917 | - <dependency> |
| 4918 | - <groupId>org.apache.ant</groupId> |
| 4919 | - <artifactId>ant</artifactId> |
| 4920 | - <version>${ant-version}</version> |
| 4921 | - </dependency> |
| 4922 | - |
| 4923 | - <!-- ACTIVEMQ-WEB Specific Dependencies --> |
| 4924 | - <dependency> |
| 4925 | - <groupId>rome</groupId> |
| 4926 | - <artifactId>rome</artifactId> |
| 4927 | - <version>${rome-version}</version> |
| 4928 | - </dependency> |
| 4929 | - <dependency> |
| 4930 | - <groupId>jdom</groupId> |
| 4931 | - <artifactId>jdom</artifactId> |
| 4932 | - <version>${jdom-version}</version> |
| 4933 | - </dependency> |
| 4934 | - |
| 4935 | - <dependency> |
| 4936 | - <groupId>p2psockets</groupId> |
| 4937 | - <artifactId>p2psockets-core</artifactId> |
| 4938 | - <version>${p2psockets-version}</version> |
| 4939 | - </dependency> |
| 4940 | - <dependency> |
| 4941 | - <groupId>jxta</groupId> |
| 4942 | - <artifactId>jxta</artifactId> |
| 4943 | - <version>${jxta-version}</version> |
| 4944 | - </dependency> |
| 4945 | - |
| 4946 | - <dependency> |
| 4947 | - <groupId>org.slf4j</groupId> |
| 4948 | - <artifactId>slf4j-api</artifactId> |
| 4949 | - <version>${slf4j-version}</version> |
| 4950 | - </dependency> |
| 4951 | - <dependency> |
| 4952 | - <groupId>org.slf4j</groupId> |
| 4953 | - <artifactId>slf4j-log4j12</artifactId> |
| 4954 | - <version>${slf4j-version}</version> |
| 4955 | - </dependency> |
| 4956 | - <dependency> |
| 4957 | - <groupId>org.slf4j</groupId> |
| 4958 | - <artifactId>jcl-over-slf4j</artifactId> |
| 4959 | - <version>${slf4j-version}</version> |
| 4960 | - </dependency> |
| 4961 | - <dependency> |
| 4962 | - <groupId>opensymphony</groupId> |
| 4963 | - <artifactId>sitemesh</artifactId> |
| 4964 | - <version>2.2.1</version> |
| 4965 | - </dependency> |
| 4966 | - <dependency> |
| 4967 | - <groupId>javax.servlet</groupId> |
| 4968 | - <artifactId>jstl</artifactId> |
| 4969 | - <version>1.0</version> |
| 4970 | - </dependency> |
| 4971 | - <dependency> |
| 4972 | - <groupId>taglibs</groupId> |
| 4973 | - <artifactId>standard</artifactId> |
| 4974 | - <version>1.1.2</version> |
| 4975 | - </dependency> |
| 4976 | - |
| 4977 | - <dependency> |
| 4978 | - <groupId>org.apache.geronimo.components</groupId> |
| 4979 | - <artifactId>geronimo-transaction</artifactId> |
| 4980 | - <version>2.1</version> |
| 4981 | - </dependency> |
| 4982 | - |
| 4983 | - <!-- FTP support for BlobMessages --> |
| 4984 | - <dependency> |
| 4985 | - <groupId>commons-net</groupId> |
| 4986 | - <artifactId>commons-net</artifactId> |
| 4987 | - <version>${commons-net-version}</version> |
| 4988 | - </dependency> |
| 4989 | - |
| 4990 | - <dependency> |
| 4991 | - <groupId>org.apache.velocity</groupId> |
| 4992 | - <artifactId>velocity</artifactId> |
| 4993 | - <version>${velocity-version}</version> |
| 4994 | - <optional>true</optional> |
| 4995 | - </dependency> |
| 4996 | - <dependency> |
| 4997 | - <groupId>net.sf.josql</groupId> |
| 4998 | - <artifactId>josql</artifactId> |
| 4999 | - <version>1.5</version> |
| 5000 | - <optional>true</optional> |


Thanks for taking the time to prepare this merge proposal.
As Ubuntu 12.04 is now release this fix will need to go through the Stable Release Update process.
This consitutes a minimal change the the version that is already in Ubuntu 12.04 rather than a merge from Debian Testing.
See https:/ /wiki.ubuntu. com/StableRelea seUpdates for more information.