@@ -0,0 +1,3442 @@
+/**%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.activemq.pool;%0A%0Aimport java.util.Properties;%0Aimport javax.naming.NamingException;%0Aimport javax.naming.Reference;%0Aimport org.apache.activemq.ActiveMQConnectionFactory;%0Aimport org.apache.activemq.jndi.JNDIReferenceFactory;%0Aimport org.apache.activemq.jndi.JNDIStorableInterface;%0Aimport org.apache.activemq.pool.PooledConnectionFactory;%0A%0A/**%0A* AmqJNDIPooledConnectionFactory.java%0A* Created by linus on 2008-03-07.%0A*/%0Apublic class AmqJNDIPooledConnectionFactory extends PooledConnectionFactory%0A        implements JNDIStorableInterface %7B%0A    private Properties properties;%0A%0A    public AmqJNDIPooledConnectionFactory() %7B%0A        super();%0A    %7D%0A%0A    /**%0A     * set the properties for this instance as retrieved from JNDI%0A     * %0A     * @param props%0A     */%0A    public synchronized void setProperties(Properties props) %7B%0A        this.properties = props;%0A        buildFromProperties(props);%0A    %7D%0A%0A    /**%0A     * Get the properties from this instance for storing in JNDI%0A     * %0A     * @return the properties%0A     */%0A    public synchronized Properties getProperties() %7B%0A        if (this.properties == null) %7B%0A            this.properties = new Properties();%0A        %7D%0A        populateProperties(this.properties);%0A        return this.properties;%0A    %7D%0A%0A    /**%0A     * Retrive a Reference for this instance to store in JNDI%0A     * %0A     * @return the built Reference%0A     * @throws NamingException%0A     *             if error on building Reference%0A     */%0A    public Reference getReference() throws NamingException %7B%0A        return JNDIReferenceFactory.createReference(this.getClass().getName(),%0A                this);%0A    %7D%0A%0A    public void buildFromProperties(Properties properties) %7B%0A        if (properties == null) %7B%0A            properties = new Properties();%0A        %7D%0A        ((ActiveMQConnectionFactory) getConnectionFactory())%0A                .buildFromProperties(properties);%0A        String temp = properties.getProperty(%22maximumActive%22);%0A        if (temp != null && temp.length() %3E 0) %7B%0A            setMaximumActive(Integer.parseInt(temp));%0A        %7D%0A        temp = properties.getProperty(%22maxConnections%22);%0A        if (temp != null && temp.length() %3E 0) %7B%0A            setMaxConnections(Integer.parseInt(temp));%0A        %7D%0A    %7D%0A%0A    public void populateProperties(Properties props) %7B%0A        ((ActiveMQConnectionFactory) getConnectionFactory())%0A                .populateProperties(props);%0A        props%0A                .setProperty(%22maximumActive%22, Integer%0A                        .toString(getMaximumActive()));%0A        props.setProperty(%22maxConnections%22, Integer%0A                .toString(getMaxConnections()));%0A    %7D%0A%7D%0A

Patch for https://issues.apache.org/activemq/browse/AMQ-1614