mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@491753 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3070d33275
commit
4cd0a27f91
|
@ -1,25 +1,23 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
|
||||||
* this work for additional information regarding copyright ownership.
|
* to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
* License. You may obtain a copy of the License at
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* specific language governing permissions and limitations under the License.
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.activemq.command;
|
package org.apache.activemq.command;
|
||||||
|
|
||||||
import javax.jms.JMSException;
|
import javax.jms.JMSException;
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnection;
|
import org.apache.activemq.ActiveMQConnection;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openwire:marshaller
|
* @openwire:marshaller
|
||||||
|
@ -27,6 +25,7 @@ import org.apache.activemq.ActiveMQConnection;
|
||||||
*/
|
*/
|
||||||
abstract public class ActiveMQTempDestination extends ActiveMQDestination{
|
abstract public class ActiveMQTempDestination extends ActiveMQDestination{
|
||||||
|
|
||||||
|
private static final Log log=LogFactory.getLog(ActiveMQTempDestination.class);
|
||||||
protected transient ActiveMQConnection connection;
|
protected transient ActiveMQConnection connection;
|
||||||
protected transient String connectionId;
|
protected transient String connectionId;
|
||||||
protected transient int sequenceId;
|
protected transient int sequenceId;
|
||||||
|
@ -62,12 +61,23 @@ abstract public class ActiveMQTempDestination extends ActiveMQDestination {
|
||||||
super.setPhysicalName(physicalName);
|
super.setPhysicalName(physicalName);
|
||||||
if(!isComposite()){
|
if(!isComposite()){
|
||||||
// Parse off the sequenceId off the end.
|
// Parse off the sequenceId off the end.
|
||||||
|
//this can fail if the temp destination is
|
||||||
|
//generated by another JMS system via the JMS<->JMS Bridge
|
||||||
int p=this.physicalName.lastIndexOf(":");
|
int p=this.physicalName.lastIndexOf(":");
|
||||||
sequenceId = Integer.parseInt(this.physicalName.substring(p+1).trim());
|
if(p>=0){
|
||||||
|
String seqStr=this.physicalName.substring(p+1).trim();
|
||||||
|
if(seqStr!=null&&seqStr.length()>0){
|
||||||
|
try{
|
||||||
|
sequenceId=Integer.parseInt(seqStr);
|
||||||
|
}catch(NumberFormatException e){
|
||||||
|
log.debug("Did not parse sequence Id from "+physicalName);
|
||||||
|
}
|
||||||
// The rest should be the connection id.
|
// The rest should be the connection id.
|
||||||
connectionId=this.physicalName.substring(0,p);
|
connectionId=this.physicalName.substring(0,p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getConnectionId(){
|
public String getConnectionId(){
|
||||||
return connectionId;
|
return connectionId;
|
||||||
|
|
|
@ -44,6 +44,8 @@ public class ActiveMQDestinationTest extends DataStructureTestSupport {
|
||||||
new ActiveMQTopic("TEST"),
|
new ActiveMQTopic("TEST"),
|
||||||
new ActiveMQTempQueue("TEST:1"),
|
new ActiveMQTempQueue("TEST:1"),
|
||||||
new ActiveMQTempTopic("TEST:1"),
|
new ActiveMQTempTopic("TEST:1"),
|
||||||
|
new ActiveMQTempQueue("TEST"),
|
||||||
|
new ActiveMQTempTopic("TEST"),
|
||||||
new ActiveMQQueue("TEST?option=value"),
|
new ActiveMQQueue("TEST?option=value"),
|
||||||
new ActiveMQTopic("TEST?option=value"),
|
new ActiveMQTopic("TEST?option=value"),
|
||||||
new ActiveMQTempQueue("TEST:1?option=value"),
|
new ActiveMQTempQueue("TEST:1?option=value"),
|
||||||
|
@ -80,6 +82,7 @@ public class ActiveMQDestinationTest extends DataStructureTestSupport {
|
||||||
assertEquals("Sorted order", expected, actual);
|
assertEquals("Sorted order", expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
return suite(ActiveMQDestinationTest.class);
|
return suite(ActiveMQDestinationTest.class);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue