qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1557776 - in /qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl: ConnectionFactoryImpl.java ConnectionImpl.java MessageConsumerImpl.java SessionImpl.java
Date Mon, 13 Jan 2014 17:21:49 GMT
Author: rgodfrey
Date: Mon Jan 13 17:21:49 2014
New Revision: 1557776

URL: http://svn.apache.org/r1557776
Log:
NO-JIRA : revert accidentally commited files

Modified:
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionFactoryImpl.java
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java

Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionFactoryImpl.java?rev=1557776&r1=1557775&r2=1557776&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionFactoryImpl.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionFactoryImpl.java
Mon Jan 13 17:21:49 2014
@@ -26,8 +26,6 @@ import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLDecoder;
 import java.net.URLStreamHandler;
-import java.util.HashMap;
-import java.util.Map;
 import javax.jms.JMSException;
 import javax.jms.QueueConnection;
 import javax.jms.QueueConnectionFactory;
@@ -52,7 +50,6 @@ public class ConnectionFactoryImpl imple
     private boolean _useBinaryMessageId = Boolean.parseBoolean(System.getProperty("qpid.use_binary_message_id",
"true"));
     private boolean _syncPublish = Boolean.parseBoolean(System.getProperty("qpid.sync_publish",
"false"));
     private int _maxSessions = Integer.getInteger("qpid.max_sessions", 0);
-    private int _maxPrefetch;
 
 
     public ConnectionFactoryImpl(final String host,
@@ -138,201 +135,118 @@ public class ConnectionFactoryImpl imple
         connection.setTopicPrefix(_topicPrefix);
         connection.setUseBinaryMessageId(_useBinaryMessageId);
         connection.setSyncPublish(_syncPublish);
-        if(_maxPrefetch != 0)
-        {
-            connection.setMaxPrefetch(_maxPrefetch);
-        }
         return connection;
     }
 
-    public void setMaxPrefetch(final int maxPrefetch)
-    {
-        _maxPrefetch = maxPrefetch;
-    }
-
-    private static class ConnectionOptions
-    {
-        String username;
-        String password;
-        String clientId;
-        String remoteHost;
-
-        boolean binaryMessageId = true;
-        boolean syncPublish;
-        int maxSessions;
-        public boolean ssl;
-        public int maxPrefetch;
-    }
-
-
-
-    private static abstract class OptionSetter
-    {
-
-        private static final Map<String, OptionSetter> OPTION_SETTER_MAP = new HashMap<String,
OptionSetter>();
-        private final String _name;
-        private final String _description;
-
-        public OptionSetter(String name, String description)
-        {
-            OPTION_SETTER_MAP.put(name.toLowerCase(), this);
-            _name = name;
-            _description = description;
-        }
-
-        public abstract void setOption(ConnectionOptions options, String value) throws MalformedURLException;
-
-        public static void parseOptions(URL url, ConnectionOptions options) throws MalformedURLException
-        {
-            String query = url.getQuery();
-            if(query != null)
-            {
-                for(String param : query.split("&"))
-                {
-
-                    String[] keyValuePair = param.split("=",2);
-                    OptionSetter setter = OPTION_SETTER_MAP.get(keyValuePair[0]);
-                    if(setter != null)
-                    {
-                        setter.setOption(options, keyValuePair[1]);
-                    }
-                    else
-                    {
-                        throw new MalformedURLException("Unknown URL option: '"+keyValuePair[0]+"'
in connection URL");
-                    }
-
-                }
-            }
-        }
-    }
-
-    private static final OptionSetter[] _options =
-        {
-            new OptionSetter("clientid", "JMS client id / AMQP container id")
-            {
-                public void setOption(ConnectionOptions options, String value)
-                {
-                    options.clientId = value;
-                }
-            },
-            new OptionSetter("ssl", "Set to \"true\" to use SSL encryption")
-            {
-                public void setOption(ConnectionOptions options, String value)
-                {
-                    options.ssl = Boolean.valueOf(value);
-                }
-            },
-            new OptionSetter("remote-host", "AMQP remote host")
-            {
-                public void setOption(ConnectionOptions options, String value)
-                {
-                    options.remoteHost = value;
-                }
-            },
-            new OptionSetter("binary-messageid", "Use binary (rather than String) message
ids")
-            {
-                public void setOption(ConnectionOptions options, String value)
-                {
-                    options.binaryMessageId = Boolean.parseBoolean(value);
-                }
-            },
-            new OptionSetter("sync-publish", "Wait for acknowledge when sending messages")
-            {
-                public void setOption(ConnectionOptions options, String value)
-                {
-                    options.syncPublish = Boolean.parseBoolean(value);
-                }
-            },
-            new OptionSetter("max-sessions", "set maximum number of sessions allowed")
-            {
-                public void setOption(ConnectionOptions options, String value)
-                {
-                    options.maxSessions = Integer.parseInt(value);
-                }
-            },
-            new OptionSetter("max-prefetch", "set maximum number of messages prefetched on
a link")
-            {
-                public void setOption(ConnectionOptions options, String value)
-                {
-                    options.maxPrefetch = Integer.parseInt(value);
-                }
-            }
-        };
-
     public static ConnectionFactoryImpl createFromURL(final String urlString) throws MalformedURLException
     {
         URL url = new URL(null, urlString, new URLStreamHandler()
-        {
-            @Override
-            protected URLConnection openConnection(URL u) throws IOException
-            {
-                throw new UnsupportedOperationException();
-            }
-        });
+                    {
+                        @Override
+                        protected URLConnection openConnection(URL u) throws IOException
+                        {
+                            throw new UnsupportedOperationException();
+                        }
+                    });
         String protocol = url.getProtocol();
-        if (protocol == null || "".equals(protocol))
+        if(protocol == null || "".equals(protocol))
         {
             protocol = "amqp";
         }
+/*
+        else if(!protocol.equals("amqp") && !protocol.equals("amqps"))
+        {
+            throw new MalformedURLException("Protocol '"+protocol+"' unknown. Must be one
of 'amqp' or 'amqps'.");
+        }
+*/
         String host = url.getHost();
         int port = url.getPort();
 
-        final ConnectionOptions options = new ConnectionOptions();
+        boolean ssl = false;
 
-        if (port == -1)
+        if(port == -1)
         {
-            if ("amqps".equals(protocol))
+            if("amqps".equals(protocol))
             {
                 port = 5671;
-                options.ssl = true;
+                ssl = true;
             }
             else
             {
                 port = 5672;
             }
         }
-        else if ("amqps".equals(protocol))
+        else if("amqps".equals(protocol))
         {
-            options.ssl = true;
+            ssl = true;
         }
 
-
         String userInfo = url.getUserInfo();
+        String username = null;
+        String password = null;
+        String clientId = null;
+        String remoteHost = null;
+
+        boolean binaryMessageId = true;
+        boolean syncPublish = false;
+        int maxSessions = 0;
 
-        if (userInfo != null)
+        if(userInfo != null)
         {
-            String[] components = userInfo.split(":", 2);
-            options.username = URLDecoder.decode(components[0]);
-            if (components.length == 2)
+            String[] components = userInfo.split(":",2);
+            username = URLDecoder.decode(components[0]);
+            if(components.length == 2)
             {
-                options.password = URLDecoder.decode(components[1]);
+                password = URLDecoder.decode(components[1]);
             }
         }
-
-        OptionSetter.parseOptions(url, options);
-
-        if (options.remoteHost == null)
+        String query = url.getQuery();
+        if(query != null)
         {
-            options.remoteHost = host;
+            for(String param : query.split("&"))
+            {
+                String[] keyValuePair = param.split("=",2);
+                if(keyValuePair[0].equalsIgnoreCase("clientid"))
+                {
+                    clientId = keyValuePair[1];
+                }
+                else if(keyValuePair[0].equalsIgnoreCase("ssl"))
+                {
+                    ssl = Boolean.valueOf(keyValuePair[1]);
+                }
+                else if(keyValuePair[0].equalsIgnoreCase("remote-host"))
+                {
+                    remoteHost = keyValuePair[1];
+                }
+                else if (keyValuePair[0].equalsIgnoreCase("binary-messageid"))
+                {
+                    binaryMessageId = Boolean.parseBoolean(keyValuePair[1]);
+                }
+                else if (keyValuePair[0].equalsIgnoreCase("sync-publish"))
+                {
+                    syncPublish = Boolean.parseBoolean(keyValuePair[1]);
+                }
+                else if(keyValuePair[0].equalsIgnoreCase("max-sessions"))
+                {
+                    maxSessions = Integer.parseInt(keyValuePair[1]);
+                }
+                else
+                {
+                    throw new MalformedURLException("Unknown URL option: '"+keyValuePair[0]+"'
in connection URL: "+urlString);
+                }
+            }
         }
 
-        ConnectionFactoryImpl connectionFactory =
-                new ConnectionFactoryImpl(protocol,
-                                          host,
-                                          port,
-                                          options.username,
-                                          options.password,
-                                          options.clientId,
-                                          options.remoteHost,
-                                          options.ssl,
-                                          options.maxSessions);
-        connectionFactory.setUseBinaryMessageId(options.binaryMessageId);
-        connectionFactory.setSyncPublish(options.syncPublish);
-        if (options.maxPrefetch != 0)
+        if(remoteHost == null)
         {
-            connectionFactory.setMaxPrefetch(options.maxPrefetch);
+            remoteHost = host;
         }
 
+        ConnectionFactoryImpl connectionFactory =
+                new ConnectionFactoryImpl(protocol,host, port, username, password, clientId,
remoteHost, ssl, maxSessions);
+        connectionFactory.setUseBinaryMessageId(binaryMessageId);
+        connectionFactory.setSyncPublish(syncPublish);
+
         return connectionFactory;
 
     }
@@ -394,6 +308,4 @@ public class ConnectionFactoryImpl imple
     {
         _syncPublish = syncPublish;
     }
-
-
 }

Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java?rev=1557776&r1=1557775&r2=1557776&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java
Mon Jan 13 17:21:49 2014
@@ -62,12 +62,6 @@ public class ConnectionImpl implements C
     private boolean _useBinaryMessageId = Boolean.parseBoolean(System.getProperty("qpid.use_binary_message_id",
"true"));
     private boolean _syncPublish = Boolean.parseBoolean(System.getProperty("qpid.sync_publish",
"false"));
     private int _maxSessions;
-    private int _maxPrefetch;
-
-    public void setMaxPrefetch(final int maxPrefetch)
-    {
-        _maxPrefetch = maxPrefetch;
-    }
 
     private static enum State
     {
@@ -196,10 +190,6 @@ public class ConnectionImpl implements C
             SessionImpl session = new SessionImpl(this, acknowledgeMode);
             session.setQueueSession(_isQueueConnection);
             session.setTopicSession(_isTopicConnection);
-            if(_maxPrefetch != 0)
-            {
-                session.setMaxPrefetch(_maxPrefetch);
-            }
             
             boolean connectionStarted = false;
             synchronized(_lock)

Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java?rev=1557776&r1=1557775&r2=1557776&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
Mon Jan 13 17:21:49 2014
@@ -76,7 +76,6 @@ public class MessageConsumerImpl impleme
     private Binary _lastTxnUpdate;
     private final List<Message> _recoverReplayMessages = new ArrayList<Message>();
     private final List<Message> _replaymessages = new ArrayList<Message>();
-    private int _maxPrefetch = 100;
 
     MessageConsumerImpl(final Destination destination,
                         final SessionImpl session,
@@ -118,10 +117,6 @@ public class MessageConsumerImpl impleme
             throw new InvalidDestinationException("Invalid destination class " + destination.getClass().getName());
         }
         _session = session;
-        if(session.getMaxPrefetch() != 0)
-        {
-            _maxPrefetch = session.getMaxPrefetch();
-        }
 
         _receiver = createClientReceiver();
         _receiver.setRemoteErrorListener(new Runnable()
@@ -447,7 +442,7 @@ public class MessageConsumerImpl impleme
 
     public void start()
     {
-        _receiver.setCredit(UnsignedInteger.valueOf(getMaxPrefetch()), true);
+        _receiver.setCredit(UnsignedInteger.valueOf(100), true);
     }
 
     public Queue getQueue() throws JMSException
@@ -492,14 +487,4 @@ public class MessageConsumerImpl impleme
             }
         }
     }
-
-    public int getMaxPrefetch()
-    {
-        return _maxPrefetch;
-    }
-
-    public void setMaxPrefetch(final int maxPrefetch)
-    {
-        _maxPrefetch = maxPrefetch;
-    }
 }

Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java?rev=1557776&r1=1557775&r2=1557776&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
Mon Jan 13 17:21:49 2014
@@ -81,7 +81,6 @@ public class SessionImpl implements Sess
     private boolean _isQueueSession;
     private boolean _isTopicSession;
     private Transaction _txn;
-    private int _maxPrefetch;
 
     protected SessionImpl(final ConnectionImpl connection, final AcknowledgeMode acknowledgeMode)
throws JMSException
     {
@@ -844,16 +843,6 @@ public class SessionImpl implements Sess
         return _txn;
     }
 
-    public void setMaxPrefetch(final int maxPrefetch)
-    {
-        _maxPrefetch = maxPrefetch;
-    }
-
-    public int getMaxPrefetch()
-    {
-        return _maxPrefetch;
-    }
-
     private class Dispatcher implements Runnable
     {
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message