diff options
author | Robert Godfrey <rgodfrey@apache.org> | 2012-01-29 13:05:07 +0000 |
---|---|---|
committer | Robert Godfrey <rgodfrey@apache.org> | 2012-01-29 13:05:07 +0000 |
commit | 22b64fd33e448ffc54134b28c7226342f54b4683 (patch) | |
tree | 89a27bba6ddb8674b02a810775cfb148d6de8d67 /java/broker/src/main | |
parent | 9bb75aae85d397bd9dd98c8230de3e576ce97572 (diff) | |
download | qpid-python-22b64fd33e448ffc54134b28c7226342f54b4683.tar.gz |
QPID-3789 : [Java] code tidyups
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1237273 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker/src/main')
72 files changed, 300 insertions, 732 deletions
diff --git a/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java b/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java index 96608acd42..54ca574871 100644 --- a/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java +++ b/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java @@ -290,7 +290,6 @@ public class QpidCompositeRollingAppender extends FileAppender c.setType(i); Date next = new Date(c.getNextCheckMillis(epoch)); String r1 = sdf.format(next); - // LogLog.debug("Type = "+i+", r0 = "+r0+", r1 = "+r1); if ((r0 != null) && (r1 != null) && !r0.equals(r1)) { return i; @@ -405,19 +404,6 @@ public class QpidCompositeRollingAppender extends FileAppender } } - /* - public void setRollingStyle(String style) { - if (style == S_BY_SIZE) { - rollingStyle = BY_SIZE; - } - else if (style == S_BY_DATE) { - rollingStyle = BY_DATE; - } - else if (style == S_BY_COMPOSITE) { - rollingStyle = BY_COMPOSITE; - } - } - */ public boolean getStaticLogFileName() { return staticLogFileName; @@ -535,7 +521,6 @@ public class QpidCompositeRollingAppender extends FileAppender now.setTime(System.currentTimeMillis()); sdf = new SimpleDateFormat(datePattern); int type = computeCheckPeriod(); - // printPeriodicity(type); rc.setType(type); // next line added as this removes the name check in rollOver nextCheck = rc.getNextCheckMillis(now); @@ -783,7 +768,9 @@ public class QpidCompositeRollingAppender extends FileAppender curSizeRollBackups--; } } - // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2} + /* + map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}. + */ for (int i = curSizeRollBackups; i >= 1; i--) { String oldName = (fileName + "." + i); diff --git a/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java b/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java index c6bfd34f45..4c083de41a 100644 --- a/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java +++ b/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java @@ -120,58 +120,8 @@ public class Configuration _devlog.debug("Using configuration file " + _configFile.getAbsolutePath()); } -// String logConfig = _commandLine.getOptionValue("l"); -// String logWatchConfig = _commandLine.getOptionValue("w", "0"); -// if (logConfig != null) -// { -// File logConfigFile = new File(logConfig); -// configureLogging(logConfigFile, logWatchConfig); -// } -// else -// { -// File configFileDirectory = _configFile.getParentFile(); -// File logConfigFile = new File(configFileDirectory, DEFAULT_LOG_CONFIG_FILENAME); -// configureLogging(logConfigFile, logWatchConfig); -// } } - -// private void configureLogging(File logConfigFile, String logWatchConfig) -// { -// int logWatchTime = 0; -// try -// { -// logWatchTime = Integer.parseInt(logWatchConfig); -// } -// catch (NumberFormatException e) -// { -// _devlog.error("Log watch configuration value of " + logWatchConfig + " is invalid. Must be " -// + "a non-negative integer. Using default of zero (no watching configured"); -// } -// -// if (logConfigFile.exists() && logConfigFile.canRead()) -// { -// _devlog.info("Configuring logger using configuration file " + logConfigFile.getAbsolutePath()); -// if (logWatchTime > 0) -// { -// _devlog.info("log file " + logConfigFile.getAbsolutePath() + " will be checked for changes every " -// + logWatchTime + " seconds"); -// // log4j expects the watch interval in milliseconds -// DOMConfigurator.configureAndWatch(logConfigFile.getAbsolutePath(), logWatchTime * 1000); -// } -// else -// { -// DOMConfigurator.configure(logConfigFile.getAbsolutePath()); -// } -// } -// else -// { -// System.err.println("Logging configuration error: unable to read file " + logConfigFile.getAbsolutePath()); -// System.err.println("Using basic log4j configuration"); -// BasicConfigurator.configure(); -// } -// } - public File getConfigFile() { return _configFile; diff --git a/java/broker/src/main/java/org/apache/qpid/qmf/QMFProperty.java b/java/broker/src/main/java/org/apache/qpid/qmf/QMFProperty.java index 70aee947c8..5314466e2a 100644 --- a/java/broker/src/main/java/org/apache/qpid/qmf/QMFProperty.java +++ b/java/broker/src/main/java/org/apache/qpid/qmf/QMFProperty.java @@ -67,8 +67,6 @@ public class QMFProperty public void setQMFClass(QMFClass qmfClass) { - /* _map.put(REF_CLASS, qmfClass.getName()); - _map.put(REF_PACKAGE, qmfClass.getPackage().getName());*/ } public void setReferencedClass(String refClass) diff --git a/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java b/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java index dc5f45cede..265aa7714e 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java @@ -212,7 +212,7 @@ public class AMQBrokerManagerMBean extends AMQManagedObject implements ManagedBr { // TODO // Check if the exchange is in use. - // boolean inUse = false; + // Check if there are queue-bindings with the exchange and unregister // when there are no bindings. CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); diff --git a/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java b/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java index f4a7a07331..46657e2a9a 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java +++ b/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java @@ -784,20 +784,6 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm AMQQueue queue = message.getQueue(); - // Our Java Client will always suspend the channel when resending! - // If the client has requested the messages be resent then it is - // their responsibility to ensure that thay are capable of receiving them - // i.e. The channel hasn't been server side suspended. - // if (isSuspended()) - // { - // _logger.info("Channel is suspended so requeuing"); - // //move this message to requeue - // msgToRequeue.add(message); - // } - // else - // { - // release to allow it to be delivered - // Without any details from the client about what has been processed we have to mark // all messages in the unacked map as redelivered. message.setRedelivered(); diff --git a/java/broker/src/main/java/org/apache/qpid/server/binding/Binding.java b/java/broker/src/main/java/org/apache/qpid/server/binding/Binding.java index 48f85d9bc9..8e44da095a 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/binding/Binding.java +++ b/java/broker/src/main/java/org/apache/qpid/server/binding/Binding.java @@ -94,7 +94,7 @@ public class Binding return true; } - if (o == null || !(o instanceof Binding)) + if (!(o instanceof Binding)) { return false; } diff --git a/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java b/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java index 46cf8c525c..40bafb4275 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java +++ b/java/broker/src/main/java/org/apache/qpid/server/configuration/QueueConfiguration.java @@ -205,7 +205,7 @@ public class QueueConfiguration extends ConfigurationPlugin public void validateConfiguration() throws ConfigurationException { - if (_configuration.isEmpty()) + if (getConfig().isEmpty()) { throw new ConfigurationException("Queue section cannot be empty."); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java b/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java index 0f7fb513d6..cb6ebb9b95 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java +++ b/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java @@ -176,7 +176,7 @@ public class ServerConfiguration extends ConfigurationPlugin */ public ServerConfiguration(Configuration conf) { - _configuration = conf; + setConfig(conf); } /** @@ -196,8 +196,8 @@ public class ServerConfiguration extends ConfigurationPlugin */ public void initialise() throws ConfigurationException { - setConfiguration("", _configuration); - setupVirtualHosts(_configuration); + setConfiguration("", getConfig()); + setupVirtualHosts(getConfig()); } public String[] getElementsProcessed() @@ -302,7 +302,7 @@ public class ServerConfiguration extends ConfigurationPlugin // save the default virtualhost name String defaultVirtualHost = vhostConfiguration.getString("default"); - _configuration.setProperty("virtualhosts.default", defaultVirtualHost); + getConfig().setProperty("virtualhosts.default", defaultVirtualHost); } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfig.java b/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfig.java index 024831ce6c..10e40151b0 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfig.java +++ b/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfig.java @@ -29,7 +29,7 @@ public class TopicConfig extends ConfigurationPlugin { public TopicConfig() { - _configuration = new PropertiesConfiguration(); + setConfig(new PropertiesConfiguration()); } @Override @@ -51,7 +51,7 @@ public class TopicConfig extends ConfigurationPlugin public void validateConfiguration() throws ConfigurationException { - if (_configuration.isEmpty()) + if (getConfig().isEmpty()) { throw new ConfigurationException("Topic section cannot be empty."); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfiguration.java b/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfiguration.java index 7a919a5829..feafd3de1d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfiguration.java +++ b/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfiguration.java @@ -68,17 +68,17 @@ public class TopicConfiguration extends ConfigurationPlugin implements ExchangeC @Override public void validateConfiguration() throws ConfigurationException { - if (_configuration.isEmpty()) + if (getConfig().isEmpty()) { throw new ConfigurationException("Topics section cannot be empty."); } - int topics = _configuration.getList("topic.name").size() + - _configuration.getList("topic.subscriptionName").size(); + int topics = getConfig().getList("topic.name").size() + + getConfig().getList("topic.subscriptionName").size(); for (int index = 0; index < topics; index++) { - Configuration topicSubset = _configuration.subset("topic(" + index + ")"); + Configuration topicSubset = getConfig().subset("topic(" + index + ")"); // This will occur when we have a subscriptionName that is bound to a // topic. @@ -91,8 +91,8 @@ public class TopicConfiguration extends ConfigurationPlugin implements ExchangeC topic.setConfiguration(VIRTUALHOSTS_VIRTUALHOST_TOPICS + ".topic", topicSubset ); - String name = _configuration.getString("topic(" + index + ").name"); - String subscriptionName = _configuration.getString("topic(" + index + ").subscriptionName"); + String name = getConfig().getString("topic(" + index + ").name"); + String subscriptionName = getConfig().getString("topic(" + index + ").subscriptionName"); // Record config if subscriptionName is there if (subscriptionName != null) diff --git a/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java b/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java index de9b092e95..5fd261a081 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java +++ b/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java @@ -76,7 +76,7 @@ public class VirtualHostConfiguration extends ConfigurationPlugin { CompositeConfiguration mungedConf = new CompositeConfiguration(); mungedConf.addConfiguration(config.subset("exchanges.exchange(" + count++ + ")")); - mungedConf.addConfiguration(_configuration.subset("exchanges")); + mungedConf.addConfiguration(getConfig().subset("exchanges")); String exchName = (String) i.next(); _exchanges.put(exchName, new ExchangeConfiguration(exchName, mungedConf)); } @@ -104,7 +104,7 @@ public class VirtualHostConfiguration extends ConfigurationPlugin public Configuration getStoreConfiguration() { - return _configuration.subset("store"); + return getConfig().subset("store"); } public String getMessageStoreClass() @@ -114,7 +114,7 @@ public class VirtualHostConfiguration extends ConfigurationPlugin public void setMessageStoreClass(String storeClass) { - _configuration.setProperty("store.class", storeClass); + getConfig().setProperty("store.class", storeClass); } public List getExchanges() diff --git a/java/broker/src/main/java/org/apache/qpid/server/configuration/plugins/ConfigurationPlugin.java b/java/broker/src/main/java/org/apache/qpid/server/configuration/plugins/ConfigurationPlugin.java index 3b2224651d..d08e3bc806 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/configuration/plugins/ConfigurationPlugin.java +++ b/java/broker/src/main/java/org/apache/qpid/server/configuration/plugins/ConfigurationPlugin.java @@ -43,7 +43,7 @@ public abstract class ConfigurationPlugin private Map<String, ConfigurationPlugin> _pluginConfiguration = new HashMap<String, ConfigurationPlugin>(); - protected Configuration _configuration; + private Configuration _config; /** * The Elements that this Plugin can process. @@ -66,7 +66,7 @@ public abstract class ConfigurationPlugin public Configuration getConfig() { - return _configuration; + return _config; } public <C extends ConfigurationPlugin> C getConfiguration(String plugin) @@ -82,7 +82,7 @@ public abstract class ConfigurationPlugin */ public void setConfiguration(String path, Configuration configuration) throws ConfigurationException { - _configuration = configuration; + _config = configuration; // Extract a list of elements for processing Iterator<?> keys = configuration.getKeys(); @@ -216,7 +216,7 @@ public abstract class ConfigurationPlugin protected boolean hasConfiguration() { - return _configuration != null; + return _config != null; } /// Getters @@ -228,7 +228,7 @@ public abstract class ConfigurationPlugin protected double getDoubleValue(String property, double defaultValue) { - return _configuration.getDouble(property, defaultValue); + return _config.getDouble(property, defaultValue); } protected long getLongValue(String property) @@ -238,7 +238,7 @@ public abstract class ConfigurationPlugin protected long getLongValue(String property, long defaultValue) { - return _configuration.getLong(property, defaultValue); + return _config.getLong(property, defaultValue); } protected int getIntValue(String property) @@ -248,7 +248,7 @@ public abstract class ConfigurationPlugin protected int getIntValue(String property, int defaultValue) { - return _configuration.getInt(property, defaultValue); + return _config.getInt(property, defaultValue); } protected String getStringValue(String property) @@ -258,7 +258,7 @@ public abstract class ConfigurationPlugin protected String getStringValue(String property, String defaultValue) { - return _configuration.getString(property, defaultValue); + return _config.getString(property, defaultValue); } protected boolean getBooleanValue(String property) @@ -268,7 +268,7 @@ public abstract class ConfigurationPlugin protected boolean getBooleanValue(String property, boolean defaultValue) { - return _configuration.getBoolean(property, defaultValue); + return _config.getBoolean(property, defaultValue); } protected List getListValue(String property) @@ -278,14 +278,14 @@ public abstract class ConfigurationPlugin protected List getListValue(String property, List defaultValue) { - return _configuration.getList(property, defaultValue); + return _config.getList(property, defaultValue); } /// Validation Helpers protected boolean contains(String property) { - return _configuration.getProperty(property) != null; + return _config.getProperty(property) != null; } /** @@ -324,7 +324,7 @@ public abstract class ConfigurationPlugin throw new ConfigurationException(this.getClass().getSimpleName() + ": unable to configure invalid " + property + ":" + - _configuration.getString(property), + _config.getString(property), last); } } @@ -333,7 +333,7 @@ public abstract class ConfigurationPlugin { try { - _configuration.getLong(property); + _config.getLong(property); return true; } catch (NoSuchElementException e) @@ -346,7 +346,7 @@ public abstract class ConfigurationPlugin { try { - long value = _configuration.getLong(property); + long value = _config.getLong(property); return value > 0; } catch (NoSuchElementException e) @@ -360,7 +360,7 @@ public abstract class ConfigurationPlugin { try { - _configuration.getInt(property); + _config.getInt(property); return true; } catch (NoSuchElementException e) @@ -373,7 +373,7 @@ public abstract class ConfigurationPlugin { try { - _configuration.getBoolean(property); + _config.getBoolean(property); return true; } catch (NoSuchElementException e) @@ -454,7 +454,7 @@ public abstract class ConfigurationPlugin protected void mergeConfiguration(ConfigurationPlugin configuration) { - _configuration = configuration.getConfig(); + _config = configuration.getConfig(); } public String toString() @@ -479,6 +479,10 @@ public abstract class ConfigurationPlugin return super.toString(); } + protected void setConfig(Configuration config) + { + _config = config; + } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java index 782ef49d35..034331abd9 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java @@ -23,7 +23,6 @@ package org.apache.qpid.server.exchange; import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.management.common.mbeans.ManagedExchange; -import org.apache.qpid.server.binding.BindingFactory; import org.apache.qpid.server.logging.actors.CurrentActor; import org.apache.qpid.server.logging.actors.ManagementActor; import org.apache.qpid.server.management.AMQManagedObject; @@ -45,7 +44,7 @@ import javax.management.openmbean.OpenType; import javax.management.openmbean.SimpleType; import javax.management.openmbean.TabularType; import java.util.Collections; -import java.util.Map; + /** * Abstract MBean class. This has some of the methods implemented from @@ -159,7 +158,7 @@ public abstract class AbstractExchangeMBean<T extends AbstractExchange> extends /** * Removes a queue binding from the exchange. * - * @see BindingFactory#removeBinding(String, AMQQueue, Exchange, Map) + * @see org.apache.qpid.server.binding.BindingFactory#removeBinding(String, AMQQueue, Exchange, java.util.Map) */ public void removeBinding(String queueName, String binding) throws JMException { diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/headers/HeadersParser.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/headers/HeadersParser.java index 1341f77c72..4bd0e8d272 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/headers/HeadersParser.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/headers/HeadersParser.java @@ -126,11 +126,11 @@ public class HeadersParser { // DFAs for "all" matches have a "success" state, a "fail" state, and states for every subset of // matches which are possible, starting with the empty subset. For example if we have a binding - // { x-match="all" + // x-match="all" // a=1 // b=1 // c=1 - // d=1 } + // d=1 // Then we would have the following states // (1) Seen none of a, b, c, or d // (2) Seen a=1 ; none of b,c, or d diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicNormalizer.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicNormalizer.java index 6556360a91..aac696ae2d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicNormalizer.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicNormalizer.java @@ -36,6 +36,10 @@ public class TopicNormalizer private static final AMQShortString AMQP_STAR_TOKEN = new AMQShortString("*"); private static final AMQShortString AMQP_HASH_TOKEN = new AMQShortString("#"); + private TopicNormalizer() + { + } + public static AMQShortString normalize(AMQShortString routingKey) { if(routingKey == null) diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicParser.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicParser.java index 54fc4b3634..89e84e8b0b 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicParser.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicParser.java @@ -458,193 +458,4 @@ public class TopicParser } - public static void main(String[] args) - { - - printMatches("#.b.*.*.*.*.*.h.#.j.*.*.*.*.*.*.q.#.r.*.*.*.*.*.*.*.*","a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z"); - printMatches(new String[]{ - "#.a.#", - "#.b.#", - "#.c.#", - "#.d.#", - "#.e.#", - "#.f.#", - "#.g.#", - "#.h.#", - "#.i.#", - "#.j.#", - "#.k.#", - "#.l.#", - "#.m.#", - "#.n.#", - "#.o.#", - "#.p.#", - "#.q.#" - - }, "a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z"); -/* - printMatches(new String[]{ - "#.a.#", - "#.b.#", - "#.c.#", - "#.d.#", - "#.e.#", - "#.f.#", - "#.g.#", - "#.h.#", - "#.i.#", - "#.j.#", - "#.k.#", - "#.l.#", - "#.m.#", - "#.n.#", - "#.o.#", - "#.p.#", - "#.q.#", - "#.r.#", - "#.s.#", - "#.t.#", - "#.u.#", - "#.v.#", - "#.w.#", - "#.x.#", - "#.y.#", - "#.z.#" - - - },"a.b"); - - printMatches("#.b.*.*.*.*.*.h.#.j.*.*.*.*.*.p.#.r.*.*.*.*.*","a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z"); - printMatches("#.b.*.*.*.*.*.h.#.j.*.*.*.*.*.p.#.r.*.*.*.*.*.*.*.*","a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z"); - printMatches("a.#.b.#","a.b.b.b.b.b.b.b.c"); - -*/ - - printMatches("",""); - printMatches("a","a"); - printMatches("a",""); - printMatches("","a"); - printMatches("a.b","a.b"); - printMatches("a","a.b"); - printMatches("a.b","a"); - printMatches("*","a"); - printMatches("*.b","a.b"); - printMatches("*.*","a.b"); - printMatches("a.*","a.b"); - printMatches("a.*.#","a.b"); - printMatches("a.#.b","a.b"); - - printMatches("#.b","a"); - printMatches("#.b","a.b"); - printMatches("#.a.b","a.b"); - - - printMatches("#",""); - printMatches("#","a"); - printMatches("#","a.b"); - printMatches("#.#","a.b"); - printMatches("#.*","a.b"); - - printMatches("#.a.b","a.b"); - printMatches("a.b.#","a.b"); - printMatches("a.#","a.b"); - printMatches("#.*.#","a.b"); - printMatches("#.*.b.#","a.b"); - printMatches("#.a.*.#","a.b"); - printMatches("#.a.#.b.#","a.b"); - printMatches("#.*.#.*.#","a.b"); - printMatches("*.#.*.#","a.b"); - printMatches("#.*.#.*","a.b"); - - - printMatches(new String[]{"a.#.b.#","a.*.#.b.#"},"a.b.b.b.b.b.b.b.c"); - - - printMatches(new String[]{"a.b", "a.c"},"a.b"); - printMatches(new String[]{"a.#", "a.c", "#.b"},"a.b"); - printMatches(new String[]{"a.#", "a.c", "#.b", "#", "*.*"},"a.b"); - - printMatches(new String[]{"a.b.c.d.e.#", "a.b.c.d.#", "a.b.c.d.*", "a.b.c.#", "#.e", "a.*.c.d.e","#.c.*.#.*.*"},"a.b.c.d.e"); - printMatches(new String[]{"a.b.c.d.e.#", "a.b.c.d.#", "a.b.c.d.*", "a.b.c.#", "#.e", "a.*.c.d.e","#.c.*.#.*.*"},"a.b.c.d.f.g"); - - - - - } - - private static void printMatches(final String[] bindingKeys, final String routingKey) - { - TopicMatcherDFAState sm = null; - Map<TopicMatcherResult, String> resultMap = new HashMap<TopicMatcherResult, String>(); - - TopicParser parser = new TopicParser(); - - long start = System.currentTimeMillis(); - for(int i = 0; i < bindingKeys.length; i++) - { - System.out.println((System.currentTimeMillis() - start) + ":\t" + bindingKeys[i]); - TopicMatcherResult r = new TopicMatcherResult(){}; - resultMap.put(r, bindingKeys[i]); - AMQShortString bindingKeyShortString = new AMQShortString(bindingKeys[i]); - - System.err.println("====================================================="); - System.err.println("Adding binding key: " + bindingKeyShortString); - System.err.println("-----------------------------------------------------"); - - - if(i==0) - { - sm = parser.createStateMachine(bindingKeyShortString, r); - } - else - { - sm = sm.mergeStateMachines(parser.createStateMachine(bindingKeyShortString, r)); - } - System.err.println(sm.reachableStates()); - System.err.println("====================================================="); - try - { - System.in.read(); - } - catch (IOException e) - { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - AMQShortString routingKeyShortString = new AMQShortString(routingKey); - - Collection<TopicMatcherResult> results = sm.parse(parser._dictionary, routingKeyShortString); - Collection<String> resultStrings = new ArrayList<String>(); - - for(TopicMatcherResult result : results) - { - resultStrings.add(resultMap.get(result)); - } - - final ArrayList<String> nonMatches = new ArrayList<String>(Arrays.asList(bindingKeys)); - nonMatches.removeAll(resultStrings); - System.out.println("\""+routingKeyShortString+"\" matched with " + resultStrings + " DID NOT MATCH with " + nonMatches); - - - } - - private static void printMatches(String bindingKey, String routingKey) - { - printMatches(new String[] { bindingKey }, routingKey); - } - - - private static boolean matches(String bindingKey, String routingKey) - { - AMQShortString bindingKeyShortString = new AMQShortString(bindingKey); - AMQShortString routingKeyShortString = new AMQShortString(routingKey); - TopicParser parser = new TopicParser(); - - final TopicMatcherResult result = new TopicMatcherResult(){}; - - TopicMatcherDFAState sm = parser.createStateMachine(bindingKeyShortString, result); - return !sm.parse(parser._dictionary,routingKeyShortString).isEmpty(); - - } - } diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java index 748b45d7cf..703f59dda6 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/ArithmeticExpression.java @@ -249,13 +249,13 @@ public abstract class ArithmeticExpression extends BinaryExpression public Object evaluate(Filterable message) { - Object lvalue = left.evaluate(message); + Object lvalue = getLeft().evaluate(message); if (lvalue == null) { return null; } - Object rvalue = right.evaluate(message); + Object rvalue = getRight().evaluate(message); if (rvalue == null) { return null; diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java index 024257bea9..355630bb51 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/BinaryExpression.java @@ -25,8 +25,8 @@ package org.apache.qpid.server.filter; */ public abstract class BinaryExpression implements Expression { - protected Expression left; - protected Expression right; + private final Expression left; + private final Expression right; public BinaryExpression(Expression left, Expression right) { @@ -87,20 +87,4 @@ public abstract class BinaryExpression implements Expression */ public abstract String getExpressionSymbol(); - /** - * @param expression - */ - public void setRight(Expression expression) - { - right = expression; - } - - /** - * @param expression - */ - public void setLeft(Expression expression) - { - left = expression; - } - } diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java index d0d58004ab..b04197121c 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java @@ -150,7 +150,6 @@ public abstract class ComparisonExpression extends BinaryExpression implements B { return Boolean.FALSE; - // throw new RuntimeException("LIKE can only operate on String identifiers. LIKE attemped on: '" + rv.getClass()); } return likePattern.matcher((String) rv).matches() ? Boolean.TRUE : Boolean.FALSE; @@ -388,13 +387,13 @@ public abstract class ComparisonExpression extends BinaryExpression implements B public Object evaluate(Filterable message) { - Comparable lv = (Comparable) left.evaluate(message); + Comparable lv = (Comparable) getLeft().evaluate(message); if (lv == null) { return null; } - Comparable rv = (Comparable) right.evaluate(message); + Comparable rv = (Comparable) getRight().evaluate(message); if (rv == null) { return null; @@ -564,8 +563,8 @@ public abstract class ComparisonExpression extends BinaryExpression implements B public Object evaluate(Filterable message) { - Object lv = left.evaluate(message); - Object rv = right.evaluate(message); + Object lv = getLeft().evaluate(message); + Object rv = getRight().evaluate(message); // Iff one of the values is null if ((lv == null) ^ (rv == null)) diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java b/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java index 80379134c9..45cd3cb57e 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java @@ -34,6 +34,10 @@ public class FilterManagerFactory private final static Logger _logger = Logger.getLogger(FilterManagerFactory.class); + private FilterManagerFactory() + { + } + //fixme move to a common class so it can be refered to from client code. public static FilterManager createManager(FieldTable filters) throws AMQException diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java index fdba184da4..f867b4d4c5 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/LogicExpression.java @@ -66,14 +66,14 @@ public abstract class LogicExpression extends BinaryExpression implements Boolea public Object evaluate(Filterable message) { - Boolean lv = (Boolean) left.evaluate(message); + Boolean lv = (Boolean) getLeft().evaluate(message); // Can we do an OR shortcut?? if ((lv != null) && lv.booleanValue()) { return Boolean.TRUE; } - Boolean rv = (Boolean) right.evaluate(message); + Boolean rv = (Boolean) getRight().evaluate(message); return (rv == null) ? null : rv; } @@ -94,7 +94,7 @@ public abstract class LogicExpression extends BinaryExpression implements Boolea public Object evaluate(Filterable message) { - Boolean lv = (Boolean) left.evaluate(message); + Boolean lv = (Boolean) getLeft().evaluate(message); // Can we do an AND shortcut?? if (lv == null) @@ -107,7 +107,7 @@ public abstract class LogicExpression extends BinaryExpression implements Boolea return Boolean.FALSE; } - Boolean rv = (Boolean) right.evaluate(message); + Boolean rv = (Boolean) getRight().evaluate(message); return (rv == null) ? null : rv; } diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/UnaryExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/UnaryExpression.java index 11b06890f1..fdd651a046 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/UnaryExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/UnaryExpression.java @@ -38,7 +38,7 @@ public abstract class UnaryExpression implements Expression { private static final BigDecimal BD_LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE); - protected Expression right; + private Expression right; public static Expression createNegate(Expression left) { @@ -205,7 +205,7 @@ public abstract class UnaryExpression implements Expression public Object evaluate(Filterable message) { - Object rvalue = right.evaluate(message); + Object rvalue = getRight().evaluate(message); if (rvalue == null) { return null; @@ -240,7 +240,7 @@ public abstract class UnaryExpression implements Expression public Object evaluate(Filterable message) { - Object rvalue = right.evaluate(message); + Object rvalue = getRight().evaluate(message); if (rvalue == null) { return null; @@ -265,7 +265,7 @@ public abstract class UnaryExpression implements Expression public String toString() { StringBuffer answer = new StringBuffer(); - answer.append(right); + answer.append(getRight()); answer.append(" "); answer.append(getExpressionSymbol()); answer.append(" ( "); @@ -310,7 +310,7 @@ public abstract class UnaryExpression implements Expression public Object evaluate(Filterable message) { - Boolean lvalue = (Boolean) right.evaluate(message); + Boolean lvalue = (Boolean) getRight().evaluate(message); if (lvalue == null) { return null; @@ -334,7 +334,7 @@ public abstract class UnaryExpression implements Expression public Object evaluate(Filterable message) { - Object rvalue = right.evaluate(message); + Object rvalue = getRight().evaluate(message); if (rvalue == null) { return null; @@ -350,7 +350,7 @@ public abstract class UnaryExpression implements Expression public String toString() { - return right.toString(); + return getRight().toString(); } public String getExpressionSymbol() diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/XPathExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/XPathExpression.java index 1e638ae6c2..ead385d1ba 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/XPathExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/XPathExpression.java @@ -22,7 +22,6 @@ package org.apache.qpid.server.filter; import org.apache.log4j.Logger; -import org.apache.qpid.AMQException; import org.apache.qpid.server.queue.Filterable; import java.lang.reflect.Constructor; @@ -94,19 +93,7 @@ public final class XPathExpression implements BooleanExpression { } public Object evaluate(Filterable message) { -// try { -//FIXME this is flow to disk work -// if( message.isDropped() ) -// return null; return evaluator.evaluate(message) ? Boolean.TRUE : Boolean.FALSE; -// } catch (IOException e) { -// -// JMSException exception = new JMSException(e.getMessage()); -// exception.initCause(e); -// throw exception; -// -// } - } public String toString() { @@ -116,7 +103,6 @@ public final class XPathExpression implements BooleanExpression { /** * @param message * @return true if the expression evaluates to Boolean.TRUE. - * @throws AMQException */ public boolean matches(Filterable message) { diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/XQueryExpression.java b/java/broker/src/main/java/org/apache/qpid/server/filter/XQueryExpression.java index ae22f17413..c16684ce64 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/XQueryExpression.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/XQueryExpression.java @@ -17,7 +17,6 @@ */ package org.apache.qpid.server.filter; -import org.apache.qpid.AMQException; import org.apache.qpid.server.queue.Filterable; // @@ -46,7 +45,6 @@ public final class XQueryExpression implements BooleanExpression { /** * @param message * @return true if the expression evaluates to Boolean.TRUE. - * @throws AMQException */ public boolean matches(Filterable message) { diff --git a/java/broker/src/main/java/org/apache/qpid/server/filter/XalanXPathEvaluator.java b/java/broker/src/main/java/org/apache/qpid/server/filter/XalanXPathEvaluator.java index ebab3a5386..ab85cb1b55 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/filter/XalanXPathEvaluator.java +++ b/java/broker/src/main/java/org/apache/qpid/server/filter/XalanXPathEvaluator.java @@ -45,18 +45,6 @@ public class XalanXPathEvaluator implements XPathExpression.XPathEvaluator { { // TODO - we would have to check the content type and then evaluate the content // here... is this really a feature we wish to implement? - RobG - /* - - if( m instanceof TextMessage ) { - String text = ((TextMessage)m).getText(); - return evaluate(text); - } else if ( m instanceof BytesMessage ) { - BytesMessage bm = (BytesMessage) m; - byte data[] = new byte[(int) bm.getBodyLength()]; - bm.readBytes(data); - return evaluate(data); - } - */ return false; } diff --git a/java/broker/src/main/java/org/apache/qpid/server/flow/CreditCreditManager.java b/java/broker/src/main/java/org/apache/qpid/server/flow/CreditCreditManager.java index c6771177ac..ce10c40244 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/flow/CreditCreditManager.java +++ b/java/broker/src/main/java/org/apache/qpid/server/flow/CreditCreditManager.java @@ -67,9 +67,6 @@ public class CreditCreditManager extends AbstractFlowCreditManager implements Fl public synchronized void restoreCredit(final long messageCredit, final long bytesCredit) { - /*_bytesCredit = 0l; - _messageCredit = 0l; - setSuspended(true);*/ } @@ -138,7 +135,6 @@ public class CreditCreditManager extends AbstractFlowCreditManager implements Fl } else { - //setSuspended(true); return false; } } @@ -158,7 +154,6 @@ public class CreditCreditManager extends AbstractFlowCreditManager implements Fl } else { - //setSuspended(true); return false; } diff --git a/java/broker/src/main/java/org/apache/qpid/server/flow/Pre0_10CreditManager.java b/java/broker/src/main/java/org/apache/qpid/server/flow/Pre0_10CreditManager.java index a193f8fae4..fc2d4bfb53 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/flow/Pre0_10CreditManager.java +++ b/java/broker/src/main/java/org/apache/qpid/server/flow/Pre0_10CreditManager.java @@ -155,7 +155,6 @@ public class Pre0_10CreditManager extends AbstractFlowCreditManager implements F } else { - //setSuspended(true); return false; } } @@ -183,7 +182,6 @@ public class Pre0_10CreditManager extends AbstractFlowCreditManager implements F } else { - //setSuspended(true); return false; } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/flow/WindowCreditManager.java b/java/broker/src/main/java/org/apache/qpid/server/flow/WindowCreditManager.java index a0c2e9f977..2215c7bb3d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/flow/WindowCreditManager.java +++ b/java/broker/src/main/java/org/apache/qpid/server/flow/WindowCreditManager.java @@ -144,7 +144,6 @@ public class WindowCreditManager extends AbstractFlowCreditManager implements Fl } else { - //setSuspended(true); return false; } } @@ -164,7 +163,6 @@ public class WindowCreditManager extends AbstractFlowCreditManager implements Fl } else { - //setSuspended(true); return false; } diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java index 321903b920..db312cc8bc 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java +++ b/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeclareHandler.java @@ -57,9 +57,7 @@ public class QueueDeclareHandler implements StateAwareMethodListener<QueueDeclar return _instance; } - public boolean autoRegister = ApplicationRegistry.getInstance().getConfiguration().getQueueAutoRegister(); - - private final AtomicInteger _counter = new AtomicInteger(); + private boolean autoRegister = ApplicationRegistry.getInstance().getConfiguration().getQueueAutoRegister(); public void methodReceived(AMQStateManager stateManager, QueueDeclareBody body, int channelId) throws AMQException { diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/actors/AbstractActor.java b/java/broker/src/main/java/org/apache/qpid/server/logging/actors/AbstractActor.java index e0bf180cc4..e8c6c9c323 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/actors/AbstractActor.java +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/actors/AbstractActor.java @@ -27,9 +27,9 @@ import org.apache.qpid.server.logging.RootMessageLogger; public abstract class AbstractActor implements LogActor { - public final String _msgPrefix = System.getProperty("qpid.logging.prefix",""); + private final String _msgPrefix = System.getProperty("qpid.logging.prefix",""); - protected RootMessageLogger _rootLogger; + private RootMessageLogger _rootLogger; public AbstractActor(RootMessageLogger rootLogger) { diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/actors/CurrentActor.java b/java/broker/src/main/java/org/apache/qpid/server/logging/actors/CurrentActor.java index 2ebbfeb734..feacf35d41 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/actors/CurrentActor.java +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/actors/CurrentActor.java @@ -68,6 +68,10 @@ public class CurrentActor private static LogActor _defaultActor; + private CurrentActor() + { + } + /** * Set a new {@link LogActor} to be the Current Actor * <p/> diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java b/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java index 885b039e18..859d7e2a27 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java @@ -36,8 +36,7 @@ public class ChannelLogSubject extends AbstractLogSubject /** * LOG FORMAT used by the AMQPConnectorActor follows - * ChannelLogSubject.CHANNEL_FORMAT : - * con:{0}({1}@{2}/{3})/ch:{4} + * ChannelLogSubject.CHANNEL_FORMAT : con:{0}({1}@{2}/{3})/ch:{4}. * * Uses a MessageFormat call to insert the required values according to * these indices: @@ -60,8 +59,7 @@ public class ChannelLogSubject extends AbstractLogSubject { /** * LOG FORMAT used by the AMQPConnectorActor follows - * ChannelLogSubject.CHANNEL_FORMAT : - * con:{0}({1}@{2}/{3})/ch:{4} + * ChannelLogSubject.CHANNEL_FORMAT : con:{0}({1}@{2}/{3})/ch:{4}. * * Uses a MessageFormat call to insert the required values according to * these indices: diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java b/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java index ff2bb90140..28c4f0d52a 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java @@ -32,7 +32,10 @@ package org.apache.qpid.server.logging.subjects; public class LogSubjectFormat { - + private LogSubjectFormat() + { + } + /** * LOG FORMAT for the Subscription Log Subject * 0 - Subscription ID diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java index 3be28036aa..89b74f939d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java @@ -50,6 +50,10 @@ class MBeanIntrospector { private static final String _defaultConstructorDescription = "MBean constructor"; private static final String _defaultMbeanDescription = "Management interface of the MBean"; + private MBeanIntrospector() + { + } + /** * Introspects the management interface class for MBean attributes. * @param interfaceClass @@ -347,7 +351,6 @@ class MBeanIntrospector { for (Constructor cons : implClass.getConstructors()) { MBeanConstructorInfo constructorInfo = getMBeanConstructorInfo(cons); - //MBeanConstructorInfo constructorInfo = new MBeanConstructorInfo("desc", cons); if (constructorInfo != null) { constructors.add(constructorInfo); @@ -375,9 +378,6 @@ class MBeanIntrospector { } } - //MBeanParameterInfo[] paramsInfo = getParametersInfo(cons.getParameterAnnotations(), - // cons.getParameterTypes()); - return new MBeanConstructorInfo(cons.getName(), desc, null); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java index d85c802fda..2aeef1c2a4 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java @@ -339,7 +339,7 @@ public class MBeanInvocationHandlerImpl implements InvocationHandler, Notificati // Normally JMXManagedObjectRegistry provides a Map as handback data containing a map // between connection id and username. String user = null; - if (handback != null && handback instanceof Map) + if (handback instanceof Map) { final Map<String, String> connectionIdUsernameMap = (Map<String, String>) handback; user = connectionIdUsernameMap.get(connectionId); diff --git a/java/broker/src/main/java/org/apache/qpid/server/output/HeaderPropertiesConverter.java b/java/broker/src/main/java/org/apache/qpid/server/output/HeaderPropertiesConverter.java index c6f8cac779..72d14456ed 100755 --- a/java/broker/src/main/java/org/apache/qpid/server/output/HeaderPropertiesConverter.java +++ b/java/broker/src/main/java/org/apache/qpid/server/output/HeaderPropertiesConverter.java @@ -39,6 +39,9 @@ import java.util.Map; public class HeaderPropertiesConverter { + private HeaderPropertiesConverter() + { + } public static BasicContentHeaderProperties convert(MessageTransferMessage messageTransferMessage, VirtualHost vhost) { diff --git a/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverterRegistry.java b/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverterRegistry.java index d11d03ea3d..5d1ae48535 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverterRegistry.java +++ b/java/broker/src/main/java/org/apache/qpid/server/output/ProtocolOutputConverterRegistry.java @@ -47,6 +47,10 @@ public class ProtocolOutputConverterRegistry register(ProtocolVersion.v0_91, org.apache.qpid.server.output.amqp0_9_1.ProtocolOutputConverterImpl.getInstanceFactory());
}
+ private ProtocolOutputConverterRegistry()
+ {
+ }
+
private static void register(ProtocolVersion version, Factory converter)
{
diff --git a/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java b/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java index b2728be856..f90afa0be9 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java @@ -240,7 +240,7 @@ public class ProtocolOutputConverterImpl implements ProtocolOutputConverter final AMQBody returnBlock = new AMQBody() { - public AMQBody _underlyingBody; + private AMQBody _underlyingBody; public AMQBody createAMQBody() { diff --git a/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java b/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java index 054d8b98e8..8bee368b80 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java @@ -237,7 +237,7 @@ public class ProtocolOutputConverterImpl implements ProtocolOutputConverter final AMQBody returnBlock = new AMQBody() { - public AMQBody _underlyingBody; + private AMQBody _underlyingBody; public AMQBody createAMQBody() { diff --git a/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9_1/ProtocolOutputConverterImpl.java b/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9_1/ProtocolOutputConverterImpl.java index cf097fa923..8d49481c25 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9_1/ProtocolOutputConverterImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9_1/ProtocolOutputConverterImpl.java @@ -244,7 +244,7 @@ public class ProtocolOutputConverterImpl implements ProtocolOutputConverter final AMQBody returnBlock = new AMQBody() { - public AMQBody _underlyingBody; + private AMQBody _underlyingBody; public AMQBody createAMQBody() { diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java index 251c3dd0cd..4908121f45 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java +++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java @@ -119,7 +119,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, Managable, AMQPr private Object _lastSent; - protected volatile boolean _closed; + private volatile boolean _closed; // maximum number of channels this session should have private long _maxNoOfChannels = ApplicationRegistry.getInstance().getConfiguration().getMaxChannelCount(); @@ -721,7 +721,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, Managable, AMQPr // However, due to the poor exception handling on the client. The client-user will be notified of the // InvalidArgument and if they then decide to close the session/connection then the there will be time // for that to occur i.e. a new close method be sent before the exeption handling can mark the session closed. - //removeChannel(channelId); + _closingChannelsList.remove(channelId); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java index 2f4becc129..105aa1f260 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java @@ -22,7 +22,7 @@ * * Copyright (c) 2006 The Apache Software Foundation * - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQPriorityQueue.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQPriorityQueue.java index b51c41f2a8..f6bf6626a0 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQPriorityQueue.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQPriorityQueue.java @@ -40,6 +40,6 @@ public class AMQPriorityQueue extends OutOfOrderQueue public int getPriorities() { - return ((PriorityQueueList) _entries).getPriorities(); + return ((PriorityQueueList) getEntries()).getPriorities(); } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java index d3b1c18ef3..aca5891d2e 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java @@ -49,6 +49,10 @@ public class AMQQueueFactory public static final String X_QPID_MAXIMUM_DELIVERY_COUNT = "x-qpid-maximum-delivery-count"; public static final String DEFAULT_DLQ_NAME_SUFFIX = "_DLQ"; + private AMQQueueFactory() + { + } + private abstract static class QueueProperty { diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/ConflationQueue.java b/java/broker/src/main/java/org/apache/qpid/server/queue/ConflationQueue.java index b5293f51be..2c645cc555 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/ConflationQueue.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/ConflationQueue.java @@ -41,7 +41,7 @@ public class ConflationQueue extends SimpleAMQQueue public String getConflationKey() { - return ((ConflationQueueList) _entries).getConflationKey(); + return ((ConflationQueueList) getEntries()).getConflationKey(); } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java b/java/broker/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java index cb34f69ff8..53121fc031 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java @@ -20,7 +20,7 @@ public abstract class OutOfOrderQueue extends SimpleAMQQueue protected void checkSubscriptionsNotAheadOfDelivery(final QueueEntry entry) { // check that all subscriptions are not in advance of the entry - SubscriptionList.SubscriptionNodeIterator subIter = _subscriptionList.iterator(); + SubscriptionList.SubscriptionNodeIterator subIter = getSubscriptionList().iterator(); while(subIter.advance() && !entry.isAcquired()) { final Subscription subscription = subIter.getNode().getSubscription(); diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java b/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java index a6518e857f..c4df3dd092 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java @@ -100,13 +100,10 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes private Exchange _alternateExchange; - /** Used to track bindings to exchanges so that on deletion they can easily be cancelled. */ - - - protected final QueueEntryList _entries; + private final QueueEntryList _entries; - protected final SubscriptionList _subscriptionList = new SubscriptionList(); + private final SubscriptionList _subscriptionList = new SubscriptionList(); private volatile Subscription _exclusiveSubscriber; @@ -138,19 +135,19 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes private final AtomicInteger _bindingCountHigh = new AtomicInteger(); /** max allowed size(KB) of a single message */ - public long _maximumMessageSize = ApplicationRegistry.getInstance().getConfiguration().getMaximumMessageSize(); + private long _maximumMessageSize = ApplicationRegistry.getInstance().getConfiguration().getMaximumMessageSize(); /** max allowed number of messages on a queue. */ - public long _maximumMessageCount = ApplicationRegistry.getInstance().getConfiguration().getMaximumMessageCount(); + private long _maximumMessageCount = ApplicationRegistry.getInstance().getConfiguration().getMaximumMessageCount(); /** max queue depth for the queue */ - public long _maximumQueueDepth = ApplicationRegistry.getInstance().getConfiguration().getMaximumQueueDepth(); + private long _maximumQueueDepth = ApplicationRegistry.getInstance().getConfiguration().getMaximumQueueDepth(); /** maximum message age before alerts occur */ - public long _maximumMessageAge = ApplicationRegistry.getInstance().getConfiguration().getMaximumMessageAge(); + private long _maximumMessageAge = ApplicationRegistry.getInstance().getConfiguration().getMaximumMessageAge(); /** the minimum interval between sending out consecutive alerts of the same type */ - public long _minimumAlertRepeatGap = ApplicationRegistry.getInstance().getConfiguration().getMinimumAlertRepeatGap(); + private long _minimumAlertRepeatGap = ApplicationRegistry.getInstance().getConfiguration().getMinimumAlertRepeatGap(); private long _capacity = ApplicationRegistry.getInstance().getConfiguration().getCapacity(); @@ -1075,6 +1072,17 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes return _stateChangeCount.get(); } + /** Used to track bindings to exchanges so that on deletion they can easily be cancelled. */ + protected QueueEntryList getEntries() + { + return _entries; + } + + protected SubscriptionList getSubscriptionList() + { + return _subscriptionList; + } + public static interface QueueEntryFilter { @@ -1676,7 +1684,6 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes public void deliverAsync(Subscription sub) { - //_stateChangeCount.incrementAndGet(); if(_exclusiveSubscriber == null) { deliverAsync(); @@ -2215,8 +2222,7 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes public boolean equals(Object o) { - return o != null - && o instanceof SimpleAMQQueue.QueueEntryListener + return o instanceof SimpleAMQQueue.QueueEntryListener && _sub == ((QueueEntryListener) o)._sub; } diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/SortedQueueEntryList.java b/java/broker/src/main/java/org/apache/qpid/server/queue/SortedQueueEntryList.java index 41a87a4c31..7f742d455d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/SortedQueueEntryList.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/SortedQueueEntryList.java @@ -362,7 +362,7 @@ public class SortedQueueEntryList implements QueueEntryList<SortedQueueEntryImpl if(chosenChild != null) { - // we have one child (x), we can move it up to replace x; + // we have one child (x), we can move it up to replace x chosenChild.setParent(entry.getParent()); if(chosenChild.getParent() == null) { diff --git a/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java b/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java index f6c766d73f..99a80ddff8 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java +++ b/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java @@ -429,57 +429,71 @@ public abstract class ApplicationRegistry implements IApplicationRegistry { _reportingTimer = new Timer("Statistics-Reporting", true); - class StatisticsReportingTask extends TimerTask + + + _reportingTimer.scheduleAtFixedRate(new StatisticsReportingTask(broker, virtualhost, reset), + report / 2, + report); + } + } + + private class StatisticsReportingTask extends TimerTask + { + private final int DELIVERED = 0; + private final int RECEIVED = 1; + + private boolean _broker; + private boolean _virtualhost; + private boolean _reset; + + + public StatisticsReportingTask(boolean broker, boolean virtualhost, boolean reset) + { + _broker = broker; + _virtualhost = virtualhost; + _reset = reset; + } + + public void run() + { + CurrentActor.set(new AbstractActor(ApplicationRegistry.getInstance().getRootMessageLogger()) { + public String getLogMessage() + { + return "[" + Thread.currentThread().getName() + "] "; + } + }); + + if (_broker) + { + CurrentActor.get().message(BrokerMessages.STATS_DATA(DELIVERED, _dataDelivered.getPeak() / 1024.0, _dataDelivered.getTotal())); + CurrentActor.get().message(BrokerMessages.STATS_MSGS(DELIVERED, _messagesDelivered.getPeak(), _messagesDelivered.getTotal())); + CurrentActor.get().message(BrokerMessages.STATS_DATA(RECEIVED, _dataReceived.getPeak() / 1024.0, _dataReceived.getTotal())); + CurrentActor.get().message(BrokerMessages.STATS_MSGS(RECEIVED, _messagesReceived.getPeak(), _messagesReceived.getTotal())); + } + + if (_virtualhost) { - private final int DELIVERED = 0; - private final int RECEIVED = 1; - - public void run() + for (VirtualHost vhost : getVirtualHostRegistry().getVirtualHosts()) { - CurrentActor.set(new AbstractActor(ApplicationRegistry.getInstance().getRootMessageLogger()) { - public String getLogMessage() - { - return "[" + Thread.currentThread().getName() + "] "; - } - }); - - if (broker) - { - CurrentActor.get().message(BrokerMessages.STATS_DATA(DELIVERED, _dataDelivered.getPeak() / 1024.0, _dataDelivered.getTotal())); - CurrentActor.get().message(BrokerMessages.STATS_MSGS(DELIVERED, _messagesDelivered.getPeak(), _messagesDelivered.getTotal())); - CurrentActor.get().message(BrokerMessages.STATS_DATA(RECEIVED, _dataReceived.getPeak() / 1024.0, _dataReceived.getTotal())); - CurrentActor.get().message(BrokerMessages.STATS_MSGS(RECEIVED, _messagesReceived.getPeak(), _messagesReceived.getTotal())); - } - - if (virtualhost) - { - for (VirtualHost vhost : getVirtualHostRegistry().getVirtualHosts()) - { - String name = vhost.getName(); - StatisticsCounter dataDelivered = vhost.getDataDeliveryStatistics(); - StatisticsCounter messagesDelivered = vhost.getMessageDeliveryStatistics(); - StatisticsCounter dataReceived = vhost.getDataReceiptStatistics(); - StatisticsCounter messagesReceived = vhost.getMessageReceiptStatistics(); - - CurrentActor.get().message(VirtualHostMessages.STATS_DATA(name, DELIVERED, dataDelivered.getPeak() / 1024.0, dataDelivered.getTotal())); - CurrentActor.get().message(VirtualHostMessages.STATS_MSGS(name, DELIVERED, messagesDelivered.getPeak(), messagesDelivered.getTotal())); - CurrentActor.get().message(VirtualHostMessages.STATS_DATA(name, RECEIVED, dataReceived.getPeak() / 1024.0, dataReceived.getTotal())); - CurrentActor.get().message(VirtualHostMessages.STATS_MSGS(name, RECEIVED, messagesReceived.getPeak(), messagesReceived.getTotal())); - } - } - - if (reset) - { - resetStatistics(); - } - - CurrentActor.remove(); + String name = vhost.getName(); + StatisticsCounter dataDelivered = vhost.getDataDeliveryStatistics(); + StatisticsCounter messagesDelivered = vhost.getMessageDeliveryStatistics(); + StatisticsCounter dataReceived = vhost.getDataReceiptStatistics(); + StatisticsCounter messagesReceived = vhost.getMessageReceiptStatistics(); + + CurrentActor.get().message(VirtualHostMessages.STATS_DATA(name, DELIVERED, dataDelivered.getPeak() / 1024.0, dataDelivered.getTotal())); + CurrentActor.get().message(VirtualHostMessages.STATS_MSGS(name, DELIVERED, messagesDelivered.getPeak(), messagesDelivered.getTotal())); + CurrentActor.get().message(VirtualHostMessages.STATS_DATA(name, RECEIVED, dataReceived.getPeak() / 1024.0, dataReceived.getTotal())); + CurrentActor.get().message(VirtualHostMessages.STATS_MSGS(name, RECEIVED, messagesReceived.getPeak(), messagesReceived.getTotal())); } } - _reportingTimer.scheduleAtFixedRate(new StatisticsReportingTask(), - report / 2, - report); + if (_reset) + { + resetStatistics(); + } + + CurrentActor.remove(); } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/AbstractProxyPlugin.java b/java/broker/src/main/java/org/apache/qpid/server/security/AbstractProxyPlugin.java index 68b1fa6500..236931e8cd 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/AbstractProxyPlugin.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/AbstractProxyPlugin.java @@ -20,8 +20,6 @@ */ package org.apache.qpid.server.security; -import org.apache.commons.configuration.Configuration; - import org.apache.qpid.server.security.access.ObjectProperties; import org.apache.qpid.server.security.access.ObjectType; import org.apache.qpid.server.security.access.Operation; @@ -29,8 +27,6 @@ import org.apache.qpid.server.security.access.Operation; /** * This {@link SecurityPlugin} proxies the authorise calls to a serries of methods, one per {@link Operation}. * - * Plugins that extend this class should override the relevant authorise method and implement their own - * {@link #setConfiguration(Configuration)} method. */ public abstract class AbstractProxyPlugin extends AbstractPlugin { diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/AuthorizationHolder.java b/java/broker/src/main/java/org/apache/qpid/server/security/AuthorizationHolder.java index 44bf60ea15..8f3bdf7738 100755 --- a/java/broker/src/main/java/org/apache/qpid/server/security/AuthorizationHolder.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/AuthorizationHolder.java @@ -20,9 +20,6 @@ */ package org.apache.qpid.server.security; -import org.apache.qpid.server.security.auth.sasl.GroupPrincipal; -import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal; - import javax.security.auth.Subject; import java.security.Principal; @@ -34,8 +31,8 @@ public interface AuthorizationHolder { /** * Returns the {@link Subject} of the authorized user. This is guaranteed to - * contain at least one {@link UsernamePrincipal}, representing the the identity - * used when the user logged on to the application, and zero or more {@link GroupPrincipal} + * contain at least one {@link org.apache.qpid.server.security.auth.sasl.UsernamePrincipal}, representing the the identity + * used when the user logged on to the application, and zero or more {@link org.apache.qpid.server.security.auth.sasl.GroupPrincipal} * representing the group(s) to which the user belongs. * * @return the Subject diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/SecurityManager.java b/java/broker/src/main/java/org/apache/qpid/server/security/SecurityManager.java index 18c975cd04..436660cfaf 100755 --- a/java/broker/src/main/java/org/apache/qpid/server/security/SecurityManager.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/SecurityManager.java @@ -45,7 +45,6 @@ import static org.apache.qpid.server.security.access.Operation.UNBIND; import javax.security.auth.Subject; import java.net.SocketAddress; -import java.security.Principal; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -66,7 +65,7 @@ public class SecurityManager { private static final Logger _logger = Logger.getLogger(SecurityManager.class); - /** Container for the {@link Principal} that is using to this thread. */ + /** Container for the {@link java.security.Principal} that is using to this thread. */ private static final ThreadLocal<Subject> _subject = new ThreadLocal<Subject>(); private static final ThreadLocal<Boolean> _accessChecksDisabled = new ThreadLocal<Boolean>() { @@ -106,7 +105,7 @@ public class SecurityManager public void validateConfiguration() throws ConfigurationException { - if (_configuration.isEmpty()) + if (getConfig().isEmpty()) { throw new ConfigurationException("security section is incomplete, no elements found."); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/AllowAll.java b/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/AllowAll.java index 006a7813e0..8260e8d91e 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/AllowAll.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/AllowAll.java @@ -55,10 +55,6 @@ public class AllowAll extends BasicPlugin public void validateConfiguration() throws ConfigurationException { -// if (!_configuration.isEmpty()) -// { -// throw new ConfigurationException("allow-all section takes no elements."); -// } } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/BasicPlugin.java b/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/BasicPlugin.java index 0c3d5b6f9a..4df135a4ca 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/BasicPlugin.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/BasicPlugin.java @@ -22,13 +22,12 @@ package org.apache.qpid.server.security.access.plugins; import org.apache.qpid.server.security.AbstractPlugin; import org.apache.qpid.server.security.Result; -import org.apache.qpid.server.security.SecurityPlugin; import org.apache.qpid.server.security.access.ObjectProperties; import org.apache.qpid.server.security.access.ObjectType; import org.apache.qpid.server.security.access.Operation; /** - * This {@link SecurityPlugin} simply abstains from all authorisation requests and ignores configuration. + * This {@link org.apache.qpid.server.security.SecurityPlugin} simply abstains from all authorisation requests and ignores configuration. */ public abstract class BasicPlugin extends AbstractPlugin { diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/DenyAll.java b/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/DenyAll.java index e9d0170968..6d28699832 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/DenyAll.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/DenyAll.java @@ -55,7 +55,7 @@ public class DenyAll extends BasicPlugin public void validateConfiguration() throws ConfigurationException { - if (!_configuration.isEmpty()) + if (!getConfig().isEmpty()) { throw new ConfigurationException("deny-all section takes no elements."); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java index 8c2d60a660..949c0f2b89 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java @@ -53,8 +53,8 @@ public class AuthenticationResult ERROR } - public final AuthenticationStatus _status; - public final byte[] _challenge; + private final AuthenticationStatus _status; + private final byte[] _challenge; private final Exception _cause; private final Subject _subject; diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java index fcd64f3a23..52ddc092b5 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java @@ -86,15 +86,6 @@ public class Base64MD5PasswordFilePrincipalDatabase implements PrincipalDatabase _saslServers.put(cramHex.getMechanismName(), cramHex); //fixme The PDs should setup a PD Mangement MBean -// try -// { -// _mbean = new AMQUserManagementMBean(); -// _mbean.setPrincipalDatabase(this); -// } -// catch (JMException e) -// { -// _logger.warn("User management disabled as unable to create MBean:" + e); -// } } public void setPasswordFile(String passwordFile) throws IOException diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java index e434fa62b1..4ffa5a4bc2 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java @@ -24,7 +24,6 @@ import org.apache.qpid.common.Closeable; import org.apache.qpid.server.plugins.Plugin; import org.apache.qpid.server.security.auth.AuthenticationResult; -import javax.security.auth.Subject; import javax.security.sasl.SaslException; import javax.security.sasl.SaslServer; @@ -33,7 +32,7 @@ import javax.security.sasl.SaslServer; * the authenticity of a user's credentials. * * If the authentication is successful, the manager is responsible for producing a populated - * {@link Subject} containing the user's identity and zero or more principals representing + * {@link javax.security.auth.Subject} containing the user's identity and zero or more principals representing * groups to which the user belongs. * <p> * The {@link #initialise()} method is responsible for registering SASL mechanisms required by diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java index 739fc414c6..3fa0de2af0 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java @@ -95,9 +95,9 @@ public class PrincipalDatabaseAuthenticationManager implements AuthenticationMan */ private final Map<String, Map<String, ?>> _serverCreationProperties = new HashMap<String, Map<String, ?>>(); - protected PrincipalDatabase _principalDatabase = null; + private PrincipalDatabase _principalDatabase = null; - protected AMQUserManagementMBean _mbean = null; + private AMQUserManagementMBean _mbean = null; public static final AuthenticationManagerPluginFactory<PrincipalDatabaseAuthenticationManager> FACTORY = new AuthenticationManagerPluginFactory<PrincipalDatabaseAuthenticationManager>() { @@ -160,13 +160,13 @@ public class PrincipalDatabaseAuthenticationManager implements AuthenticationMan public String getPrincipalDatabaseClass() { - return _configuration.getString("principal-database.class"); + return getConfig().getString("principal-database.class"); } public Map<String,String> getPdClassAttributeMap() throws ConfigurationException { - final List<String> argumentNames = _configuration.getList("principal-database.attributes.attribute.name"); - final List<String> argumentValues = _configuration.getList("principal-database.attributes.attribute.value"); + final List<String> argumentNames = getConfig().getList("principal-database.attributes.attribute.name"); + final List<String> argumentValues = getConfig().getList("principal-database.attributes.attribute.value"); final Map<String,String> attributes = new HashMap<String,String>(argumentNames.size()); for (int i = 0; i < argumentNames.size(); i++) diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServer.java b/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServer.java index e77bf7c24f..c1f306dce9 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServer.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/plain/PlainSaslServer.java @@ -65,7 +65,6 @@ public class PlainSaslServer implements SaslServer } // we do not currently support authcid in any meaningful way - // String authcid = new String(response, 0, authzidNullPosition, "utf8"); String authzid = new String(response, authzidNullPosition + 1, authcidNullPosition - authzidNullPosition - 1, "utf8"); // TODO: should not get pwd as a String but as a char array... diff --git a/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java b/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java index 8d662863ca..f97b77a4fe 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java +++ b/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java @@ -50,16 +50,6 @@ public class AMQStateManager implements AMQMethodListener /** The current state */ private AMQState _currentState; - /** - * Maps from an AMQState instance to a Map from Class to StateTransitionHandler. The class must be a subclass of - * AMQFrame. - */ -/* private final EnumMap<AMQState, Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>> _state2HandlersMap = - new EnumMap<AMQState, Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>>( - AMQState.class); - */ - - private CopyOnWriteArraySet<StateListener> _stateListeners = new CopyOnWriteArraySet<StateListener>(); public AMQStateManager(VirtualHostRegistry virtualHostRegistry, AMQProtocolSession protocolSession) @@ -71,64 +61,6 @@ public class AMQStateManager implements AMQMethodListener } - /* - protected void registerListeners() - { - Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>> frame2handlerMap; - - frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>(); - _state2HandlersMap.put(AMQState.CONNECTION_NOT_STARTED, frame2handlerMap); - - frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>(); - _state2HandlersMap.put(AMQState.CONNECTION_NOT_AUTH, frame2handlerMap); - - frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>(); - _state2HandlersMap.put(AMQState.CONNECTION_NOT_TUNED, frame2handlerMap); - - frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>(); - frame2handlerMap.put(ConnectionOpenBody.class, ConnectionOpenMethodHandler.getInstance()); - _state2HandlersMap.put(AMQState.CONNECTION_NOT_OPENED, frame2handlerMap); - - // - // ConnectionOpen handlers - // - frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>(); - ChannelOpenHandler.getInstance(); - ChannelCloseHandler.getInstance(); - ChannelCloseOkHandler.getInstance(); - ConnectionCloseMethodHandler.getInstance(); - ConnectionCloseOkMethodHandler.getInstance(); - ConnectionTuneOkMethodHandler.getInstance(); - ConnectionSecureOkMethodHandler.getInstance(); - ConnectionStartOkMethodHandler.getInstance(); - ExchangeDeclareHandler.getInstance(); - ExchangeDeleteHandler.getInstance(); - ExchangeBoundHandler.getInstance(); - BasicAckMethodHandler.getInstance(); - BasicRecoverMethodHandler.getInstance(); - BasicConsumeMethodHandler.getInstance(); - BasicGetMethodHandler.getInstance(); - BasicCancelMethodHandler.getInstance(); - BasicPublishMethodHandler.getInstance(); - BasicQosHandler.getInstance(); - QueueBindHandler.getInstance(); - QueueDeclareHandler.getInstance(); - QueueDeleteHandler.getInstance(); - QueuePurgeHandler.getInstance(); - ChannelFlowHandler.getInstance(); - TxSelectHandler.getInstance(); - TxCommitHandler.getInstance(); - TxRollbackHandler.getInstance(); - BasicRejectMethodHandler.getInstance(); - - _state2HandlersMap.put(AMQState.CONNECTION_OPEN, frame2handlerMap); - - frame2handlerMap = new HashMap<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>(); - - _state2HandlersMap.put(AMQState.CONNECTION_CLOSING, frame2handlerMap); - - } */ - public AMQState getCurrentState() { return _currentState; @@ -189,30 +121,6 @@ public class AMQStateManager implements AMQMethodListener } } -/* - protected <B extends AMQMethodBody> StateAwareMethodListener<B> findStateTransitionHandler(AMQState currentState, - B frame) - // throws IllegalStateTransitionException - { - final Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>> classToHandlerMap = - _state2HandlersMap.get(currentState); - - final StateAwareMethodListener<B> handler = - (classToHandlerMap == null) ? null : (StateAwareMethodListener<B>) classToHandlerMap.get(frame.getClass()); - - if (handler == null) - { - _logger.debug("No state transition handler defined for receiving frame " + frame); - - return null; - } - else - { - return handler; - } - } -*/ - public void addStateListener(StateListener listener) { _logger.debug("Adding state listener"); diff --git a/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java b/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java index 465f8ecc7c..2877e25645 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java +++ b/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java @@ -1111,11 +1111,7 @@ public class DerbyMessageStore implements MessageStore, DurableConfigurationStor insertStmt.setString(3, routingKey == null ? null : routingKey.toString()); if(args != null) { - /* This would be the Java 6 way of setting a Blob - Blob blobArgs = conn.createBlob(); - blobArgs.setBytes(0, args.getDataAsBytes()); - stmt.setBlob(4, blobArgs); - */ + // TODO - In Java 6 we could use create/set Blob byte[] bytes = args.getDataAsBytes(); ByteArrayInputStream bis = new ByteArrayInputStream(bytes); insertStmt.setBinaryStream(4, bis, bytes.length); @@ -1713,7 +1709,7 @@ public class DerbyMessageStore implements MessageStore, DurableConfigurationStor if (_logger.isDebugEnabled()) { - _logger.debug("Dequeuing message " + messageId + " on queue " + name );//+ "[Connection" + conn + "]"); + _logger.debug("Dequeuing message " + messageId + " on queue " + name ); } } finally @@ -2032,11 +2028,8 @@ public class DerbyMessageStore implements MessageStore, DurableConfigurationStor stmt.setInt(3, offset+chunkData.length); - /* this would be the Java 6 way of doing things - Blob dataAsBlob = conn.createBlob(); - dataAsBlob.setBytes(1L, chunkData); - stmt.setBlob(3, dataAsBlob); - */ + // TODO in Java 6 we could just use blobs + ByteArrayInputStream bis = new ByteArrayInputStream(chunkData); stmt.setBinaryStream(4, bis, chunkData.length); stmt.executeUpdate(); diff --git a/java/broker/src/main/java/org/apache/qpid/server/subscription/ImplicitAcceptDispositionChangeListener.java b/java/broker/src/main/java/org/apache/qpid/server/subscription/ImplicitAcceptDispositionChangeListener.java index 95b0a40497..1e37675c98 100755 --- a/java/broker/src/main/java/org/apache/qpid/server/subscription/ImplicitAcceptDispositionChangeListener.java +++ b/java/broker/src/main/java/org/apache/qpid/server/subscription/ImplicitAcceptDispositionChangeListener.java @@ -72,8 +72,6 @@ class ImplicitAcceptDispositionChangeListener implements ServerSession.MessageDi public boolean acquire() { boolean acquired = _entry.acquire(getSubscription()); - //TODO - why acknowledge here??? seems bizarre... - // getSubscription().getSession().acknowledge(getSubscription(), _entry); return acquired; } diff --git a/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java b/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java index b84971d8c3..c410b822a5 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java @@ -490,7 +490,6 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage { _logger.debug("Subscription:" + this + " rejected message:" + entry); } -// return false; } if (_noLocal) @@ -585,7 +584,7 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage public boolean wouldSuspend(QueueEntry msg) { - return !_creditManager.useCreditForMessage(msg.getMessage().getSize());//_channel.wouldSuspend(msg.getMessage()); + return !_creditManager.useCreditForMessage(msg.getMessage().getSize()); } public boolean trySendLock() diff --git a/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java b/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java index 68ab4664c7..9a7d69b10d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java +++ b/java/broker/src/main/java/org/apache/qpid/server/subscription/Subscription_0_10.java @@ -559,36 +559,8 @@ public class Subscription_0_10 implements Subscription, FlowCreditManager.FlowCr messageProps.setCorrelationId(serverMsg.getMessageHeader().getCorrelationId().getBytes()); } - // TODO - ReplyTo - - final Map<String, Object> appHeaders = new HashMap<String, Object>(); - - /*properties.getHeaders().processOverElements( - new FieldTable.FieldTableElementProcessor() - { - - public boolean processElement(String propertyName, AMQTypedValue value) - { - Object val = value.getValue(); - if(val instanceof AMQShortString) - { - val = val.toString(); - } - appHeaders.put(propertyName, val); - return true; - } - - public Object getResult() - { - return appHeaders; - } - }); - - - messageProps.setApplicationHeaders(appHeaders); -*/ Header header = new Header(deliveryProps, messageProps, null); xfr = batch ? new MessageTransfer(_destination,_acceptMode,_acquireMode,header, body, BATCHED) : new MessageTransfer(_destination,_acceptMode,_acquireMode,header, body); diff --git a/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java b/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java index e90c8bafe1..7e6caf7979 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java +++ b/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSessionDelegate.java @@ -155,7 +155,12 @@ public class ServerSessionDelegate extends SessionDelegate @Override public void messageSubscribe(Session session, MessageSubscribe method) { - //TODO - work around broken Python tests + /* + TODO - work around broken Python tests + Correct code should read like + if not hasAcceptMode() exception ILLEGAL_ARGUMENT "Accept-mode not supplied" + else if not method.hasAcquireMode() exception ExecutionErrorCode.ILLEGAL_ARGUMENT, "Acquire-mode not supplied" + */ if(!method.hasAcceptMode()) { method.setAcceptMode(MessageAcceptMode.EXPLICIT); @@ -166,15 +171,7 @@ public class ServerSessionDelegate extends SessionDelegate } - /* if(!method.hasAcceptMode()) - { - exception(session,method,ExecutionErrorCode.ILLEGAL_ARGUMENT, "Accept-mode not supplied"); - } - else if(!method.hasAcquireMode()) - { - exception(session,method,ExecutionErrorCode.ILLEGAL_ARGUMENT, "Acquire-mode not supplied"); - } - else */if(!method.hasQueue()) + if(!method.hasQueue()) { exception(session,method,ExecutionErrorCode.ILLEGAL_ARGUMENT, "queue not supplied"); } @@ -711,15 +708,10 @@ public class ServerSessionDelegate extends SessionDelegate { exception(session, method, ExecutionErrorCode.INVALID_ARGUMENT, "Bind not allowed for default exchange"); } -/* - else if (!method.hasBindingKey()) - { - exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, "binding-key not set"); - } -*/ else { //TODO - here because of non-compiant python tests + // should raise exception ILLEGAL_ARGUMENT "binding-key not set" if (!method.hasBindingKey()) { method.setBindingKey(method.getQueue()); diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java index f365d33b34..266d23af97 100755 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java @@ -171,9 +171,6 @@ public class VirtualHostConfigRecoveryHandler implements ConfigurationRecoveryHa throw new RuntimeException("Unknown message type retrieved from store " + message.getMetaData().getClass()); } - //_logger.debug("Recovered message with id " + serverMessage); - - _recoveredMessages.put(message.getMessageNumber(), serverMessage); _unusedMessages.put(message.getMessageNumber(), message); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java index 82e41abb8d..51b60f7980 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java @@ -95,7 +95,7 @@ public class VirtualHostImpl implements VirtualHost private MessageStore _messageStore; - protected VirtualHostMBean _virtualHostMBean; + private VirtualHostMBean _virtualHostMBean; private AMQBrokerManagerMBean _brokerMBean; @@ -257,54 +257,9 @@ public class VirtualHostImpl implements VirtualHost { if (period != 0L) { - class VirtualHostHouseKeepingTask extends HouseKeepingTask - { - public VirtualHostHouseKeepingTask(VirtualHost vhost) - { - super(vhost); - } - public void execute() - { - for (AMQQueue q : _queueRegistry.getQueues()) - { - _logger.debug("Checking message status for queue: " - + q.getName()); - try - { - q.checkMessageStatus(); - } - catch (Exception e) - { - _logger.error("Exception in housekeeping for queue: " - + q.getNameShortString().toString(), e); - //Don't throw exceptions as this will stop the - // house keeping task from running. - } - } - for (AMQConnectionModel connection : getConnectionRegistry().getConnections()) - { - _logger.debug("Checking for long running open transactions on connection " + connection); - for (AMQSessionModel session : connection.getSessionModels()) - { - _logger.debug("Checking for long running open transactions on session " + session); - try - { - session.checkTransactionStatus(_configuration.getTransactionTimeoutOpenWarn(), - _configuration.getTransactionTimeoutOpenClose(), - _configuration.getTransactionTimeoutIdleWarn(), - _configuration.getTransactionTimeoutIdleClose()); - } - catch (Exception e) - { - _logger.error("Exception in housekeeping for connection: " + connection.toString(), e); - } - } - } - } - } - scheduleHouseKeepingTask(period, new VirtualHostHouseKeepingTask(this)); + scheduleHouseKeepingTask(period, new VirtualHostHouseKeepingTask()); Map<String, VirtualHostPluginFactory> plugins = ApplicationRegistry.getInstance().getPluginManager().getVirtualHostPlugins(); @@ -337,6 +292,53 @@ public class VirtualHostImpl implements VirtualHost } } + private class VirtualHostHouseKeepingTask extends HouseKeepingTask + { + public VirtualHostHouseKeepingTask() + { + super(VirtualHostImpl.this); + } + + public void execute() + { + for (AMQQueue q : _queueRegistry.getQueues()) + { + _logger.debug("Checking message status for queue: " + + q.getName()); + try + { + q.checkMessageStatus(); + } + catch (Exception e) + { + _logger.error("Exception in housekeeping for queue: " + + q.getNameShortString().toString(), e); + //Don't throw exceptions as this will stop the + // house keeping task from running. + } + } + for (AMQConnectionModel connection : getConnectionRegistry().getConnections()) + { + _logger.debug("Checking for long running open transactions on connection " + connection); + for (AMQSessionModel session : connection.getSessionModels()) + { + _logger.debug("Checking for long running open transactions on session " + session); + try + { + session.checkTransactionStatus(_configuration.getTransactionTimeoutOpenWarn(), + _configuration.getTransactionTimeoutOpenClose(), + _configuration.getTransactionTimeoutIdleWarn(), + _configuration.getTransactionTimeoutIdleClose()); + } + catch (Exception e) + { + _logger.error("Exception in housekeeping for connection: " + connection.toString(), e); + } + } + } + } + } + /** * Allow other broker components to register a HouseKeepingTask * @@ -791,11 +793,11 @@ public class VirtualHostImpl implements VirtualHost */ private static class StartupRoutingTable implements DurableConfigurationStore { - public List<Exchange> exchange = new LinkedList<Exchange>(); - public List<CreateQueueTuple> queue = new LinkedList<CreateQueueTuple>(); - public List<CreateBindingTuple> bindings = new LinkedList<CreateBindingTuple>(); - public List<BrokerLink> links = new LinkedList<BrokerLink>(); - public List<Bridge> bridges = new LinkedList<Bridge>(); + private List<Exchange> exchange = new LinkedList<Exchange>(); + private List<CreateQueueTuple> queue = new LinkedList<CreateQueueTuple>(); + private List<CreateBindingTuple> bindings = new LinkedList<CreateBindingTuple>(); + private List<BrokerLink> links = new LinkedList<BrokerLink>(); + private List<Bridge> bridges = new LinkedList<Bridge>(); public void configure(VirtualHost virtualHost, String base, VirtualHostConfiguration config) throws Exception { @@ -862,8 +864,8 @@ public class VirtualHostImpl implements VirtualHost private static class CreateQueueTuple { - public AMQQueue queue; - public FieldTable arguments; + private AMQQueue queue; + private FieldTable arguments; public CreateQueueTuple(AMQQueue queue, FieldTable arguments) { @@ -874,10 +876,10 @@ public class VirtualHostImpl implements VirtualHost private static class CreateBindingTuple { - public AMQQueue queue; - public FieldTable arguments; - public Exchange exchange; - public AMQShortString routingKey; + private AMQQueue queue; + private FieldTable arguments; + private Exchange exchange; + private AMQShortString routingKey; public CreateBindingTuple(Exchange exchange, AMQShortString routingKey, AMQQueue queue, FieldTable args) { diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/ConfiguredQueueBindingListener.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/ConfiguredQueueBindingListener.java index 520608f428..12886f400a 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/ConfiguredQueueBindingListener.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/ConfiguredQueueBindingListener.java @@ -30,7 +30,6 @@ import org.apache.qpid.server.queue.AMQQueue; import java.util.Collections; import java.util.HashSet; -import java.util.Iterator; import java.util.Set; /** @@ -93,7 +92,7 @@ public class ConfiguredQueueBindingListener implements BindingListener /** * Lookup and return the cache of configured {@link AMQQueue}s. * - * Note that when accessing the cached queues, the {@link Iterator} is not thread safe + * Note that when accessing the cached queues, the {@link java.util.Iterator} is not thread safe * (see the {@link Collections#synchronizedSet(Set)} documentation) so a copy of the * cache is returned. * diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/SlowConsumerDetection.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/SlowConsumerDetection.java index 68c5ae89ed..2c6705bb3b 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/SlowConsumerDetection.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/SlowConsumerDetection.java @@ -25,7 +25,6 @@ import org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfigu import org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionQueueConfiguration; import org.apache.qpid.server.exchange.ExchangeRegistry; import org.apache.qpid.server.logging.actors.CurrentActor; -import org.apache.qpid.server.plugins.Plugin; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.virtualhost.VirtualHost; import org.apache.qpid.server.virtualhost.plugins.logging.SlowConsumerDetectionMessages; @@ -61,7 +60,7 @@ public class SlowConsumerDetection extends VirtualHostHouseKeepingPlugin * virtual host to record all the configured queues in a cache for processing by the housekeeping * thread. * - * @see Plugin#configure(ConfigurationPlugin) + * @see org.apache.qpid.server.plugins.Plugin#configure(ConfigurationPlugin) */ public void configure(ConfigurationPlugin config) { @@ -98,7 +97,7 @@ public class SlowConsumerDetection extends VirtualHostHouseKeepingPlugin if (policy == null) { // We would only expect to see this during shutdown - _logger.warn("No slow consumer policy for queue " + q.getName()); + getLogger().warn("No slow consumer policy for queue " + q.getName()); } else { @@ -110,7 +109,7 @@ public class SlowConsumerDetection extends VirtualHostHouseKeepingPlugin catch (Exception e) { // Don't throw exceptions as this will stop the house keeping task from running. - _logger.error("Exception in SlowConsumersDetection for queue: " + q.getName(), e); + getLogger().error("Exception in SlowConsumersDetection for queue: " + q.getName(), e); } } @@ -139,9 +138,9 @@ public class SlowConsumerDetection extends VirtualHostHouseKeepingPlugin { if (config != null) { - if (_logger.isInfoEnabled()) + if (getLogger().isInfoEnabled()) { - _logger.info("Retrieved Queue(" + q.getName() + ") Config:" + config); + getLogger().info("Retrieved Queue(" + q.getName() + ") Config:" + config); } int count = q.getMessageCount(); @@ -157,12 +156,12 @@ public class SlowConsumerDetection extends VirtualHostHouseKeepingPlugin ((count > 0) && q.getOldestMessageArrivalTime() >= config.getMessageAge()))) { - if (_logger.isDebugEnabled()) + if (getLogger().isDebugEnabled()) { - _logger.debug("Detected Slow Consumer on Queue(" + q.getName() + ")"); - _logger.debug("Queue Count:" + q.getMessageCount() + ":" + config.getMessageCount()); - _logger.debug("Queue Depth:" + q.getQueueDepth() + ":" + config.getDepth()); - _logger.debug("Queue Arrival:" + q.getOldestMessageArrivalTime() + ":" + config.getMessageAge()); + getLogger().debug("Detected Slow Consumer on Queue(" + q.getName() + ")"); + getLogger().debug("Queue Count:" + q.getMessageCount() + ":" + config.getMessageCount()); + getLogger().debug("Queue Depth:" + q.getQueueDepth() + ":" + config.getDepth()); + getLogger().debug("Queue Arrival:" + q.getOldestMessageArrivalTime() + ":" + config.getMessageAge()); } return true; diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/VirtualHostHouseKeepingPlugin.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/VirtualHostHouseKeepingPlugin.java index 9d0cd07e47..191f8041d2 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/VirtualHostHouseKeepingPlugin.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/VirtualHostHouseKeepingPlugin.java @@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit; public abstract class VirtualHostHouseKeepingPlugin extends HouseKeepingTask implements VirtualHostPlugin { - protected final Logger _logger = Logger.getLogger(getClass()); + private final Logger _logger = Logger.getLogger(getClass()); public VirtualHostHouseKeepingPlugin(VirtualHost vhost) { @@ -52,4 +52,10 @@ public abstract class VirtualHostHouseKeepingPlugin extends HouseKeepingTask imp * @see java.util.concurrent.TimeUnit for valid value. */ public abstract TimeUnit getTimeUnit(); + + + protected Logger getLogger() + { + return _logger; + } } diff --git a/java/broker/src/main/java/org/apache/qpid/tools/security/Passwd.java b/java/broker/src/main/java/org/apache/qpid/tools/security/Passwd.java index 94bc3a899a..ae150708ca 100644 --- a/java/broker/src/main/java/org/apache/qpid/tools/security/Passwd.java +++ b/java/broker/src/main/java/org/apache/qpid/tools/security/Passwd.java @@ -30,6 +30,10 @@ import java.security.NoSuchAlgorithmException; public class Passwd { + private Passwd() + { + } + public static void main(String args[]) throws NoSuchAlgorithmException, DigestException, IOException { if (args.length != 2) |