diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2012-01-27 20:15:31 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2012-01-27 20:15:31 +0000 |
| commit | bb3fe508f98ec31109f951fb059ee49746a36d48 (patch) | |
| tree | 0d6e4351925947b2a9092723b6b0b4ddda64e2a4 /qpid/java | |
| parent | 41b4e58c9736967d2260755ac38793aea1ecce8f (diff) | |
| download | qpid-python-bb3fe508f98ec31109f951fb059ee49746a36d48.tar.gz | |
NO-JIRA: Encapsulate fields, use private members and accesors (keep checkstyle happy)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1236867 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
227 files changed, 2074 insertions, 1269 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java index d814401b8d..7e402e3320 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java @@ -80,21 +80,21 @@ public class BDBStoreUpgrade { private static final Logger _logger = LoggerFactory.getLogger(BDBStoreUpgrade.class); /** The Store Directory that needs upgrading */ - File _fromDir; + private File _fromDir; /** The Directory that will be made to contain the upgraded store */ - File _toDir; + private File _toDir; /** The Directory that will be made to backup the original store if required */ - File _backupDir; + private File _backupDir; /** The Old Store */ - BDBMessageStore _oldMessageStore; + private BDBMessageStore _oldMessageStore; /** The New Store */ - BDBMessageStore _newMessageStore; + private BDBMessageStore _newMessageStore; /** The file ending that is used by BDB Store Files */ private static final String BDB_FILE_ENDING = ".jdb"; static final Options _options = new Options(); - static CommandLine _commandLine; + private static CommandLine _commandLine; private boolean _interactive; private boolean _force; @@ -615,8 +615,8 @@ public class BDBStoreUpgrade DatabaseVisitor contentVisitor = new DatabaseVisitor() { - long _prevMsgId = -1; //Initialise to invalid value - int _bytesSeenSoFar = 0; + private long _prevMsgId = -1; //Initialise to invalid value + private int _bytesSeenSoFar = 0; public void visit(DatabaseEntry key, DatabaseEntry value) throws DatabaseException { diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java index 277e1188a6..3d30f02b42 100644 --- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java +++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java @@ -140,17 +140,17 @@ public class BDBMessageStoreTest extends org.apache.qpid.server.store.MessageSto assertEquals("Routing key has changed", pubInfoBody_0_8.getRoutingKey(), returnedPubBody_0_8.getRoutingKey()); ContentHeaderBody returnedHeaderBody_0_8 = returnedMMD_0_8.getContentHeaderBody(); - assertEquals("ContentHeader ClassID has changed", chb_0_8.classId, returnedHeaderBody_0_8.classId); - assertEquals("ContentHeader weight has changed", chb_0_8.weight, returnedHeaderBody_0_8.weight); - assertEquals("ContentHeader bodySize has changed", chb_0_8.bodySize, returnedHeaderBody_0_8.bodySize); + assertEquals("ContentHeader ClassID has changed", chb_0_8.getClassId(), returnedHeaderBody_0_8.getClassId()); + assertEquals("ContentHeader weight has changed", chb_0_8.getWeight(), returnedHeaderBody_0_8.getWeight()); + assertEquals("ContentHeader bodySize has changed", chb_0_8.getBodySize(), returnedHeaderBody_0_8.getBodySize()); BasicContentHeaderProperties returnedProperties_0_8 = (BasicContentHeaderProperties) returnedHeaderBody_0_8.getProperties(); assertEquals("Property ContentType has changed", props_0_8.getContentTypeAsString(), returnedProperties_0_8.getContentTypeAsString()); assertEquals("Property MessageID has changed", props_0_8.getMessageIdAsString(), returnedProperties_0_8.getMessageIdAsString()); - ByteBuffer recoveredContent_0_8 = ByteBuffer.allocate((int) chb_0_8.bodySize) ; + ByteBuffer recoveredContent_0_8 = ByteBuffer.allocate((int) chb_0_8.getBodySize()) ; long recoveredCount_0_8 = bdbStore.getContent(messageid_0_8, 0, recoveredContent_0_8); - assertEquals("Incorrect amount of payload data recovered", chb_0_8.bodySize, recoveredCount_0_8); + assertEquals("Incorrect amount of payload data recovered", chb_0_8.getBodySize(), recoveredCount_0_8); String returnedPayloadString_0_8 = new String(recoveredContent_0_8.array()); assertEquals("Message Payload has changed", bodyText, returnedPayloadString_0_8); diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java index 8481b29e46..227a34e888 100644 --- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java +++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java @@ -359,7 +359,7 @@ public class BDBUpgradeTest extends QpidBrokerTestCase System.setIn(new InputStream() { - int counter = 0; + private int counter = 0; public synchronized int read(byte b[], int off, int len) { diff --git a/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/AccessControl.java b/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/AccessControl.java index a97b66a287..d8a5bd4085 100644 --- a/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/AccessControl.java +++ b/qpid/java/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/plugins/AccessControl.java @@ -109,7 +109,7 @@ public class AccessControl extends AbstractPlugin { super.configure(config); - AccessControlConfiguration accessConfig = (AccessControlConfiguration) _config; + AccessControlConfiguration accessConfig = (AccessControlConfiguration) getConfig(); _ruleSet = accessConfig.getRuleSet(); } diff --git a/qpid/java/broker-plugins/experimental/info/src/main/java/org/apache/qpid/info/Activator.java b/qpid/java/broker-plugins/experimental/info/src/main/java/org/apache/qpid/info/Activator.java index b3e3d1676e..037fad0979 100644 --- a/qpid/java/broker-plugins/experimental/info/src/main/java/org/apache/qpid/info/Activator.java +++ b/qpid/java/broker-plugins/experimental/info/src/main/java/org/apache/qpid/info/Activator.java @@ -44,9 +44,9 @@ public class Activator implements BundleActivator private final List<String> _httpPropList = Arrays.asList("http.url", "http.envelope"); - InfoServiceImpl _service = null; + private InfoServiceImpl _service = null; - BundleContext _ctx = null; + private BundleContext _ctx = null; /** * Start bundle method diff --git a/qpid/java/broker-plugins/experimental/info/src/main/java/org/apache/qpid/info/InfoServiceImpl.java b/qpid/java/broker-plugins/experimental/info/src/main/java/org/apache/qpid/info/InfoServiceImpl.java index 5522f2701e..08caa794fa 100644 --- a/qpid/java/broker-plugins/experimental/info/src/main/java/org/apache/qpid/info/InfoServiceImpl.java +++ b/qpid/java/broker-plugins/experimental/info/src/main/java/org/apache/qpid/info/InfoServiceImpl.java @@ -38,7 +38,7 @@ import java.util.TreeMap; public class InfoServiceImpl implements InfoService { - SortedMap<String, String> infoMap = new TreeMap<String, String>(); + private SortedMap<String, String> infoMap = new TreeMap<String, String>(); /** * invoke method collects all the information from System and Application diff --git a/qpid/java/broker-plugins/experimental/info/src/test/java/org/apache/qpid/info/systest/InfoPluginTest.java b/qpid/java/broker-plugins/experimental/info/src/test/java/org/apache/qpid/info/systest/InfoPluginTest.java index 348e860d5f..9f38ab253d 100644 --- a/qpid/java/broker-plugins/experimental/info/src/test/java/org/apache/qpid/info/systest/InfoPluginTest.java +++ b/qpid/java/broker-plugins/experimental/info/src/test/java/org/apache/qpid/info/systest/InfoPluginTest.java @@ -61,9 +61,9 @@ public class InfoPluginTest extends QpidBrokerTestCase private CountDownLatch _latch = new CountDownLatch(2); - final List<List<String>> _recv = new ArrayList<List<String>>(); + private final List<List<String>> _recv = new ArrayList<List<String>>(); - Thread _socketAcceptor; + private Thread _socketAcceptor; public void setUp() throws Exception { diff --git a/qpid/java/broker-plugins/experimental/info/src/test/java/org/apache/qpid/info/test/InfoServiceImplTest.java b/qpid/java/broker-plugins/experimental/info/src/test/java/org/apache/qpid/info/test/InfoServiceImplTest.java index 0cd73d9de5..1e0b6ccccc 100644 --- a/qpid/java/broker-plugins/experimental/info/src/test/java/org/apache/qpid/info/test/InfoServiceImplTest.java +++ b/qpid/java/broker-plugins/experimental/info/src/test/java/org/apache/qpid/info/test/InfoServiceImplTest.java @@ -37,7 +37,7 @@ import java.util.Properties; public class InfoServiceImplTest extends TestCase { - InfoServiceImpl _isi = null; + private InfoServiceImpl _isi = null; @SuppressWarnings("unchecked") public void testInvoke() diff --git a/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/ExtrasTest.java b/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/ExtrasTest.java index 7695a5a2d5..458f9a1846 100644 --- a/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/ExtrasTest.java +++ b/qpid/java/broker-plugins/extras/src/test/java/org/apache/qpid/server/plugins/ExtrasTest.java @@ -36,7 +36,7 @@ public class ExtrasTest extends TestCase private static final String PLUGIN_DIRECTORY = System.getProperty("example.plugin.target"); private static final String CACHE_DIRECTORY = System.getProperty("example.cache.target"); - IApplicationRegistry _registry; + private IApplicationRegistry _registry; @Override public void setUp() throws Exception diff --git a/qpid/java/broker-plugins/firewall/src/main/java/org/apache/qpid/server/security/access/plugins/Firewall.java b/qpid/java/broker-plugins/firewall/src/main/java/org/apache/qpid/server/security/access/plugins/Firewall.java index 77ffbfa16f..40a65fddba 100644 --- a/qpid/java/broker-plugins/firewall/src/main/java/org/apache/qpid/server/security/access/plugins/Firewall.java +++ b/qpid/java/broker-plugins/firewall/src/main/java/org/apache/qpid/server/security/access/plugins/Firewall.java @@ -115,7 +115,7 @@ public class Firewall extends AbstractPlugin public void configure(ConfigurationPlugin config) { super.configure(config); - FirewallConfiguration firewallConfiguration = (FirewallConfiguration) _config; + FirewallConfiguration firewallConfiguration = (FirewallConfiguration) getConfig(); // Get default action _default = firewallConfiguration.getDefaultAction(); diff --git a/qpid/java/broker-plugins/firewall/src/main/java/org/apache/qpid/server/security/access/plugins/FirewallConfiguration.java b/qpid/java/broker-plugins/firewall/src/main/java/org/apache/qpid/server/security/access/plugins/FirewallConfiguration.java index 80ff8b7eca..57d7b27ee3 100644 --- a/qpid/java/broker-plugins/firewall/src/main/java/org/apache/qpid/server/security/access/plugins/FirewallConfiguration.java +++ b/qpid/java/broker-plugins/firewall/src/main/java/org/apache/qpid/server/security/access/plugins/FirewallConfiguration.java @@ -35,7 +35,7 @@ import java.util.List; public class FirewallConfiguration extends ConfigurationPlugin { - CompositeConfiguration _finalConfig; + private CompositeConfiguration _finalConfig; public static final ConfigurationPluginFactory FACTORY = new ConfigurationPluginFactory() { diff --git a/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java b/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java index d1f77ad5c7..96608acd42 100644 --- a/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java +++ b/qpid/java/broker/src/main/java/org/apache/log4j/QpidCompositeRollingAppender.java @@ -99,59 +99,38 @@ public class QpidCompositeRollingAppender extends FileAppender private long nextCheck = System.currentTimeMillis() - 1; /** Holds date of last roll over */ - Date now = new Date(); + private Date now = new Date(); - SimpleDateFormat sdf; + private SimpleDateFormat sdf; /** Helper class to determine next rollover time */ - RollingCalendar rc = new RollingCalendar(); + private RollingCalendar rc = new RollingCalendar(); - /** The default maximum file size is 10MB. */ - protected long maxFileSize = 10 * 1024 * 1024; + private long maxFileSize = 10 * 1024 * 1024; - /** There is zero backup files by default. */ - protected int maxSizeRollBackups = 0; - /** How many sized based backups have been made so far */ - protected int curSizeRollBackups = 0; + private int maxSizeRollBackups = 0; + private int curSizeRollBackups = 0; - /** not yet implemented */ - protected int maxTimeRollBackups = -1; - protected int curTimeRollBackups = 0; + private int maxTimeRollBackups = -1; + private int curTimeRollBackups = 0; - /** - * By default newer files have lower numbers. (countDirection < 0) ie. log.1 is most recent, log.5 is the 5th - * backup, etc... countDirection > 0 does the opposite ie. log.1 is the first backup made, log.5 is the 5th backup - * made, etc. For infinite backups use countDirection > 0 to reduce rollOver costs. - */ - protected int countDirection = -1; + private int countDirection = -1; - /** Style of rolling to Use. BY_SIZE (1), BY_DATE(2), BY COMPOSITE(3) */ - protected int rollingStyle = BY_COMPOSITE; - protected boolean rollDate = true; - protected boolean rollSize = true; + private int rollingStyle = BY_COMPOSITE; + private boolean rollDate = true; + private boolean rollSize = true; - /** - * By default file.log is always the current file. Optionally file.log.yyyy-mm-dd for current formated datePattern - * can by the currently logging file (or file.log.curSizeRollBackup or even file.log.yyyy-mm-dd.curSizeRollBackup) - * This will make time based roll overs with a large number of backups much faster -- it won't have to rename all - * the backups! - */ - protected boolean staticLogFileName = true; + private boolean staticLogFileName = true; - /** FileName provided in configuration. Used for rolling properly */ - protected String baseFileName; + private String baseFileName; - /** Do we want to .gz our backup files. */ - protected boolean compress = false; + private boolean compress = false; - /** Do we want to use a second thread when compressing our backup files. */ - protected boolean compressAsync = false; + private boolean compressAsync = false; - /** Do we want to start numbering files at zero. */ - protected boolean zeroBased = false; + private boolean zeroBased = false; - /** Path provided in configuration. Used for moving backup files to */ - protected String backupFilesToPath = null; + private String backupFilesToPath = null; private final ConcurrentLinkedQueue<CompressJob> _compress = new ConcurrentLinkedQueue<CompressJob>(); private AtomicBoolean _compressing = new AtomicBoolean(false); private static final String COMPRESS_EXTENSION = ".gz"; @@ -219,7 +198,7 @@ public class QpidCompositeRollingAppender extends FileAppender return datePattern; } - /** Returns the value of the <b>maxSizeRollBackups</b> option. */ + /** There is zero backup files by default. */ /** Returns the value of the <b>maxSizeRollBackups</b> option. */ public int getMaxSizeRollBackups() { return maxSizeRollBackups; @@ -379,6 +358,11 @@ public class QpidCompositeRollingAppender extends FileAppender } } + /** + * By default newer files have lower numbers. (countDirection < 0) ie. log.1 is most recent, log.5 is the 5th + * backup, etc... countDirection > 0 does the opposite ie. log.1 is the first backup made, log.5 is the 5th backup + * made, etc. For infinite backups use countDirection > 0 to reduce rollOver costs. + */ public int getCountDirection() { return countDirection; @@ -389,6 +373,7 @@ public class QpidCompositeRollingAppender extends FileAppender countDirection = direction; } + /** Style of rolling to Use. BY_SIZE (1), BY_DATE(2), BY COMPOSITE(3) */ public int getRollingStyle() { return rollingStyle; @@ -484,6 +469,7 @@ public class QpidCompositeRollingAppender extends FileAppender zeroBased = z; } + /** Path provided in configuration. Used for moving backup files to */ public String getBackupFilesToPath() { return backupFilesToPath; @@ -1074,9 +1060,117 @@ public class QpidCompositeRollingAppender extends FileAppender } } + /** The default maximum file size is 10MB. */ + protected long getMaxFileSize() + { + return maxFileSize; + } + + /** How many sized based backups have been made so far */ + protected int getCurSizeRollBackups() + { + return curSizeRollBackups; + } + + protected void setCurSizeRollBackups(int curSizeRollBackups) + { + this.curSizeRollBackups = curSizeRollBackups; + } + + /** not yet implemented */ + protected int getMaxTimeRollBackups() + { + return maxTimeRollBackups; + } + + protected void setMaxTimeRollBackups(int maxTimeRollBackups) + { + this.maxTimeRollBackups = maxTimeRollBackups; + } + + protected int getCurTimeRollBackups() + { + return curTimeRollBackups; + } + + protected void setCurTimeRollBackups(int curTimeRollBackups) + { + this.curTimeRollBackups = curTimeRollBackups; + } + + protected boolean isRollDate() + { + return rollDate; + } + + protected void setRollDate(boolean rollDate) + { + this.rollDate = rollDate; + } + + protected boolean isRollSize() + { + return rollSize; + } + + protected void setRollSize(boolean rollSize) + { + this.rollSize = rollSize; + } + + /** + * By default file.log is always the current file. Optionally file.log.yyyy-mm-dd for current formated datePattern + * can by the currently logging file (or file.log.curSizeRollBackup or even file.log.yyyy-mm-dd.curSizeRollBackup) + * This will make time based roll overs with a large number of backups much faster -- it won't have to rename all + * the backups! + */ + protected boolean isStaticLogFileName() + { + return staticLogFileName; + } + + /** FileName provided in configuration. Used for rolling properly */ + protected String getBaseFileName() + { + return baseFileName; + } + + protected void setBaseFileName(String baseFileName) + { + this.baseFileName = baseFileName; + } + + /** Do we want to .gz our backup files. */ + protected boolean isCompress() + { + return compress; + } + + protected void setCompress(boolean compress) + { + this.compress = compress; + } + + /** Do we want to use a second thread when compressing our backup files. */ + protected boolean isCompressAsync() + { + return compressAsync; + } + + /** Do we want to start numbering files at zero. */ + protected boolean isZeroBased() + { + return zeroBased; + } + + protected void setBackupFilesToPath(String backupFilesToPath) + { + this.backupFilesToPath = backupFilesToPath; + } + private static class CompressJob { - File _from, _to; + private File _from, _to; CompressJob(File from, File to) { @@ -1095,9 +1189,9 @@ public class QpidCompositeRollingAppender extends FileAppender } } - Compressor compressor = null; + private Compressor compressor = null; - Executor executor; + private Executor executor; private class Compressor implements Runnable { diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java b/qpid/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java index 0b63c68854..c6bfd34f45 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/configuration/Configuration.java @@ -33,16 +33,16 @@ public class Configuration { public static final String QPID_HOME = "QPID_HOME"; - final String QPIDHOME = System.getProperty(QPID_HOME); + private final String QPIDHOME = System.getProperty(QPID_HOME); private static Logger _devlog = LoggerFactory.getLogger(Configuration.class); public static final String DEFAULT_LOG_CONFIG_FILENAME = "log4j.xml"; public static final String DEFAULT_CONFIG_FILE = "etc/config.xml"; - protected final Options _options = new Options(); - protected CommandLine _commandLine; - protected File _configFile; + private final Options _options = new Options(); + private CommandLine _commandLine; + private File _configFile; public Configuration() diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java index 9505aa7405..dc5f45cede 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java @@ -168,7 +168,7 @@ public class AMQBrokerManagerMBean extends AMQManagedObject implements ManagedBr */ public void createNewExchange(String exchangeName, String type, boolean durable) throws JMException, MBeanException { - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { synchronized (_exchangeRegistry) @@ -215,7 +215,7 @@ public class AMQBrokerManagerMBean extends AMQManagedObject implements ManagedBr // boolean inUse = false; // Check if there are queue-bindings with the exchange and unregister // when there are no bindings. - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { _exchangeRegistry.unregisterExchange(new AMQShortString(exchangeName), false); @@ -255,7 +255,7 @@ public class AMQBrokerManagerMBean extends AMQManagedObject implements ManagedBr throw new JMException("The queue \"" + queueName + "\" already exists."); } - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { AMQShortString ownerShortString = null; @@ -311,7 +311,7 @@ public class AMQBrokerManagerMBean extends AMQManagedObject implements ManagedBr throw new JMException("The Queue " + queueName + " is not a registered queue."); } - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { queue.delete(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java index f05094e67d..f4a7a07331 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java @@ -129,7 +129,7 @@ public class AMQChannel implements SessionConfig, AMQSessionModel, AsyncAutoComm private IncomingMessage _currentMessage; /** Maps from consumer tag to subscription instance. Allows us to unsubscribe from a queue. */ - protected final Map<AMQShortString, Subscription> _tag2SubscriptionMap = new HashMap<AMQShortString, Subscription>(); + private final Map<AMQShortString, Subscription> _tag2SubscriptionMap = new HashMap<AMQShortString, Subscription>(); private final MessageStore _messageStore; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfiguration.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfiguration.java index b2d51bbdc3..7a919a5829 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfiguration.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/TopicConfiguration.java @@ -57,8 +57,8 @@ public class TopicConfiguration extends ConfigurationPlugin implements ExchangeC } } - Map<String, TopicConfig> _topics = new HashMap<String, TopicConfig>(); - Map<String, Map<String, TopicConfig>> _subscriptions = new HashMap<String, Map<String, TopicConfig>>(); + private Map<String, TopicConfig> _topics = new HashMap<String, TopicConfig>(); + private Map<String, Map<String, TopicConfig>> _subscriptions = new HashMap<String, Map<String, TopicConfig>>(); public String[] getElementsProcessed() { diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/plugins/SlowConsumerDetectionConfiguration.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/plugins/SlowConsumerDetectionConfiguration.java index c51058b30c..a90b1d514f 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/plugins/SlowConsumerDetectionConfiguration.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/plugins/SlowConsumerDetectionConfiguration.java @@ -45,7 +45,7 @@ public class SlowConsumerDetectionConfiguration extends ConfigurationPlugin } //Set Default time unit to seconds - TimeUnit _timeUnit = TimeUnit.SECONDS; + private TimeUnit _timeUnit = TimeUnit.SECONDS; public String[] getElementsProcessed() { diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java index b6fe9576ea..cae07046fa 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java @@ -61,20 +61,20 @@ public abstract class AbstractExchange implements Exchange, Managable private Exchange _alternateExchange; - protected boolean _durable; - protected int _ticket; + private boolean _durable; + private int _ticket; private VirtualHost _virtualHost; private final List<Exchange.Task> _closeTaskList = new CopyOnWriteArrayList<Exchange.Task>(); - protected AbstractExchangeMBean _exchangeMbean; + private AbstractExchangeMBean _exchangeMbean; /** * Whether the exchange is automatically deleted once all queues have detached from it */ - protected boolean _autoDelete; + private boolean _autoDelete; //The logSubject for ths exchange private LogSubject _logSubject; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java index 0981015656..782ef49d35 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchangeMBean.java @@ -55,9 +55,9 @@ import java.util.Map; public abstract class AbstractExchangeMBean<T extends AbstractExchange> extends AMQManagedObject implements ManagedExchange { // open mbean data types for representing exchange bindings - protected OpenType[] _bindingItemTypes; - protected CompositeType _bindingDataType; - protected TabularType _bindinglistDataType; + private OpenType[] _bindingItemTypes; + private CompositeType _bindingDataType; + private TabularType _bindinglistDataType; private T _exchange; @@ -108,17 +108,17 @@ public abstract class AbstractExchangeMBean<T extends AbstractExchange> extends public Integer getTicketNo() { - return _exchange._ticket; + return _exchange.getTicket(); } public boolean isDurable() { - return _exchange._durable; + return _exchange.isDurable(); } public boolean isAutoDelete() { - return _exchange._autoDelete; + return _exchange.isAutoDelete(); } // Added exchangetype in the object name lets maangement apps to do any customization required @@ -143,7 +143,7 @@ public abstract class AbstractExchangeMBean<T extends AbstractExchange> extends throw new JMException("Queue \"" + queueName + "\" is not registered with the virtualhost."); } - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { vhost.getBindingFactory().addBinding(binding,queue,getExchange(),null); @@ -170,7 +170,7 @@ public abstract class AbstractExchangeMBean<T extends AbstractExchange> extends throw new JMException("Queue \"" + queueName + "\" is not registered with the virtualhost."); } - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { vhost.getBindingFactory().removeBinding(binding, queue, _exchange, Collections.<String, Object>emptyMap()); @@ -182,4 +182,35 @@ public abstract class AbstractExchangeMBean<T extends AbstractExchange> extends } CurrentActor.remove(); } + + + protected OpenType[] getBindingItemTypes() + { + return _bindingItemTypes; + } + + protected void setBindingItemTypes(OpenType[] bindingItemTypes) + { + _bindingItemTypes = bindingItemTypes; + } + + protected CompositeType getBindingDataType() + { + return _bindingDataType; + } + + protected void setBindingDataType(CompositeType bindingDataType) + { + _bindingDataType = bindingDataType; + } + + protected TabularType getBindinglistDataType() + { + return _bindinglistDataType; + } + + protected void setBindinglistDataType(TabularType bindinglistDataType) + { + _bindinglistDataType = bindinglistDataType; + } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DirectExchangeMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DirectExchangeMBean.java index 681eda9ccf..0bfaf7035d 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DirectExchangeMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DirectExchangeMBean.java @@ -51,7 +51,7 @@ final class DirectExchangeMBean extends AbstractExchangeMBean<DirectExchange> public TabularData bindings() throws OpenDataException { - TabularDataSupport bindingList = new TabularDataSupport(_bindinglistDataType); + TabularDataSupport bindingList = new TabularDataSupport(getBindinglistDataType()); Map<String, List<String>> bindingMap = new HashMap<String, List<String>>(); @@ -71,7 +71,7 @@ final class DirectExchangeMBean extends AbstractExchangeMBean<DirectExchange> for(Map.Entry<String, List<String>> entry : bindingMap.entrySet()) { Object[] bindingItemValues = {entry.getKey(), entry.getValue().toArray(new String[0])}; - CompositeData bindingData = new CompositeDataSupport(_bindingDataType, + CompositeData bindingData = new CompositeDataSupport(getBindingDataType(), COMPOSITE_ITEM_NAMES.toArray(new String[COMPOSITE_ITEM_NAMES.size()]), bindingItemValues); bindingList.put(bindingData); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeMBean.java index 56fb664f40..61e23c896c 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeMBean.java @@ -50,7 +50,7 @@ final class FanoutExchangeMBean extends AbstractExchangeMBean<FanoutExchange> public TabularData bindings() throws OpenDataException { - TabularDataSupport bindingList = new TabularDataSupport(_bindinglistDataType); + TabularDataSupport bindingList = new TabularDataSupport(getBindinglistDataType()); ArrayList<String> queueNames = new ArrayList<String>(); @@ -62,7 +62,7 @@ final class FanoutExchangeMBean extends AbstractExchangeMBean<FanoutExchange> } Object[] bindingItemValues = {BINDING_KEY_SUBSTITUTE, queueNames.toArray(new String[0])}; - CompositeData bindingData = new CompositeDataSupport(_bindingDataType, + CompositeData bindingData = new CompositeDataSupport(getBindingDataType(), COMPOSITE_ITEM_NAMES.toArray(new String[COMPOSITE_ITEM_NAMES.size()]), bindingItemValues); bindingList.put(bindingData); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeMBean.java index 9b4753273b..395c6c8a91 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeMBean.java @@ -68,20 +68,20 @@ final class HeadersExchangeMBean extends AbstractExchangeMBean<HeadersExchange> protected void init() throws OpenDataException { - _bindingItemTypes = new OpenType[3]; - _bindingItemTypes[0] = SimpleType.INTEGER; - _bindingItemTypes[1] = SimpleType.STRING; - _bindingItemTypes[2] = new ArrayType(1, SimpleType.STRING); - _bindingDataType = new CompositeType("Exchange Binding", "Queue name and header bindings", - HEADERS_COMPOSITE_ITEM_NAMES.toArray(new String[HEADERS_COMPOSITE_ITEM_NAMES.size()]), - HEADERS_COMPOSITE_ITEM_DESC.toArray(new String[HEADERS_COMPOSITE_ITEM_DESC.size()]), _bindingItemTypes); - _bindinglistDataType = new TabularType("Exchange Bindings", "List of exchange bindings for " + getName(), - _bindingDataType, HEADERS_TABULAR_UNIQUE_INDEX.toArray(new String[HEADERS_TABULAR_UNIQUE_INDEX.size()])); + setBindingItemTypes(new OpenType[3]); + getBindingItemTypes()[0] = SimpleType.INTEGER; + getBindingItemTypes()[1] = SimpleType.STRING; + getBindingItemTypes()[2] = new ArrayType(1, SimpleType.STRING); + setBindingDataType(new CompositeType("Exchange Binding", "Queue name and header bindings", + HEADERS_COMPOSITE_ITEM_NAMES.toArray(new String[HEADERS_COMPOSITE_ITEM_NAMES.size()]), + HEADERS_COMPOSITE_ITEM_DESC.toArray(new String[HEADERS_COMPOSITE_ITEM_DESC.size()]), getBindingItemTypes())); + setBindinglistDataType(new TabularType("Exchange Bindings", "List of exchange bindings for " + getName(), + getBindingDataType(), HEADERS_TABULAR_UNIQUE_INDEX.toArray(new String[HEADERS_TABULAR_UNIQUE_INDEX.size()]))); } public TabularData bindings() throws OpenDataException { - TabularDataSupport bindingList = new TabularDataSupport(_bindinglistDataType); + TabularDataSupport bindingList = new TabularDataSupport(getBindinglistDataType()); int count = 1; for (Binding binding : getExchange().getBindings()) { @@ -103,7 +103,7 @@ final class HeadersExchangeMBean extends AbstractExchangeMBean<HeadersExchange> Object[] bindingItemValues = {count++, queueName, mappingList.toArray(new String[0])}; - CompositeData bindingData = new CompositeDataSupport(_bindingDataType, + CompositeData bindingData = new CompositeDataSupport(getBindingDataType(), HEADERS_COMPOSITE_ITEM_NAMES.toArray(new String[HEADERS_COMPOSITE_ITEM_NAMES.size()]), bindingItemValues); bindingList.put(bindingData); } @@ -121,7 +121,7 @@ final class HeadersExchangeMBean extends AbstractExchangeMBean<HeadersExchange> throw new JMException("Queue \"" + queueName + "\" is not registered with the virtualhost."); } - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); final Map<String,Object> arguments = new HashMap<String, Object>(); final String[] bindings = binding.split(","); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchangeMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchangeMBean.java index 008876bd60..481a377fc4 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchangeMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchangeMBean.java @@ -51,7 +51,7 @@ final class TopicExchangeMBean extends AbstractExchangeMBean<TopicExchange> /** returns exchange bindings in tabular form */ public TabularData bindings() throws OpenDataException { - TabularDataSupport bindingList = new TabularDataSupport(_bindinglistDataType); + TabularDataSupport bindingList = new TabularDataSupport(getBindinglistDataType()); Map<String, List<String>> bindingData = new HashMap<String, List<String>>(); for (Binding binding : getExchange().getBindings()) { @@ -69,7 +69,7 @@ final class TopicExchangeMBean extends AbstractExchangeMBean<TopicExchange> { Object[] bindingItemValues = {entry.getKey(), entry.getValue().toArray(new String[entry.getValue().size()]) }; CompositeData bindingCompositeData = - new CompositeDataSupport(_bindingDataType, + new CompositeDataSupport(getBindingDataType(), COMPOSITE_ITEM_NAMES.toArray(new String[COMPOSITE_ITEM_NAMES.size()]), bindingItemValues); bindingList.put(bindingCompositeData); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/headers/HeadersParser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/headers/HeadersParser.java index 0cee139dfc..1341f77c72 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/headers/HeadersParser.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/headers/HeadersParser.java @@ -286,8 +286,8 @@ public class HeadersParser public final static class KeyValuePair { - public final HeaderKey _key; - public final AMQTypedValue _value; + private final HeaderKey _key; + private final AMQTypedValue _value; private final int _hashCode; public KeyValuePair(final HeaderKey key, final AMQTypedValue value) diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicMatcherDFAState.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicMatcherDFAState.java index 52d78dd01e..dfe4d85320 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicMatcherDFAState.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicMatcherDFAState.java @@ -256,25 +256,25 @@ public class TopicMatcherDFAState transitions.append("[ "); transitions.append(entry.getKey()); transitions.append("\t ->\t "); - transitions.append(entry.getValue()._id); + transitions.append(entry.getValue().getId()); transitions.append(" ]\n"); } - return "[ State " + _id + " ]\n" + transitions + "\n"; + return "[ State " + getId() + " ]\n" + transitions + "\n"; } public String reachableStates() { - StringBuilder result = new StringBuilder("Start state: " + _id + "\n"); + StringBuilder result = new StringBuilder("Start state: " + getId() + "\n"); SortedSet<TopicMatcherDFAState> reachableStates = new TreeSet<TopicMatcherDFAState>(new Comparator<TopicMatcherDFAState>() { public int compare(final TopicMatcherDFAState o1, final TopicMatcherDFAState o2) { - return o1._id - o2._id; + return o1.getId() - o2.getId(); } }); reachableStates.add(this); @@ -302,4 +302,9 @@ public class TopicMatcherDFAState return result.toString(); } + + int getId() + { + return _id; + } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicParser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicParser.java index 3c8819cf6c..54fc4b3634 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicParser.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/topic/TopicParser.java @@ -60,14 +60,43 @@ public class TopicParser } + public TopicWord getWord() + { + return _word; + } + + public boolean isSelfTransition() + { + return _selfTransition; + } + + public int getPosition() + { + return _position; + } + + public boolean isEndState() + { + return _endState; + } + + public boolean isFollowedByAnyLoop() + { + return _followedByAnyLoop; + } + + public void setFollowedByAnyLoop(boolean followedByAnyLoop) + { + _followedByAnyLoop = followedByAnyLoop; + } } private static final Position ERROR_POSITION = new Position(Integer.MAX_VALUE,null, true, false); private static class SimpleState { - Set<Position> _positions; - Map<TopicWord, SimpleState> _nextState; + private Set<Position> _positions; + private Map<TopicWord, SimpleState> _nextState; } @@ -188,11 +217,11 @@ public class TopicParser while(followedByWildcards && n<(positionCount+1)) { - if(positions[n]._selfTransition) + if(positions[n].isSelfTransition()) { break; } - else if(positions[n]._word!=TopicWord.ANY_WORD) + else if(positions[n].getWord() !=TopicWord.ANY_WORD) { followedByWildcards = false; } @@ -200,7 +229,7 @@ public class TopicParser } - positions[p]._followedByAnyLoop = followedByWildcards && (n!= positionCount+1); + positions[p].setFollowedByAnyLoop(followedByWildcards && (n!= positionCount+1)); } @@ -229,7 +258,7 @@ public class TopicParser for(Position p : simpleStates[i]._positions) { - if(p._endState) + if(p.isEndState()) { endState = true; break; @@ -275,7 +304,7 @@ public class TopicParser for(Position pos : state._positions) { - if(pos._selfTransition) + if(pos.isSelfTransition()) { Set<Position> dest = transitions.get(TopicWord.ANY_WORD); if(dest == null) @@ -286,14 +315,14 @@ public class TopicParser dest.add(pos); } - final int nextPos = pos._position + 1; + final int nextPos = pos.getPosition() + 1; Position nextPosition = nextPos == positions.length ? ERROR_POSITION : positions[nextPos]; - Set<Position> dest = transitions.get(pos._word); + Set<Position> dest = transitions.get(pos.getWord()); if(dest == null) { dest = new HashSet<Position>(); - transitions.put(pos._word,dest); + transitions.put(pos.getWord(),dest); } dest.add(nextPosition); @@ -320,7 +349,7 @@ public class TopicParser Position loopingTerminal = null; for(Position destPos : dest.getValue()) { - if(destPos._selfTransition && destPos._endState) + if(destPos.isSelfTransition() && destPos.isEndState()) { loopingTerminal = destPos; break; @@ -336,9 +365,9 @@ public class TopicParser Position anyLoop = null; for(Position destPos : dest.getValue()) { - if(destPos._followedByAnyLoop) + if(destPos.isFollowedByAnyLoop()) { - if(anyLoop == null || anyLoop._position<destPos._position) + if(anyLoop == null || anyLoop.getPosition() < destPos.getPosition()) { anyLoop = destPos; } @@ -349,7 +378,7 @@ public class TopicParser Collection<Position> removals = new ArrayList<Position>(); for(Position destPos : dest.getValue()) { - if(destPos._position < anyLoop._position) + if(destPos.getPosition() < anyLoop.getPosition()) { removals.add(destPos); } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/Bridge.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/Bridge.java index 8bd55614da..b58802e1ff 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/Bridge.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/Bridge.java @@ -522,7 +522,7 @@ public class Bridge implements BridgeConfig _transaction.enqueue(queues,message, new ServerTransaction.Action() { - BaseQueue[] _queues = queues.toArray(new BaseQueue[queues.size()]); + private BaseQueue[] _queues = queues.toArray(new BaseQueue[queues.size()]); public void postCommit() { diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/BrokerLink.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/BrokerLink.java index 7b0f9563b3..032df8bb0d 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/BrokerLink.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/federation/BrokerLink.java @@ -376,8 +376,8 @@ public class BrokerLink implements LinkConfig, ConnectionListener } }; final SaslClient sc = Sasl.createSaslClient(new String[] {"PLAIN"}, null, - _conSettings.getSaslProtocol(), - _conSettings.getSaslServerName(), + getConnectionSettings().getSaslProtocol(), + getConnectionSettings().getSaslServerName(), saslProps, cbh); return sc; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java index eca9e925ee..d0d58004ab 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/ComparisonExpression.java @@ -74,7 +74,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B static class LikeExpression extends UnaryExpression implements BooleanExpression { - Pattern likePattern; + private Pattern likePattern; /** * @param right diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/flow/AbstractFlowCreditManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/flow/AbstractFlowCreditManager.java index c403d109a0..124fb0d1d9 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/flow/AbstractFlowCreditManager.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/flow/AbstractFlowCreditManager.java @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean; public abstract class AbstractFlowCreditManager implements FlowCreditManager { - protected final AtomicBoolean _suspended = new AtomicBoolean(false); + private final AtomicBoolean _suspended = new AtomicBoolean(false); private final ArrayList<FlowCreditManagerListener> _listeners = new ArrayList<FlowCreditManagerListener>(); public final void addStateListener(FlowCreditManagerListener listener) diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/actors/ManagementActor.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/actors/ManagementActor.java index 74017bc43e..9cd3c66629 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/actors/ManagementActor.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/actors/ManagementActor.java @@ -51,7 +51,7 @@ public class ManagementActor extends AbstractActor */ private static final String UNKNOWN_PRINCIPAL = "N/A"; - String _lastThreadName = null; + private String _lastThreadName = null; /** * LOG FORMAT for the ManagementActor, diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java index 3b69b8e8cd..c699dff175 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java @@ -82,8 +82,8 @@ public class LoggingManagementMBean extends AMQManagedObject implements LoggingM Level.WARN.toString(), Level.ERROR.toString(), Level.FATAL.toString(),Level.OFF.toString(), INHERITED}; - static TabularType _loggerLevelTabularType; - static CompositeType _loggerLevelCompositeType; + private static TabularType _loggerLevelTabularType; + private static CompositeType _loggerLevelCompositeType; static { diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/AbstractLogSubject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/AbstractLogSubject.java index 779db01601..baccf240ff 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/AbstractLogSubject.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/AbstractLogSubject.java @@ -33,10 +33,7 @@ import java.text.MessageFormat; */ public abstract class AbstractLogSubject implements LogSubject { - /** - * The logString that will be returned via toLogString - */ - protected String _logString; + private String _logString; /** * Set the toString logging of this LogSubject. Based on a format provided @@ -60,4 +57,16 @@ public abstract class AbstractLogSubject implements LogSubject return _logString; } + /** + * The logString that will be returned via toLogString + */ + public String getLogString() + { + return _logString; + } + + public void setLogString(String logString) + { + _logString = logString; + } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ConnectionLogSubject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ConnectionLogSubject.java index c8e122ec05..3b08a172b6 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ConnectionLogSubject.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/ConnectionLogSubject.java @@ -70,31 +70,31 @@ public class ConnectionLogSubject extends AbstractLogSubject * * 0 - Connection ID 1 - User ID 2 - IP 3 - Virtualhost */ - _logString = "[" + MessageFormat.format(CONNECTION_FORMAT, - _session.getSessionID(), - _session.getAuthorizedPrincipal().getName(), + setLogString("[" + MessageFormat.format(CONNECTION_FORMAT, + _session.getSessionID(), + _session.getAuthorizedPrincipal().getName(), _session.getRemoteAddress(), - _session.getVirtualHost().getName()) - + "] "; + _session.getVirtualHost().getName()) + + "] "); _upToDate = true; } else { - _logString = "[" + MessageFormat.format(USER_FORMAT, - _session.getSessionID(), - _session.getAuthorizedPrincipal().getName(), + setLogString("[" + MessageFormat.format(USER_FORMAT, + _session.getSessionID(), + _session.getAuthorizedPrincipal().getName(), _session.getRemoteAddress()) - + "] "; + + "] "); } } else { - _logString = "[" + MessageFormat.format(SOCKET_FORMAT, + setLogString("[" + MessageFormat.format(SOCKET_FORMAT, _session.getSessionID(), - _session.getRemoteAddress()) - + "] "; + _session.getRemoteAddress()) + + "] "); } } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/SubscriptionLogSubject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/SubscriptionLogSubject.java index 56aef18574..9a23b733dc 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/SubscriptionLogSubject.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/logging/subjects/SubscriptionLogSubject.java @@ -42,14 +42,14 @@ public class SubscriptionLogSubject extends AbstractLogSubject String queueString = new QueueLogSubject(subscription.getQueue()).toLogString(); - _logString = "[" + MessageFormat.format(SUBSCRIPTION_FORMAT, + setLogString("[" + MessageFormat.format(SUBSCRIPTION_FORMAT, subscription.getSubscriptionID()) + "(" // queueString is [vh(/{0})/qu({1}) ] so need to trim // ^ ^^ + queueString.substring(1,queueString.length() - 3) + ")" - + "] "; + + "] "); } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java index 2748e5a670..5c57c01f6e 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java @@ -40,17 +40,11 @@ import javax.management.NotificationListener; public abstract class AMQManagedObject extends DefaultManagedObject implements NotificationBroadcaster { - /** - * broadcaster support class - */ - protected NotificationBroadcasterSupport _broadcaster = new NotificationBroadcasterSupport(); + private NotificationBroadcasterSupport _broadcaster = new NotificationBroadcasterSupport(); - /** - * sequence number for notifications - */ - protected long _notificationSequenceNumber = 0; + private long _notificationSequenceNumber = 0; - protected LogActor _logActor; + private LogActor _logActor; protected AMQManagedObject(Class<?> managementInterface, String typeName) throws NotCompliantMBeanException @@ -77,4 +71,35 @@ public abstract class AMQManagedObject extends DefaultManagedObject } + /** + * broadcaster support class + */ + protected NotificationBroadcasterSupport getBroadcaster() + { + return _broadcaster; + } + + /** + * sequence number for notifications + */ + protected long getNotificationSequenceNumber() + { + return _notificationSequenceNumber; + } + + protected void setNotificationSequenceNumber(long notificationSequenceNumber) + { + _notificationSequenceNumber = notificationSequenceNumber; + } + + protected long incrementAndGetSequenceNumber() + { + return ++_notificationSequenceNumber; + } + + protected LogActor getLogActor() + { + return _logActor; + } + } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AbstractAMQManagedConnectionObject.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AbstractAMQManagedConnectionObject.java index 6faeb76baf..e7c07b6dd4 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AbstractAMQManagedConnectionObject.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/management/AbstractAMQManagedConnectionObject.java @@ -15,7 +15,7 @@ import javax.management.openmbean.TabularType; public abstract class AbstractAMQManagedConnectionObject extends AMQManagedObject implements ManagedConnection { - protected final String _name; + private final String _name; protected static final OpenType[] _channelAttributeTypes = { SimpleType.INTEGER, SimpleType.BOOLEAN, SimpleType.STRING, SimpleType.INTEGER, SimpleType.BOOLEAN }; protected static final CompositeType _channelType; @@ -45,7 +45,6 @@ public abstract class AbstractAMQManagedConnectionObject extends AMQManagedObjec _name = "anonymous".equals(remoteAddress) ? (remoteAddress + hashCode()) : remoteAddress; } - @Override public String getObjectInstanceName() { return ObjectName.quote(_name); @@ -53,9 +52,9 @@ public abstract class AbstractAMQManagedConnectionObject extends AMQManagedObjec public void notifyClients(String notificationMsg) { - final Notification n = new Notification(MonitorNotification.THRESHOLD_VALUE_EXCEEDED, this, ++_notificationSequenceNumber, + final Notification n = new Notification(MonitorNotification.THRESHOLD_VALUE_EXCEEDED, this, incrementAndGetSequenceNumber(), System.currentTimeMillis(), notificationMsg); - _broadcaster.sendNotification(n); + getBroadcaster().sendNotification(n); } @Override diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/message/MessageMetaData.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/message/MessageMetaData.java index 0b4fac9d23..583f0c09a7 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/message/MessageMetaData.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/message/MessageMetaData.java @@ -161,7 +161,7 @@ public class MessageMetaData implements StorableMessageMetaData public int getContentSize() { - return (int) _contentHeaderBody.bodySize; + return (int) _contentHeaderBody.getBodySize(); } public boolean isPersistent() diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java index 3ec384f5a3..b2728be856 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java @@ -104,7 +104,7 @@ public class ProtocolOutputConverterImpl implements ProtocolOutputConverter final MessageTransferMessage message = (MessageTransferMessage) entry.getMessage(); BasicContentHeaderProperties props = HeaderPropertiesConverter.convert(message, entry.getQueue().getVirtualHost()); ContentHeaderBody chb = new ContentHeaderBody(props, org.apache.qpid.framing.amqp_8_0.BasicGetBodyImpl.CLASS_ID); - chb.bodySize = message.getSize(); + chb.setBodySize(message.getSize()); return chb; } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java index c1bb123fdc..054d8b98e8 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9/ProtocolOutputConverterImpl.java @@ -99,7 +99,7 @@ public class ProtocolOutputConverterImpl implements ProtocolOutputConverter final MessageTransferMessage message = (MessageTransferMessage) entry.getMessage(); BasicContentHeaderProperties props = HeaderPropertiesConverter.convert(message, entry.getQueue().getVirtualHost()); ContentHeaderBody chb = new ContentHeaderBody(props, BasicGetBodyImpl.CLASS_ID); - chb.bodySize = message.getSize(); + chb.setBodySize(message.getSize()); return chb; } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9_1/ProtocolOutputConverterImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9_1/ProtocolOutputConverterImpl.java index 49479ec540..cf097fa923 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9_1/ProtocolOutputConverterImpl.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_9_1/ProtocolOutputConverterImpl.java @@ -98,7 +98,7 @@ public class ProtocolOutputConverterImpl implements ProtocolOutputConverter final MessageTransferMessage message = (MessageTransferMessage) entry.getMessage(); BasicContentHeaderProperties props = HeaderPropertiesConverter.convert(message, entry.getQueue().getVirtualHost()); ContentHeaderBody chb = new ContentHeaderBody(props, BasicGetBodyImpl.CLASS_ID); - chb.bodySize = message.getSize(); + chb.setBodySize(message.getSize()); return chb; } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java index 771c436a89..251c3dd0cd 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolEngine.java @@ -369,7 +369,7 @@ public class AMQProtocolEngine implements ServerProtocolEngine, Managable, AMQPr try { // Log incomming protocol negotiation request - _actor.message(ConnectionMessages.OPEN(null, pi._protocolMajor + "-" + pi._protocolMinor, false, true)); + _actor.message(ConnectionMessages.OPEN(null, pi.getProtocolMajor() + "-" + pi.getProtocolMinor(), false, true)); ProtocolVersion pv = pi.checkVersion(); // Fails if not correct @@ -1357,6 +1357,11 @@ public class AMQProtocolEngine implements ServerProtocolEngine, Managable, AMQPr (Throwable) null)); } + public boolean isClosed() + { + return _closed; + } + public List<AMQSessionModel> getSessionModels() { List<AMQSessionModel> sessions = new ArrayList<AMQSessionModel>(); @@ -1503,8 +1508,8 @@ public class AMQProtocolEngine implements ServerProtocolEngine, Managable, AMQPr private static class BytesDataOutput implements DataOutput { - int _pos = 0; - byte[] _buf; + private int _pos = 0; + private byte[] _buf; public BytesDataOutput(byte[] buf) { diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java index 81d8bf8f5e..2f4becc129 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java @@ -133,7 +133,7 @@ public class AMQProtocolSessionMBean extends AbstractAMQManagedConnectionObject */ public void commitTransactions(int channelId) throws JMException { - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { AMQChannel channel = _protocolSession.getChannel(channelId); @@ -162,7 +162,7 @@ public class AMQProtocolSessionMBean extends AbstractAMQManagedConnectionObject */ public void rollbackTransactions(int channelId) throws JMException { - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { AMQChannel channel = _protocolSession.getChannel(channelId); @@ -241,7 +241,7 @@ public class AMQProtocolSessionMBean extends AbstractAMQManagedConnectionObject if (CurrentActor.get() == null) { removeActor = true; - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); } try diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java index cbd3471115..7c59097965 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java @@ -355,10 +355,10 @@ public class AMQQueueMBean extends AMQManagedObject implements ManagedQueue, Que notificationMsg = notification.name() + " " + notificationMsg; _lastNotification = - new Notification(MonitorNotification.THRESHOLD_VALUE_EXCEEDED, this, ++_notificationSequenceNumber, + new Notification(MonitorNotification.THRESHOLD_VALUE_EXCEEDED, this, incrementAndGetSequenceNumber(), System.currentTimeMillis(), notificationMsg); - _broadcaster.sendNotification(_lastNotification); + getBroadcaster().sendNotification(_lastNotification); } public Notification getLastNotification() @@ -495,7 +495,7 @@ public class AMQQueueMBean extends AMQManagedObject implements ManagedQueue, Que ContentHeaderBody headerBody = msg.getContentHeaderBody(); // Create header attributes list headerAttributes = getMessageHeaderProperties(headerBody); - itemValues = new Object[]{msg.getMessageId(), headerAttributes, headerBody.bodySize, queueEntry.isRedelivered(), position, queueEntry.getDeliveryCount()}; + itemValues = new Object[]{msg.getMessageId(), headerAttributes, headerBody.getBodySize(), queueEntry.isRedelivered(), position, queueEntry.getDeliveryCount()}; } else if(serverMsg instanceof MessageTransferMessage) { diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/IncomingMessage.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/IncomingMessage.java index d3792e68df..0162f1b738 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/IncomingMessage.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/IncomingMessage.java @@ -157,7 +157,7 @@ public class IncomingMessage implements Filterable, InboundMessage, EnqueableMes public boolean allContentReceived() { - return (_bodyLengthReceived == getContentHeader().bodySize); + return (_bodyLengthReceived == getContentHeader().getBodySize()); } public AMQShortString getExchange() @@ -218,7 +218,7 @@ public class IncomingMessage implements Filterable, InboundMessage, EnqueableMes public long getSize() { - return getContentHeader().bodySize; + return getContentHeader().getBodySize(); } public long getMessageNumber() diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java index 18c2906470..cb34f69ff8 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/OutOfOrderQueue.java @@ -29,7 +29,7 @@ public abstract class OutOfOrderQueue extends SimpleAMQQueue QueueContext context = (QueueContext) subscription.getQueueContext(); if(context != null) { - QueueEntry released = context._releasedEntry; + QueueEntry released = context.getReleasedEntry(); while(!entry.isAcquired() && (released == null || released.compareTo(entry) > 0)) { if(QueueContext._releasedUpdater.compareAndSet(context,released,entry)) @@ -38,7 +38,7 @@ public abstract class OutOfOrderQueue extends SimpleAMQQueue } else { - released = context._releasedEntry; + released = context.getReleasedEntry(); } } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueContext.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueContext.java index 825a85a89c..c8f04c7b96 100755 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueContext.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/QueueContext.java @@ -25,8 +25,8 @@ import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; final class QueueContext implements AMQQueue.Context { - volatile QueueEntry _lastSeenEntry; - volatile QueueEntry _releasedEntry; + private volatile QueueEntry _lastSeenEntry; + private volatile QueueEntry _releasedEntry; static final AtomicReferenceFieldUpdater<QueueContext, QueueEntry> _lastSeenUpdater = @@ -46,4 +46,10 @@ final class QueueContext implements AMQQueue.Context { return _lastSeenEntry; } + + + QueueEntry getReleasedEntry() + { + return _releasedEntry; + } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java index 035645acc7..a6518e857f 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java @@ -834,7 +834,7 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes private void setLastSeenEntry(final Subscription sub, final QueueEntry entry) { QueueContext subContext = (QueueContext) sub.getQueueContext(); - QueueEntry releasedEntry = subContext._releasedEntry; + QueueEntry releasedEntry = subContext.getReleasedEntry(); QueueContext._lastSeenUpdater.set(subContext, entry); if(releasedEntry == entry) @@ -851,7 +851,7 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes { QueueEntry oldEntry; - while((oldEntry = subContext._releasedEntry) == null || oldEntry.compareTo(entry) > 0) + while((oldEntry = subContext.getReleasedEntry()) == null || oldEntry.compareTo(entry) > 0) { if(QueueContext._releasedUpdater.compareAndSet(subContext, oldEntry, entry)) { @@ -1846,8 +1846,8 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes QueueContext context = (QueueContext) sub.getQueueContext(); if(context != null) { - QueueEntry lastSeen = context._lastSeenEntry; - QueueEntry releasedNode = context._releasedEntry; + QueueEntry lastSeen = context.getLastSeenEntry(); + QueueEntry releasedNode = context.getReleasedEntry(); QueueEntry node = (releasedNode != null && lastSeen.compareTo(releasedNode)>=0) ? releasedNode : _entries.next(lastSeen); @@ -1869,8 +1869,8 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes QueueContext._releasedUpdater.compareAndSet(context, releasedNode, null); } - lastSeen = context._lastSeenEntry; - releasedNode = context._releasedEntry; + lastSeen = context.getLastSeenEntry(); + releasedNode = context.getReleasedEntry(); node = (releasedNode != null && lastSeen.compareTo(releasedNode)>0) ? releasedNode : _entries.next(lastSeen); } return node; @@ -1886,7 +1886,7 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener, Mes QueueContext context = (QueueContext) sub.getQueueContext(); if(context != null) { - QueueEntry releasedNode = context._releasedEntry; + QueueEntry releasedNode = context.getReleasedEntry(); return releasedNode == null || releasedNode.compareTo(entry) < 0; } else diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleQueueEntryImpl.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleQueueEntryImpl.java index 0707dc045c..4a10d31d37 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleQueueEntryImpl.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleQueueEntryImpl.java @@ -22,9 +22,16 @@ package org.apache.qpid.server.queue; import org.apache.qpid.server.message.ServerMessage; +import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; + public class SimpleQueueEntryImpl extends QueueEntryImpl { - volatile SimpleQueueEntryImpl _next; + static final AtomicReferenceFieldUpdater<SimpleQueueEntryImpl, SimpleQueueEntryImpl> + _nextUpdater = + AtomicReferenceFieldUpdater.newUpdater + (SimpleQueueEntryImpl.class, SimpleQueueEntryImpl.class, "_next"); + + private volatile SimpleQueueEntryImpl _next; public SimpleQueueEntryImpl(SimpleQueueEntryList queueEntryList) { diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleQueueEntryList.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleQueueEntryList.java index 828c8b4964..d74431aae7 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleQueueEntryList.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleQueueEntryList.java @@ -42,9 +42,7 @@ public class SimpleQueueEntryList implements QueueEntryList<SimpleQueueEntryImpl private final AMQQueue _queue; static final AtomicReferenceFieldUpdater<SimpleQueueEntryImpl, SimpleQueueEntryImpl> - _nextUpdater = - AtomicReferenceFieldUpdater.newUpdater - (SimpleQueueEntryImpl.class, SimpleQueueEntryImpl.class, "_next"); + _nextUpdater = SimpleQueueEntryImpl._nextUpdater; private AtomicLong _scavenges = new AtomicLong(0L); private final long _scavengeCount = Integer.getInteger("qpid.queue.scavenge_count", 50); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java index ddb122a08a..f6c766d73f 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java @@ -77,33 +77,33 @@ import java.util.concurrent.atomic.AtomicReference; */ public abstract class ApplicationRegistry implements IApplicationRegistry { - protected static final Logger _logger = Logger.getLogger(ApplicationRegistry.class); + private static final Logger _logger = Logger.getLogger(ApplicationRegistry.class); private static AtomicReference<IApplicationRegistry> _instance = new AtomicReference<IApplicationRegistry>(null); - protected final ServerConfiguration _configuration; + private final ServerConfiguration _configuration; - protected final Map<InetSocketAddress, QpidAcceptor> _acceptors = new HashMap<InetSocketAddress, QpidAcceptor>(); + private final Map<InetSocketAddress, QpidAcceptor> _acceptors = new HashMap<InetSocketAddress, QpidAcceptor>(); - protected ManagedObjectRegistry _managedObjectRegistry; + private ManagedObjectRegistry _managedObjectRegistry; - protected AuthenticationManager _authenticationManager; + private AuthenticationManager _authenticationManager; - protected VirtualHostRegistry _virtualHostRegistry; + private VirtualHostRegistry _virtualHostRegistry; - protected SecurityManager _securityManager; + private SecurityManager _securityManager; - protected PluginManager _pluginManager; + private PluginManager _pluginManager; - protected ConfigurationManager _configurationManager; + private ConfigurationManager _configurationManager; - protected RootMessageLogger _rootMessageLogger; + private RootMessageLogger _rootMessageLogger; - protected CompositeStartupMessageLogger _startupMessageLogger; + private CompositeStartupMessageLogger _startupMessageLogger; - protected UUID _brokerId = UUID.randomUUID(); + private UUID _brokerId = UUID.randomUUID(); - protected QMFService _qmfService; + private QMFService _qmfService; private BrokerConfig _broker; @@ -115,6 +115,76 @@ public abstract class ApplicationRegistry implements IApplicationRegistry private BundleContext _bundleContext; + protected static Logger get_logger() + { + return _logger; + } + + protected Map<InetSocketAddress, QpidAcceptor> getAcceptors() + { + return _acceptors; + } + + protected void setManagedObjectRegistry(ManagedObjectRegistry managedObjectRegistry) + { + _managedObjectRegistry = managedObjectRegistry; + } + + protected void setAuthenticationManager(AuthenticationManager authenticationManager) + { + _authenticationManager = authenticationManager; + } + + protected void setVirtualHostRegistry(VirtualHostRegistry virtualHostRegistry) + { + _virtualHostRegistry = virtualHostRegistry; + } + + protected void setSecurityManager(SecurityManager securityManager) + { + _securityManager = securityManager; + } + + protected void setPluginManager(PluginManager pluginManager) + { + _pluginManager = pluginManager; + } + + protected void setConfigurationManager(ConfigurationManager configurationManager) + { + _configurationManager = configurationManager; + } + + protected void setRootMessageLogger(RootMessageLogger rootMessageLogger) + { + _rootMessageLogger = rootMessageLogger; + } + + protected CompositeStartupMessageLogger getStartupMessageLogger() + { + return _startupMessageLogger; + } + + protected void setStartupMessageLogger(CompositeStartupMessageLogger startupMessageLogger) + { + _startupMessageLogger = startupMessageLogger; + } + + protected void setBrokerId(UUID brokerId) + { + _brokerId = brokerId; + } + + protected QMFService getQmfService() + { + return _qmfService; + } + + protected void setQmfService(QMFService qmfService) + { + _qmfService = qmfService; + } + static { Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownService())); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java index 3e6df7b0e3..e9ba2764e5 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ConfigurationFileApplicationRegistry.java @@ -48,7 +48,7 @@ public class ConfigurationFileApplicationRegistry extends ApplicationRegistry public void close() { //Set the Actor for Broker Shutdown - CurrentActor.set(new BrokerActor(_rootMessageLogger)); + CurrentActor.set(new BrokerActor(getRootMessageLogger())); try { super.close(); @@ -63,13 +63,13 @@ public class ConfigurationFileApplicationRegistry extends ApplicationRegistry @Override protected void initialiseManagedObjectRegistry() throws AMQException { - if (_configuration.getManagementEnabled()) + if (getConfiguration().getManagementEnabled()) { - _managedObjectRegistry = new JMXManagedObjectRegistry(); + setManagedObjectRegistry(new JMXManagedObjectRegistry()); } else { - _managedObjectRegistry = new NoopManagedObjectRegistry(); + setManagedObjectRegistry(new NoopManagedObjectRegistry()); } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/AbstractPlugin.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/AbstractPlugin.java index 671ac12f9d..704e50da5c 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/AbstractPlugin.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/AbstractPlugin.java @@ -32,9 +32,9 @@ import org.apache.qpid.server.security.access.Operation; */ public abstract class AbstractPlugin implements SecurityPlugin { - protected final Logger _logger = Logger.getLogger(getClass()); + private final Logger _logger = Logger.getLogger(getClass()); - protected ConfigurationPlugin _config; + private ConfigurationPlugin _config; public Result getDefault() { @@ -50,4 +50,8 @@ public abstract class AbstractPlugin implements SecurityPlugin _config = config; } + public ConfigurationPlugin getConfig() + { + return _config; + } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java index 02bd573eae..fcd64f3a23 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/Base64MD5PasswordFilePrincipalDatabase.java @@ -62,7 +62,7 @@ public class Base64MD5PasswordFilePrincipalDatabase implements PrincipalDatabase private Map<String, AuthenticationProviderInitialiser> _saslServers; - AMQUserManagementMBean _mbean; + private AMQUserManagementMBean _mbean; public static final String DEFAULT_ENCODING = "utf-8"; private Map<String, HashedUser> _users = new HashMap<String, HashedUser>(); private ReentrantLock _userUpdate = new ReentrantLock(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java index 3690e7f92a..de76e31280 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java @@ -33,9 +33,9 @@ public class HashedUser implements Principal { private static final Logger _logger = Logger.getLogger(HashedUser.class); - String _name; - char[] _password; - byte[] _encodedPassword = null; + private String _name; + private char[] _password; + private byte[] _encodedPassword = null; private boolean _modified = false; private boolean _deleted = false; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractMessageStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractMessageStore.java index 7e6083c60f..fc5d2a4e42 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractMessageStore.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractMessageStore.java @@ -28,7 +28,7 @@ import org.apache.qpid.server.virtualhost.VirtualHost; public abstract class AbstractMessageStore implements MessageStore { - protected LogSubject _logSubject; + private LogSubject _logSubject; public void configure(VirtualHost virtualHost) throws Exception { diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/QpidAcceptor.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/QpidAcceptor.java index abbc5a3805..637ea7dffc 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/QpidAcceptor.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/QpidAcceptor.java @@ -24,8 +24,8 @@ import org.apache.qpid.transport.network.NetworkTransport; public class QpidAcceptor { - NetworkTransport _transport; - String _protocol; + private NetworkTransport _transport; + private String _protocol; public QpidAcceptor(NetworkTransport transport, String protocol) { _transport = transport; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionMBean.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionMBean.java index 7aa0387d0d..3bf799cba6 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionMBean.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionMBean.java @@ -132,7 +132,7 @@ public class ServerConnectionMBean extends AbstractAMQManagedConnectionObject } else if (session.isTransactional()) { - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { session.commit(); @@ -154,7 +154,7 @@ public class ServerConnectionMBean extends AbstractAMQManagedConnectionObject } else if (session.isTransactional()) { - CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger())); + CurrentActor.set(new ManagementActor(getLogActor().getRootMessageLogger())); try { session.rollback(); diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java index 760745f76a..68cb3bce9f 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/HouseKeepingTask.java @@ -28,7 +28,7 @@ import org.apache.qpid.server.logging.actors.CurrentActor; public abstract class HouseKeepingTask implements Runnable { - Logger _logger = Logger.getLogger(this.getClass()); + private Logger _logger = Logger.getLogger(this.getClass()); private VirtualHost _virtualHost; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicy.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicy.java index c17d1b0497..f2f61f204e 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicy.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicy.java @@ -37,7 +37,7 @@ import org.apache.qpid.slowconsumerdetection.policies.SlowConsumerPolicyPluginFa public class TopicDeletePolicy implements SlowConsumerPolicyPlugin { - Logger _logger = Logger.getLogger(TopicDeletePolicy.class); + private Logger _logger = Logger.getLogger(TopicDeletePolicy.class); private TopicDeletePolicyConfiguration _configuration; public static class TopicDeletePolicyFactory implements SlowConsumerPolicyPluginFactory diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/ExtractResendAndRequeueTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/ExtractResendAndRequeueTest.java index 6cf5a02c13..616ee74b2d 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/ExtractResendAndRequeueTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/ExtractResendAndRequeueTest.java @@ -60,7 +60,7 @@ import java.util.Map; public class ExtractResendAndRequeueTest extends TestCase { - UnacknowledgedMessageMapImpl _unacknowledgedMessageMap; + private UnacknowledgedMessageMapImpl _unacknowledgedMessageMap; private static final int INITIAL_MSG_COUNT = 10; private AMQQueue _queue = new MockAMQQueue(getName()); private MessageStore _messageStore = new MemoryMessageStore(); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/plugins/ConfigurationPluginTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/plugins/ConfigurationPluginTest.java index 746feea7a1..14c7b8cb20 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/plugins/ConfigurationPluginTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/plugins/ConfigurationPluginTest.java @@ -68,7 +68,7 @@ public class ConfigurationPluginTest extends InternalBrokerBaseCase } - ConfigPlugin _plugin; + private ConfigPlugin _plugin; @Override public void setUp() throws Exception diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java index d2baa7009b..27a0462e09 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/AbstractHeadersExchangeTestBase.java @@ -76,7 +76,7 @@ public class AbstractHeadersExchangeTestBase extends InternalBrokerBaseCase private MemoryMessageStore _store = new MemoryMessageStore(); - BindingFactory bindingFactory = new BindingFactory(new DurableConfigurationStore.Source() + private BindingFactory bindingFactory = new BindingFactory(new DurableConfigurationStore.Source() { public DurableConfigurationStore getDurableConfigurationStore() @@ -288,7 +288,7 @@ public class AbstractHeadersExchangeTestBase extends InternalBrokerBaseCase static class TestQueue extends SimpleAMQQueue { - final List<HeadersExchangeTest.Message> messages = new ArrayList<HeadersExchangeTest.Message>(); + private final List<HeadersExchangeTest.Message> messages = new ArrayList<HeadersExchangeTest.Message>(); public String toString() { @@ -492,18 +492,15 @@ public class AbstractHeadersExchangeTestBase extends InternalBrokerBaseCase return null; } - @Override public int getDeliveryCount() { return 0; } - @Override public void incrementDeliveryCount() { } - @Override public void decrementDeliveryCount() { } @@ -590,8 +587,8 @@ public class AbstractHeadersExchangeTestBase extends InternalBrokerBaseCase int pos = 0; for(ContentBody body : bodies) { - storedMessage.addContent(pos, ByteBuffer.wrap(body._payload)); - pos += body._payload.length; + storedMessage.addContent(pos, ByteBuffer.wrap(body.getPayload())); + pos += body.getPayload().length; } _incoming = new TestIncomingMessage(getMessageId(),publish, protocolsession); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java index 5df7784db8..326d36df05 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java @@ -28,7 +28,7 @@ import org.apache.qpid.server.virtualhost.VirtualHost; public class HeadersExchangeTest extends AbstractHeadersExchangeTestBase { - AMQProtocolSession _protocolSession; + private AMQProtocolSession _protocolSession; @Override public void setUp() throws Exception diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java index 227bdf089b..dfa31e131f 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java @@ -44,12 +44,12 @@ import org.apache.qpid.server.virtualhost.VirtualHost; public class TopicExchangeTest extends InternalBrokerBaseCase { - TopicExchange _exchange; + private TopicExchange _exchange; - VirtualHost _vhost; - MessageStore _store; + private VirtualHost _vhost; + private MessageStore _store; - InternalTestProtocolSession _protocolSession; + private InternalTestProtocolSession _protocolSession; @Override @@ -409,7 +409,7 @@ public class TopicExchangeTest extends InternalBrokerBaseCase class PublishInfo implements MessagePublishInfo { - AMQShortString _routingkey; + private AMQShortString _routingkey; PublishInfo(AMQShortString routingkey) { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/flow/WindowCreditManagerTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/flow/WindowCreditManagerTest.java index 2011dfbda6..bc651c9748 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/flow/WindowCreditManagerTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/flow/WindowCreditManagerTest.java @@ -24,7 +24,7 @@ import org.apache.qpid.test.utils.QpidTestCase; public class WindowCreditManagerTest extends QpidTestCase { - WindowCreditManager _creditManager; + private WindowCreditManager _creditManager; protected void setUp() throws Exception { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/Log4jMessageLoggerTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/Log4jMessageLoggerTest.java index bc135ad582..e2a6a56ee2 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/Log4jMessageLoggerTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/Log4jMessageLoggerTest.java @@ -35,8 +35,8 @@ import java.util.List; /** Test that the Log4jMessageLogger defaults behave as expected */ public class Log4jMessageLoggerTest extends TestCase { - Level _rootLevel; - Log4jTestAppender _appender; + private Level _rootLevel; + private Log4jTestAppender _appender; @Override public void setUp() throws IOException @@ -242,7 +242,7 @@ public class Log4jMessageLoggerTest extends TestCase */ private class Log4jTestAppender extends AppenderSkeleton { - List<LoggingEvent> _log = new LinkedList<LoggingEvent>(); + private List<LoggingEvent> _log = new LinkedList<LoggingEvent>(); protected void append(LoggingEvent loggingEvent) { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java index 8fc921822c..f73765f5aa 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java @@ -203,7 +203,7 @@ public class CurrentActorTest extends BaseConnectionActorTestCase */ public class LogMessagesWithAConnectionActor extends Thread { - Throwable _exception; + private Throwable _exception; public LogMessagesWithAConnectionActor() { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/ExchangeLogSubjectTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/ExchangeLogSubjectTest.java index 7e16516fc6..cc06b05bf6 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/ExchangeLogSubjectTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/ExchangeLogSubjectTest.java @@ -30,8 +30,8 @@ import org.apache.qpid.server.virtualhost.VirtualHost; */ public class ExchangeLogSubjectTest extends AbstractTestLogSubject { - Exchange _exchange; - VirtualHost _testVhost; + private Exchange _exchange; + private VirtualHost _testVhost; public void setUp() throws Exception { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/MessageStoreLogSubjectTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/MessageStoreLogSubjectTest.java index 2467f62f24..158fb667a9 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/MessageStoreLogSubjectTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/MessageStoreLogSubjectTest.java @@ -28,7 +28,7 @@ import org.apache.qpid.server.virtualhost.VirtualHost; */ public class MessageStoreLogSubjectTest extends AbstractTestLogSubject { - VirtualHost _testVhost; + private VirtualHost _testVhost; public void setUp() throws Exception { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/TestBlankSubject.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/TestBlankSubject.java index 89688e13b3..7684db0b3d 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/TestBlankSubject.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/logging/subjects/TestBlankSubject.java @@ -27,7 +27,7 @@ public class TestBlankSubject extends AbstractLogSubject { public TestBlankSubject() { - _logString = "[TestBlankSubject]"; + setLogString("[TestBlankSubject]"); } } diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/InternalTestProtocolSession.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/InternalTestProtocolSession.java index 623f758c8b..db37cc0965 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/InternalTestProtocolSession.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/InternalTestProtocolSession.java @@ -50,7 +50,7 @@ import java.util.concurrent.atomic.AtomicLong; public class InternalTestProtocolSession extends AMQProtocolEngine implements ProtocolOutputConverter { // ChannelID(LIST) -> LinkedList<Pair> - final Map<Integer, Map<AMQShortString, LinkedList<DeliveryPair>>> _channelDelivers; + private final Map<Integer, Map<AMQShortString, LinkedList<DeliveryPair>>> _channelDelivers; private AtomicInteger _deliveryCount = new AtomicInteger(0); private static final AtomicLong ID_GENERATOR = new AtomicLong(0); @@ -197,11 +197,6 @@ public class InternalTestProtocolSession extends AMQProtocolEngine implements Pr } } - public boolean isClosed() - { - return _closed; - } - public void closeProtocolSession() { // Override as we don't have a real IOSession to close. @@ -230,7 +225,6 @@ public class InternalTestProtocolSession extends AMQProtocolEngine implements Pr } - @Override public void deliverToClient(Subscription sub, QueueEntry entry, long deliveryTag) throws AMQException { _deliveryCount.incrementAndGet(); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java index d3bfb3ab2e..91e35f07de 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java @@ -277,7 +277,7 @@ public class AMQQueueAlertTest extends InternalBrokerBaseCase ContentHeaderBody contentHeaderBody = new ContentHeaderBody(); BasicContentHeaderProperties props = new BasicContentHeaderProperties(); contentHeaderBody.setProperties(props); - contentHeaderBody.bodySize = size; // in bytes + contentHeaderBody.setBodySize(size); // in bytes IncomingMessage message = new IncomingMessage(publish); message.setContentHeaderBody(contentHeaderBody); @@ -309,25 +309,27 @@ public class AMQQueueAlertTest extends InternalBrokerBaseCase for (int i = 0; i < messageCount; i++) { - messages[i].addContentBodyFrame(new ContentChunk(){ + messages[i].addContentBodyFrame( + new ContentChunk() + { - byte[] _data = new byte[(int)size]; + private byte[] _data = new byte[(int)size]; - public int getSize() - { - return (int) size; - } + public int getSize() + { + return (int) size; + } - public byte[] getData() - { - return _data; - } + public byte[] getData() + { + return _data; + } - public void reduceToFit() - { + public void reduceToFit() + { - } - }); + } + }); getQueue().enqueue(new AMQMessage(messages[i].getStoredMessage())); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java index 1b21304b72..337ff194c3 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java @@ -41,8 +41,8 @@ import org.apache.qpid.test.utils.QpidTestCase; public class AMQQueueFactoryTest extends QpidTestCase { - QueueRegistry _queueRegistry; - VirtualHost _virtualHost; + private QueueRegistry _queueRegistry; + private VirtualHost _virtualHost; @Override public void setUp() throws Exception diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java index abaf3dc9ce..933eb3b84f 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java @@ -510,7 +510,7 @@ public class AMQQueueMBeanTest extends InternalBrokerBaseCase }; ContentHeaderBody contentHeaderBody = new ContentHeaderBody(); - contentHeaderBody.bodySize = MESSAGE_SIZE; // in bytes + contentHeaderBody.setBodySize(MESSAGE_SIZE); // in bytes final BasicContentHeaderProperties props = new BasicContentHeaderProperties(); contentHeaderBody.setProperties(props); props.setDeliveryMode((byte) (persistent ? 2 : 1)); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java index 7fe64f0b0c..c82cb9f429 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTest.java @@ -70,7 +70,7 @@ public class SimpleAMQQueueTest extends InternalBrokerBaseCase protected MockSubscription _subscription = new MockSubscription(); protected FieldTable _arguments = null; - MessagePublishInfo info = new MessagePublishInfo() + private MessagePublishInfo info = new MessagePublishInfo() { public AMQShortString getExchange() @@ -198,7 +198,7 @@ public class SimpleAMQQueueTest extends InternalBrokerBaseCase { } assertEquals(messageA, _subscription.getQueueContext().getLastSeenEntry().getMessage()); - assertNull(((QueueContext)_subscription.getQueueContext())._releasedEntry); + assertNull(((QueueContext)_subscription.getQueueContext()).getReleasedEntry()); // Check removing the subscription removes it's information from the queue _queue.unregisterSubscription(_subscription); @@ -220,7 +220,7 @@ public class SimpleAMQQueueTest extends InternalBrokerBaseCase _queue.registerSubscription(_subscription, false); Thread.sleep(150); assertEquals(messageA, _subscription.getQueueContext().getLastSeenEntry().getMessage()); - assertNull("There should be no releasedEntry after an enqueue", ((QueueContext)_subscription.getQueueContext())._releasedEntry); + assertNull("There should be no releasedEntry after an enqueue", ((QueueContext)_subscription.getQueueContext()).getReleasedEntry()); } /** @@ -235,7 +235,7 @@ public class SimpleAMQQueueTest extends InternalBrokerBaseCase _queue.registerSubscription(_subscription, false); Thread.sleep(150); assertEquals(messageB, _subscription.getQueueContext().getLastSeenEntry().getMessage()); - assertNull("There should be no releasedEntry after enqueues", ((QueueContext)_subscription.getQueueContext())._releasedEntry); + assertNull("There should be no releasedEntry after enqueues", ((QueueContext)_subscription.getQueueContext()).getReleasedEntry()); } /** @@ -282,7 +282,7 @@ public class SimpleAMQQueueTest extends InternalBrokerBaseCase assertTrue("Redelivery flag should now be set", queueEntries.get(0).isRedelivered()); assertFalse("Redelivery flag should remain be unset", queueEntries.get(1).isRedelivered()); assertFalse("Redelivery flag should remain be unset",queueEntries.get(2).isRedelivered()); - assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)_subscription.getQueueContext())._releasedEntry); + assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)_subscription.getQueueContext()).getReleasedEntry()); } /** @@ -326,7 +326,7 @@ public class SimpleAMQQueueTest extends InternalBrokerBaseCase assertTrue("Expecting the queue entry to be now expired", queueEntries.get(0).expired()); assertEquals("Total number of messages sent should not have changed", 1, _subscription.getMessages().size()); assertFalse("Redelivery flag should not be set", queueEntries.get(0).isRedelivered()); - assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)_subscription.getQueueContext())._releasedEntry); + assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)_subscription.getQueueContext()).getReleasedEntry()); } @@ -377,7 +377,7 @@ public class SimpleAMQQueueTest extends InternalBrokerBaseCase assertTrue("Redelivery flag should now be set", queueEntries.get(0).isRedelivered()); assertFalse("Redelivery flag should remain be unset", queueEntries.get(1).isRedelivered()); assertTrue("Redelivery flag should now be set",queueEntries.get(2).isRedelivered()); - assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)_subscription.getQueueContext())._releasedEntry); + assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)_subscription.getQueueContext()).getReleasedEntry()); } @@ -420,8 +420,8 @@ public class SimpleAMQQueueTest extends InternalBrokerBaseCase Thread.sleep(150); // Work done by SubFlushRunner/QueueRunner Threads assertEquals("Unexpected total number of messages sent to both subscriptions after release", 3, subscription1.getMessages().size() + subscription2.getMessages().size()); - assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)subscription1.getQueueContext())._releasedEntry); - assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)subscription2.getQueueContext())._releasedEntry); + assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)subscription1.getQueueContext()).getReleasedEntry()); + assertNull("releasedEntry should be cleared after requeue processed", ((QueueContext)subscription2.getQueueContext()).getReleasedEntry()); } public void testExclusiveConsumer() throws AMQException diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryListTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryListTest.java index d7ad82ff77..55c6143124 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryListTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryListTest.java @@ -32,7 +32,7 @@ public class SimpleQueueEntryListTest extends QueueEntryListTestBase private SimpleQueueEntryList _sqel; private static final String SCAVENGE_PROP = "qpid.queue.scavenge_count"; - String oldScavengeValue = null; + private String oldScavengeValue = null; @Override protected void setUp() diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java index abf292b66f..6a8a6dc2d0 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/registry/ApplicationRegistryShutdownTest.java @@ -36,7 +36,7 @@ import java.util.List; public class ApplicationRegistryShutdownTest extends InternalBrokerBaseCase { - Provider[] _defaultProviders; + private Provider[] _defaultProviders; @Override public void setUp() throws Exception { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/HashedUserTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/HashedUserTest.java index 3ff2e53ecb..f687cc4a09 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/HashedUserTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/HashedUserTest.java @@ -30,9 +30,9 @@ import java.io.UnsupportedEncodingException; public class HashedUserTest extends TestCase { - String USERNAME = "username"; - String PASSWORD = "password"; - String B64_ENCODED_PASSWORD = "cGFzc3dvcmQ="; + private String USERNAME = "username"; + private String PASSWORD = "password"; + private String B64_ENCODED_PASSWORD = "cGFzc3dvcmQ="; public void testToLongArrayConstructor() { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/PlainUserTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/PlainUserTest.java index 7f0843d46e..a739f78958 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/PlainUserTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/PlainUserTest.java @@ -28,8 +28,8 @@ import junit.framework.TestCase; public class PlainUserTest extends TestCase { - String USERNAME = "username"; - String PASSWORD = "password"; + private String USERNAME = "username"; + private String PASSWORD = "password"; public void testTooLongArrayConstructor() { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java index 8feff8215f..5fc074d877 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java @@ -71,26 +71,26 @@ public class MessageStoreTest extends InternalBrokerBaseCase public static final String SELECTOR_VALUE = "Test = 'MST'"; public static final String LVQ_KEY = "MST-LVQ-KEY"; - AMQShortString nonDurableExchangeName = new AMQShortString("MST-NonDurableDirectExchange"); - AMQShortString directExchangeName = new AMQShortString("MST-DirectExchange"); - AMQShortString topicExchangeName = new AMQShortString("MST-TopicExchange"); + private AMQShortString nonDurableExchangeName = new AMQShortString("MST-NonDurableDirectExchange"); + private AMQShortString directExchangeName = new AMQShortString("MST-DirectExchange"); + private AMQShortString topicExchangeName = new AMQShortString("MST-TopicExchange"); - AMQShortString durablePriorityTopicQueueName = new AMQShortString("MST-PriorityTopicQueue-Durable"); - AMQShortString durableTopicQueueName = new AMQShortString("MST-TopicQueue-Durable"); - AMQShortString priorityTopicQueueName = new AMQShortString("MST-PriorityTopicQueue"); - AMQShortString topicQueueName = new AMQShortString("MST-TopicQueue"); + private AMQShortString durablePriorityTopicQueueName = new AMQShortString("MST-PriorityTopicQueue-Durable"); + private AMQShortString durableTopicQueueName = new AMQShortString("MST-TopicQueue-Durable"); + private AMQShortString priorityTopicQueueName = new AMQShortString("MST-PriorityTopicQueue"); + private AMQShortString topicQueueName = new AMQShortString("MST-TopicQueue"); - AMQShortString durableExclusiveQueueName = new AMQShortString("MST-Queue-Durable-Exclusive"); - AMQShortString durablePriorityQueueName = new AMQShortString("MST-PriorityQueue-Durable"); - AMQShortString durableLastValueQueueName = new AMQShortString("MST-LastValueQueue-Durable"); - AMQShortString durableQueueName = new AMQShortString("MST-Queue-Durable"); - AMQShortString priorityQueueName = new AMQShortString("MST-PriorityQueue"); - AMQShortString queueName = new AMQShortString("MST-Queue"); + private AMQShortString durableExclusiveQueueName = new AMQShortString("MST-Queue-Durable-Exclusive"); + private AMQShortString durablePriorityQueueName = new AMQShortString("MST-PriorityQueue-Durable"); + private AMQShortString durableLastValueQueueName = new AMQShortString("MST-LastValueQueue-Durable"); + private AMQShortString durableQueueName = new AMQShortString("MST-Queue-Durable"); + private AMQShortString priorityQueueName = new AMQShortString("MST-PriorityQueue"); + private AMQShortString queueName = new AMQShortString("MST-Queue"); - AMQShortString directRouting = new AMQShortString("MST-direct"); - AMQShortString topicRouting = new AMQShortString("MST-topic"); + private AMQShortString directRouting = new AMQShortString("MST-direct"); + private AMQShortString topicRouting = new AMQShortString("MST-topic"); - AMQShortString queueOwner = new AMQShortString("MST"); + private AMQShortString queueOwner = new AMQShortString("MST"); protected PropertiesConfiguration _config; @@ -587,11 +587,7 @@ public class MessageStoreTest extends InternalBrokerBaseCase currentMessage.setExchange(exchange); - ContentHeaderBody headerBody = new ContentHeaderBody(); - headerBody.classId = BasicConsumeBodyImpl.CLASS_ID; - headerBody.bodySize = 0; - - headerBody.setProperties(properties); + ContentHeaderBody headerBody = new ContentHeaderBody(BasicConsumeBodyImpl.CLASS_ID,0,properties,0l); try { diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java index ad8c688f89..e409734a17 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java @@ -34,7 +34,7 @@ import java.util.concurrent.atomic.AtomicInteger; public class TestableMemoryMessageStore extends MemoryMessageStore { - MemoryMessageStore _mms = null; + private MemoryMessageStore _mms = null; private HashMap<Long, AMQQueue> _messages = new HashMap<Long, AMQQueue>(); private AtomicInteger _messageCount = new AtomicInteger(0); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java index 463d1ace7d..9df0aec545 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java @@ -232,7 +232,7 @@ public class InternalBrokerBaseCase extends QpidTestCase //Set the body size ContentHeaderBody _headerBody = new ContentHeaderBody(); - _headerBody.bodySize = 0; + _headerBody.setBodySize(0); //Set Minimum properties BasicContentHeaderProperties properties = new BasicContentHeaderProperties(); diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicyTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicyTest.java index aa13ba64b7..fdd163b323 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicyTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/virtualhost/plugins/policies/TopicDeletePolicyTest.java @@ -39,10 +39,10 @@ import org.apache.qpid.server.virtualhost.VirtualHost; public class TopicDeletePolicyTest extends InternalBrokerBaseCase { - TopicDeletePolicyConfiguration _config; + private TopicDeletePolicyConfiguration _config; - VirtualHost _defaultVhost; - InternalTestProtocolSession _connection; + private VirtualHost _defaultVhost; + private InternalTestProtocolSession _connection; public void setUp() throws Exception { diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/OptionParser.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/OptionParser.java index 9548eab4c5..6cc6db1974 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/OptionParser.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/OptionParser.java @@ -147,8 +147,8 @@ public class OptionParser for (Option option: optDefs) { - if ((op.startsWith("-") && option.shortForm != null && option.shortForm.equals(key)) || - (op.startsWith("--") && option.longForm != null && option.longForm.equals(key)) ) + if ((op.startsWith("-") && option.getShortForm() != null && option.getShortForm().equals(key)) || + (op.startsWith("--") && option.getLongForm() != null && option.getLongForm().equals(key)) ) { match = true; break; @@ -219,18 +219,18 @@ public class OptionParser protected boolean containsOp(Option op) { - return optMap.containsKey(op.shortForm) || optMap.containsKey(op.longForm); + return optMap.containsKey(op.getShortForm()) || optMap.containsKey(op.getLongForm()); } protected String getOp(Option op) { - if (optMap.containsKey(op.shortForm)) + if (optMap.containsKey(op.getShortForm())) { - return (String)optMap.get(op.shortForm); + return (String)optMap.get(op.getShortForm()); } - else if (optMap.containsKey(op.longForm)) + else if (optMap.containsKey(op.getLongForm())) { - return (String)optMap.get(op.longForm); + return (String)optMap.get(op.getLongForm()); } else { @@ -286,12 +286,12 @@ public class OptionParser static class Option { - private String shortForm; - private String longForm; - private String desc; - private String valueLabel; - private String defaultValue; - private Class type; + private final String shortForm; + private final String longForm; + private final String desc; + private final String valueLabel; + private final String defaultValue; + private final Class type; public Option(String shortForm, String longForm, String desc, String valueLabel, String defaultValue, Class type) diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MonitorMessageDispatcher.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MonitorMessageDispatcher.java index 3d16e01af4..2b1e641689 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MonitorMessageDispatcher.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MonitorMessageDispatcher.java @@ -103,7 +103,7 @@ public class MonitorMessageDispatcher // (FileMessageFactory.createSimpleEventMessage(getMonitorPublisher().getSession(),"monitor:" +System.currentTimeMillis())); getMonitorPublisher().sendMessage - (getMonitorPublisher()._session, + (getMonitorPublisher().getSession(), FileMessageFactory.createSimpleEventMessage(getMonitorPublisher().getSession(), "monitor:" + System.currentTimeMillis()), DeliveryMode.PERSISTENT, false, true); diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MonitorPublisher.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MonitorPublisher.java index 750f57d9dc..b2bb0893d8 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MonitorPublisher.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MonitorPublisher.java @@ -36,7 +36,7 @@ public class MonitorPublisher extends Publisher private static final Logger _log = LoggerFactory.getLogger(Publisher.class); - BasicMessageProducer _producer; + private BasicMessageProducer _producer; public MonitorPublisher() { @@ -51,14 +51,14 @@ public class MonitorPublisher extends Publisher { try { - _producer = (BasicMessageProducer) session.createProducer(_destination); + _producer = (BasicMessageProducer) session.createProducer(getDestination()); _producer.send(message, deliveryMode, immediate); if (commit) { //commit the message send and close the transaction - _session.commit(); + getSession().commit(); } } @@ -70,7 +70,7 @@ public class MonitorPublisher extends Publisher throw new UndeliveredMessageException("Cannot deliver immediate message", e); } - _log.info(_name + " finished sending message: " + message); + _log.info(getName() + " finished sending message: " + message); return true; } @@ -81,14 +81,14 @@ public class MonitorPublisher extends Publisher { try { - _producer = (BasicMessageProducer) _session.createProducer(_destination); + _producer = (BasicMessageProducer) getSession().createProducer(getDestination()); //Send message via our producer which is not persistent and is immediate //NB: not available via jms interface MessageProducer _producer.send(message, DeliveryMode.NON_PERSISTENT, true); //commit the message send and close the transaction - _session.commit(); + getSession().commit(); } catch (JMSException e) @@ -99,7 +99,7 @@ public class MonitorPublisher extends Publisher throw new UndeliveredMessageException("Cannot deliver immediate message", e); } - _log.info(_name + " finished sending message: " + message); + _log.info(getName() + " finished sending message: " + message); return true; } } diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/Publisher.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/Publisher.java index b5f44557a4..76531523b9 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/Publisher.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/Publisher.java @@ -34,19 +34,19 @@ public class Publisher protected InitialContextHelper _contextHelper; - protected Connection _connection; + private Connection _connection; - protected Session _session; + private Session _session; - protected MessageProducer _producer; + private MessageProducer _producer; - protected String _destinationDir; + private String _destinationDir; - protected String _name = "Publisher"; + private String _name = "Publisher"; - protected Destination _destination; + private Destination _destination; - protected static final String _defaultDestinationDir = "/tmp"; + private static final String _defaultDestinationDir = "/tmp"; /** * Creates a Publisher instance using properties from example.properties @@ -62,9 +62,9 @@ public class Publisher //then create a connection using the AMQConnectionFactory AMQConnectionFactory cf = (AMQConnectionFactory) ctx.lookup("local"); - _connection = cf.createConnection(); + setConnection(cf.createConnection()); - _connection.setExceptionListener(new ExceptionListener() + getConnection().setExceptionListener(new ExceptionListener() { public void onException(JMSException jmse) { @@ -76,19 +76,19 @@ public class Publisher }); //create a transactional session - _session = _connection.createSession(true, Session.AUTO_ACKNOWLEDGE); + setSession(getConnection().createSession(true, Session.AUTO_ACKNOWLEDGE)); //lookup the example queue and use it //Queue is non-exclusive and not deleted when last consumer detaches - _destination = (Queue) ctx.lookup("MyQueue"); + setDestination((Queue) ctx.lookup("MyQueue")); //create a message producer - _producer = _session.createProducer(_destination); + setProducer(getSession().createProducer(getDestination())); //set destination dir for files that have been processed - _destinationDir = _defaultDestinationDir; + setDestinationDir(get_defaultDestinationDir()); - _connection.start(); + getConnection().start(); } catch (Exception e) { @@ -97,6 +97,11 @@ public class Publisher } } + public static String get_defaultDestinationDir() + { + return _defaultDestinationDir; + } + /** * Creates and sends the number of messages specified in the param */ @@ -104,7 +109,7 @@ public class Publisher { try { - TextMessage txtMessage = _session.createTextMessage("msg"); + TextMessage txtMessage = getSession().createTextMessage("msg"); for (int i=0;i<numMessages;i++) { sendMessage(txtMessage); @@ -128,10 +133,10 @@ public class Publisher try { //Send message via our producer which is not persistent - _producer.send(message, DeliveryMode.PERSISTENT, _producer.getPriority(), _producer.getTimeToLive()); + getProducer().send(message, DeliveryMode.PERSISTENT, getProducer().getPriority(), getProducer().getTimeToLive()); //commit the message send and close the transaction - _session.commit(); + getSession().commit(); } catch (JMSException e) @@ -139,7 +144,7 @@ public class Publisher //Have to assume our commit failed and rollback here try { - _session.rollback(); + getSession().rollback(); _log.error("JMSException", e); e.printStackTrace(); return false; @@ -162,13 +167,13 @@ public class Publisher { try { - if (_connection != null) + if (getConnection() != null) { - _connection.stop(); - _connection.close(); + getConnection().stop(); + getConnection().close(); } - _connection = null; - _producer = null; + setConnection(null); + setProducer(null); } catch(Exception e) { @@ -204,5 +209,41 @@ public class Publisher public void setName(String _name) { this._name = _name; } + + + public Connection getConnection() + { + return _connection; + } + + public void setConnection(Connection connection) + { + _connection = connection; + } + + public void setSession(Session session) + { + _session = session; + } + + public MessageProducer getProducer() + { + return _producer; + } + + public void setProducer(MessageProducer producer) + { + _producer = producer; + } + + public Destination getDestination() + { + return _destination; + } + + public void setDestination(Destination destination) + { + _destination = destination; + } } diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/TopicPublisher.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/TopicPublisher.java index 8645e41101..953a875912 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/TopicPublisher.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/TopicPublisher.java @@ -18,7 +18,6 @@ */ package org.apache.qpid.example.publisher; -import org.apache.qpid.client.BasicMessageProducer; import org.apache.qpid.example.shared.InitialContextHelper; import org.slf4j.LoggerFactory; import org.slf4j.Logger; @@ -44,10 +43,10 @@ public class TopicPublisher extends Publisher InitialContext ctx = _contextHelper.getInitialContext(); //lookup the example topic and use it - _destination = (Topic) ctx.lookup("MyTopic"); + setDestination((Topic) ctx.lookup("MyTopic")); //create a message producer - _producer = _session.createProducer(_destination); + setProducer(getSession().createProducer(getDestination())); } catch (Exception e) { diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Client.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Client.java index e32ee0ba73..5b0f4757ca 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Client.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Client.java @@ -31,11 +31,11 @@ import javax.naming.NamingException; */ public abstract class Client { - protected ConnectionSetup _setup; + private ConnectionSetup _setup; - protected Connection _connection; - protected Destination _destination; - protected Session _session; + private Connection _connection; + private Destination _destination; + private Session _session; public Client(String destination) { @@ -69,4 +69,28 @@ public abstract class Client public abstract void start(); + public ConnectionSetup getSetup() + { + return _setup; + } + + public Connection getConnection() + { + return _connection; + } + + public Destination getDestination() + { + return _destination; + } + + public Session getSession() + { + return _session; + } + + public void setSession(Session session) + { + _session = session; + } }
\ No newline at end of file diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Publisher.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Publisher.java index ac3829d49e..f35d56c702 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Publisher.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Publisher.java @@ -36,7 +36,7 @@ import javax.jms.Session; */ public class Publisher extends Client { - int _msgCount; + private int _msgCount; public Publisher(String destination, int msgCount) { @@ -48,18 +48,18 @@ public class Publisher extends Client { try { - _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + setSession(getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE)); - MessageProducer _producer = _session.createProducer(_destination); + MessageProducer _producer = getSession().createProducer(getDestination()); for (int msgCount = 0; msgCount < _msgCount; msgCount++) { - _producer.send(_session.createTextMessage("msg:" + msgCount)); + _producer.send(getSession().createTextMessage("msg:" + msgCount)); System.out.println("Sent:" + msgCount); } System.out.println("Done."); - _connection.close(); + getConnection().close(); } catch (JMSException e) { diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Subscriber.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Subscriber.java index f2d736701f..1d7fc43b9c 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Subscriber.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Subscriber.java @@ -41,7 +41,7 @@ import java.util.concurrent.CountDownLatch; public class Subscriber extends Client implements MessageListener { - CountDownLatch _count; + private CountDownLatch _count; public Subscriber(String destination, int msgCount) { @@ -54,16 +54,16 @@ public class Subscriber extends Client implements MessageListener { try { - _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + setSession(getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE)); - _session.createDurableSubscriber((Topic) _setup.getDestination(ConnectionSetup.TOPIC_JNDI_NAME), - "exampleClient").setMessageListener(this); - _connection.start(); + getSession().createDurableSubscriber((Topic) getSetup().getDestination(ConnectionSetup.TOPIC_JNDI_NAME), + "exampleClient").setMessageListener(this); + getConnection().start(); _count.await(); System.out.println("Done"); - _connection.close(); + getConnection().close(); } catch (JMSException e) { diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Client.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Client.java index 8a0ff88448..ee52e8b9ea 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Client.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Client.java @@ -40,15 +40,15 @@ import java.util.concurrent.CountDownLatch; public class Client implements MessageListener { - final String BROKER = "localhost"; + private final String BROKER = "localhost"; - final String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; + private final String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; - final String CONNECTION_JNDI_NAME = "local"; - final String CONNECTION_NAME = "amqp://guest:guest@clientid/test?brokerlist='" + BROKER + "'"; + private final String CONNECTION_JNDI_NAME = "local"; + private final String CONNECTION_NAME = "amqp://guest:guest@clientid/test?brokerlist='" + BROKER + "'"; - final String QUEUE_JNDI_NAME = "queue"; - final String QUEUE_NAME = "example.RequestQueue"; + private final String QUEUE_JNDI_NAME = "queue"; + private final String QUEUE_NAME = "example.RequestQueue"; private InitialContext _ctx; diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java index 9c284eee97..88e8ca1f45 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java @@ -45,15 +45,15 @@ import java.io.IOException; public class Server implements MessageListener { - final String BROKER = "localhost"; + private final String BROKER = "localhost"; - final String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; + private final String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; - final String CONNECTION_JNDI_NAME = "local"; - final String CONNECTION_NAME = "amqp://guest:guest@clientid/test?brokerlist='" + BROKER + "'"; + private final String CONNECTION_JNDI_NAME = "local"; + private final String CONNECTION_NAME = "amqp://guest:guest@clientid/test?brokerlist='" + BROKER + "'"; - final String QUEUE_JNDI_NAME = "queue"; - final String QUEUE_NAME = "example.RequestQueue"; + private final String QUEUE_JNDI_NAME = "queue"; + private final String QUEUE_NAME = "example.RequestQueue"; private InitialContext _ctx; diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java index 746d5b8f34..6c684e593d 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java @@ -106,7 +106,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect * the handler deals with this. It also deals with the initial dispatch of any protocol frames to their appropriate * handler. */ - protected AMQProtocolHandler _protocolHandler; + private AMQProtocolHandler _protocolHandler; /** Maps from session id (Integer) to AMQSession instance */ private final ChannelToSessionMap _sessions = new ChannelToSessionMap(); @@ -122,7 +122,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect /** The virtual path to connect to on the AMQ server */ private String _virtualHost; - protected ExceptionListener _exceptionListener; + private ExceptionListener _exceptionListener; private ConnectionListener _connectionListener; @@ -132,15 +132,15 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect * Whether this connection is started, i.e. whether messages are flowing to consumers. It has no meaning for message * publication. */ - protected volatile boolean _started; + private volatile boolean _started; /** Policy dictating how to failover */ - protected FailoverPolicy _failoverPolicy; + private FailoverPolicy _failoverPolicy; /* * _Connected should be refactored with a suitable wait object. */ - protected boolean _connected; + private boolean _connected; /* * The connection meta data @@ -156,7 +156,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect private final ExecutorService _taskPool = Executors.newCachedThreadPool(); private static final long DEFAULT_TIMEOUT = 1000 * 30; - protected AMQConnectionDelegate _delegate; + private AMQConnectionDelegate _delegate; // this connection maximum number of prefetched messages private int _maxPrefetch; @@ -346,11 +346,11 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect _logger.info("Connecting with ProtocolHandler Version:"+_protocolHandler.getProtocolVersion()); // We are not currently connected - _connected = false; + setConnected(false); boolean retryAllowed = true; Exception connectionException = null; - while (!_connected && retryAllowed && brokerDetails != null) + while (!isConnected() && retryAllowed && brokerDetails != null) { ProtocolVersion pe = null; try @@ -374,7 +374,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect // broker initDelegate(pe); } - else if (!_connected) + else if (!isConnected()) { retryAllowed = _failoverPolicy.failoverAllowed(); brokerDetails = _failoverPolicy.getNextBrokerDetails(); @@ -384,10 +384,10 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect if (_logger.isDebugEnabled()) { - _logger.debug("Are we connected:" + _connected); + _logger.debug("Are we connected:" + isConnected()); } - if (!_connected) + if (!isConnected()) { if (_logger.isDebugEnabled()) { @@ -590,7 +590,7 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect public boolean failoverAllowed() { - if (!_connected) + if (!isConnected()) { return false; } @@ -729,6 +729,11 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect } + protected final ExceptionListener getExceptionListenerNoCheck() + { + return _exceptionListener; + } + public ExceptionListener getExceptionListener() throws JMSException { checkNotClosed(); @@ -1048,16 +1053,26 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect return _virtualHost; } - public AMQProtocolHandler getProtocolHandler() + public final AMQProtocolHandler getProtocolHandler() { return _protocolHandler; } - public boolean started() + public final boolean started() { return _started; } + protected final boolean isConnected() + { + return _connected; + } + + protected final void setConnected(boolean connected) + { + _connected = connected; + } + public void bytesSent(long writtenBytes) { if (_connectionListener != null) @@ -1489,4 +1504,8 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect return _lastFailoverTime; } + protected AMQConnectionDelegate getDelegate() + { + return _delegate; + } } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java index 74475c0bc1..a18a3fcbd4 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java @@ -71,7 +71,7 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec /** * The QpidConeection instance that is mapped with this JMS connection. */ - org.apache.qpid.transport.Connection _qpidConnection; + private org.apache.qpid.transport.Connection _qpidConnection; private ConnectionException exception = null; //--- constructor @@ -109,7 +109,7 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec session = new AMQSession_0_10(_qpidConnection, _conn, channelId, transacted, acknowledgeMode, prefetchHigh, prefetchLow,name); _conn.registerSession(channelId, session); - if (_conn._started) + if (_conn.started()) { session.start(); } @@ -152,7 +152,7 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec { session = new XASessionImpl(_qpidConnection, _conn, channelId, prefetchHigh, prefetchLow); _conn.registerSession(channelId, session); - if (_conn._started) + if (_conn.started()) { session.start(); } @@ -164,7 +164,6 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec return session; } - @Override public XASession createXASession(int ackMode) throws JMSException { @@ -182,7 +181,7 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec { session = new XASessionImpl(_qpidConnection, _conn, channelId, ackMode, (int)_conn.getMaxPrefetch(), (int)_conn.getMaxPrefetch() / 2); _conn.registerSession(channelId, session); - if (_conn._started) + if (_conn.started()) { session.start(); } @@ -218,10 +217,10 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec _qpidConnection.setConnectionDelegate(new ClientConnectionDelegate(conSettings, _conn.getConnectionURL())); _qpidConnection.connect(conSettings); - _conn._connected = true; + _conn.setConnected(true); _conn.setUsername(_qpidConnection.getUserID()); _conn.setMaximumChannelCount(_qpidConnection.getChannelMax()); - _conn._failoverPolicy.attainedConnection(); + _conn.getFailoverPolicy().attainedConnection(); } catch (ProtocolVersionException pe) { @@ -327,7 +326,7 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec } } - ExceptionListener listener = _conn._exceptionListener; + ExceptionListener listener = _conn.getExceptionListenerNoCheck(); if (listener == null) { _logger.error("connection exception: " + conn, exc); diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java index 287e4f3859..5068b1bc50 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java @@ -120,7 +120,7 @@ public class AMQConnectionDelegate_8_0 implements AMQConnectionDelegate EnumSet.of(AMQState.CONNECTION_OPEN, AMQState.CONNECTION_CLOSED); - StateWaiter waiter = _conn._protocolHandler.createWaiter(openOrClosedStates); + StateWaiter waiter = _conn.getProtocolHandler().createWaiter(openOrClosedStates); ConnectionSettings settings = brokerDetail.buildConnectionSettings(); settings.setProtocol(brokerDetail.getTransport()); @@ -148,9 +148,9 @@ public class AMQConnectionDelegate_8_0 implements AMQConnectionDelegate SecurityLayer securityLayer = SecurityLayerFactory.newInstance(settings); OutgoingNetworkTransport transport = Transport.getOutgoingTransportInstance(getProtocolVersion()); - NetworkConnection network = transport.connect(settings, securityLayer.receiver(_conn._protocolHandler), sslContext); - _conn._protocolHandler.setNetworkConnection(network, securityLayer.sender(network.getSender())); - _conn._protocolHandler.getProtocolSession().init(); + NetworkConnection network = transport.connect(settings, securityLayer.receiver(_conn.getProtocolHandler()), sslContext); + _conn.getProtocolHandler().setNetworkConnection(network, securityLayer.sender(network.getSender())); + _conn.getProtocolHandler().getProtocolSession().init(); // this blocks until the connection has been set up or when an error // has prevented the connection being set up @@ -158,13 +158,13 @@ public class AMQConnectionDelegate_8_0 implements AMQConnectionDelegate if(state == AMQState.CONNECTION_OPEN) { - _conn._failoverPolicy.attainedConnection(); - _conn._connected = true; + _conn.getFailoverPolicy().attainedConnection(); + _conn.setConnected(true); return null; } else { - return _conn._protocolHandler.getSuggestedProtocolVersion(); + return _conn.getProtocolHandler().getSuggestedProtocolVersion(); } } @@ -237,7 +237,7 @@ public class AMQConnectionDelegate_8_0 implements AMQConnectionDelegate } } - if (_conn._started) + if (_conn.started()) { try { @@ -271,12 +271,12 @@ public class AMQConnectionDelegate_8_0 implements AMQConnectionDelegate { ChannelOpenBody channelOpenBody = _conn.getProtocolHandler().getMethodRegistry().createChannelOpenBody(null); // TODO: Be aware of possible changes to parameter order as versions change. - _conn._protocolHandler.syncWrite(channelOpenBody.generateFrame(channelId), ChannelOpenOkBody.class); + _conn.getProtocolHandler().syncWrite(channelOpenBody.generateFrame(channelId), ChannelOpenOkBody.class); // todo send low water mark when protocol allows. // todo Be aware of possible changes to parameter order as versions change. BasicQosBody basicQosBody = _conn.getProtocolHandler().getMethodRegistry().createBasicQosBody(0,prefetchHigh,false); - _conn._protocolHandler.syncWrite(basicQosBody.generateFrame(channelId),BasicQosOkBody.class); + _conn.getProtocolHandler().syncWrite(basicQosBody.generateFrame(channelId),BasicQosOkBody.class); if (transacted) { @@ -287,7 +287,7 @@ public class AMQConnectionDelegate_8_0 implements AMQConnectionDelegate TxSelectBody body = _conn.getProtocolHandler().getMethodRegistry().createTxSelectBody(); // TODO: Be aware of possible changes to parameter order as versions change. - _conn._protocolHandler.syncWrite(body.generateFrame(channelId), TxSelectOkBody.class); + _conn.getProtocolHandler().syncWrite(body.generateFrame(channelId), TxSelectOkBody.class); } } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java index 76828afd6a..9e19cc8969 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java @@ -48,15 +48,15 @@ public abstract class AMQDestination implements Destination, Referenceable { private static final Logger _logger = LoggerFactory.getLogger(AMQDestination.class); - protected AMQShortString _exchangeName; + private AMQShortString _exchangeName; - protected AMQShortString _exchangeClass; + private AMQShortString _exchangeClass; - protected boolean _isDurable; + private boolean _isDurable; - protected boolean _isExclusive; + private boolean _isExclusive; - protected boolean _isAutoDelete; + private boolean _isAutoDelete; private boolean _browseOnly; @@ -81,6 +81,41 @@ public abstract class AMQDestination implements Destination, Referenceable public static final int TOPIC_TYPE = 2; public static final int UNKNOWN_TYPE = 3; + protected void setExclusive(boolean exclusive) + { + _isExclusive = exclusive; + } + + protected AddressHelper getAddrHelper() + { + return _addrHelper; + } + + protected void setAddrHelper(AddressHelper addrHelper) + { + _addrHelper = addrHelper; + } + + protected String getName() + { + return _name; + } + + protected void setName(String name) + { + _name = name; + } + + protected Link getTargetLink() + { + return _targetLink; + } + + protected void setTargetLink(Link targetLink) + { + _targetLink = targetLink; + } + // ----- Fields required to support new address syntax ------- public enum DestSyntax { @@ -132,23 +167,23 @@ public abstract class AMQDestination implements Destination, Referenceable } } - protected final static DestSyntax defaultDestSyntax; + private final static DestSyntax defaultDestSyntax; - protected DestSyntax _destSyntax = DestSyntax.ADDR; + private DestSyntax _destSyntax = DestSyntax.ADDR; - protected AddressHelper _addrHelper; - protected Address _address; - protected int _addressType = AMQDestination.UNKNOWN_TYPE; - protected String _name; - protected String _subject; - protected AddressOption _create = AddressOption.NEVER; - protected AddressOption _assert = AddressOption.NEVER; - protected AddressOption _delete = AddressOption.NEVER; + private AddressHelper _addrHelper; + private Address _address; + private int _addressType = AMQDestination.UNKNOWN_TYPE; + private String _name; + private String _subject; + private AddressOption _create = AddressOption.NEVER; + private AddressOption _assert = AddressOption.NEVER; + private AddressOption _delete = AddressOption.NEVER; - protected Node _targetNode; - protected Node _sourceNode; - protected Link _targetLink; - protected Link _link; + private Node _targetNode; + private Node _sourceNode; + private Link _targetLink; + private Link _link; // ----- / Fields required to support new address syntax ------- @@ -646,10 +681,10 @@ public abstract class AMQDestination implements Destination, Referenceable public static class Binding { - String exchange; - String bindingKey; - String queue; - Map<String,Object> args; + private String exchange; + private String bindingKey; + private String queue; + private Map<String,Object> args; public Binding(String exchange, String queue, @@ -902,4 +937,5 @@ public abstract class AMQDestination implements Destination, Referenceable return _rejectBehaviour; } + } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java index 3f9eadeef3..465d858091 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java @@ -108,7 +108,7 @@ public class AMQQueueBrowser implements QueueBrowser private class QueueBrowserEnumeration implements Enumeration { - Message _nextMessage; + private Message _nextMessage; private BasicMessageConsumer _consumer; public QueueBrowserEnumeration(BasicMessageConsumer consumer) throws JMSException diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueSessionAdaptor.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueSessionAdaptor.java index c59eba60b8..d1c796c34a 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueSessionAdaptor.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQQueueSessionAdaptor.java @@ -31,7 +31,7 @@ import java.io.Serializable; public class AMQQueueSessionAdaptor implements QueueSession, AMQSessionAdapter { //holds a session for delegation - protected final AMQSession _session; + private final AMQSession _session; /** * Construct an adaptor with a session to wrap diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index cca76ebac5..92579c31f0 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -96,6 +96,166 @@ import java.util.concurrent.locks.ReentrantLock; */ public abstract class AMQSession<C extends BasicMessageConsumer, P extends BasicMessageProducer> extends Closeable implements Session, QueueSession, TopicSession { + /** + * Used to reference durable subscribers so that requests for unsubscribe can be handled correctly. Note this only + * keeps a record of subscriptions which have been created in the current instance. It does not remember + * subscriptions between executions of the client. + */ + protected ConcurrentHashMap<String, TopicSubscriberAdaptor<C>> getSubscriptions() + { + return _subscriptions; + } + + /** + * Holds a mapping from message consumers to their identifying names, so that their subscriptions may be looked + * up in the {@link #_subscriptions} map. + */ + protected ConcurrentHashMap<C, String> getReverseSubscriptionMap() + { + return _reverseSubscriptionMap; + } + + /** + * Locks to keep access to subscriber details atomic. + * <p> + * Added for QPID2418 + */ + protected Lock getSubscriberDetails() + { + return _subscriberDetails; + } + + protected Lock getSubscriberAccess() + { + return _subscriberAccess; + } + + /** + * Used to hold incoming messages. + * + * @todo Weaken the type once {@link org.apache.qpid.client.util.FlowControllingBlockingQueue} implements Queue. + */ + protected FlowControllingBlockingQueue getQueue() + { + return _queue; + } + + /** Holds the highest received delivery tag. */ + protected AtomicLong getHighestDeliveryTag() + { + return _highestDeliveryTag; + } + + /** Pre-fetched message tags */ + protected ConcurrentLinkedQueue<Long> getPrefetchedMessageTags() + { + return _prefetchedMessageTags; + } + + protected void setPrefetchedMessageTags(ConcurrentLinkedQueue<Long> prefetchedMessageTags) + { + _prefetchedMessageTags = prefetchedMessageTags; + } + + /** All the not yet acknowledged message tags */ + protected ConcurrentLinkedQueue<Long> getUnacknowledgedMessageTags() + { + return _unacknowledgedMessageTags; + } + + protected void setUnacknowledgedMessageTags(ConcurrentLinkedQueue<Long> unacknowledgedMessageTags) + { + _unacknowledgedMessageTags = unacknowledgedMessageTags; + } + + /** All the delivered message tags */ + protected ConcurrentLinkedQueue<Long> getDeliveredMessageTags() + { + return _deliveredMessageTags; + } + + protected void setDeliveredMessageTags(ConcurrentLinkedQueue<Long> deliveredMessageTags) + { + _deliveredMessageTags = deliveredMessageTags; + } + + /** Holds the dispatcher thread for this session. */ + protected Dispatcher getDispatcher() + { + return _dispatcher; + } + + protected void setDispatcher(Dispatcher dispatcher) + { + _dispatcher = dispatcher; + } + + protected Thread getDispatcherThread() + { + return _dispatcherThread; + } + + protected void setDispatcherThread(Thread dispatcherThread) + { + _dispatcherThread = dispatcherThread; + } + + /** Holds the message factory factory for this session. */ + protected MessageFactoryRegistry getMessageFactoryRegistry() + { + return _messageFactoryRegistry; + } + + protected void setMessageFactoryRegistry(MessageFactoryRegistry messageFactoryRegistry) + { + _messageFactoryRegistry = messageFactoryRegistry; + } + + /** + * Maps from identifying tags to message consumers, in order to pass dispatch incoming messages to the right + * consumer. + */ + protected IdToConsumerMap<C> getConsumers() + { + return _consumers; + } + + /** + * Set when the dispatcher should direct incoming messages straight into the UnackedMessage list instead of + * to the syncRecieveQueue or MessageListener. Used during cleanup, e.g. in Session.recover(). + */ + protected boolean isUsingDispatcherForCleanup() + { + return _usingDispatcherForCleanup; + } + + protected void setUsingDispatcherForCleanup(boolean usingDispatcherForCleanup) + { + _usingDispatcherForCleanup = usingDispatcherForCleanup; + } + + /** + * Used to ensure that only the first call to start the dispatcher can unsuspend the channel. + * + * @todo This is accessed only within a synchronized method, so does not need to be atomic. + */ + protected AtomicBoolean getFirstDispatcher() + { + return _firstDispatcher; + } + + /** Used to indicate that the session should start pre-fetching messages as soon as it is started. */ + protected boolean isImmediatePrefetch() + { + return _immediatePrefetch; + } + + /** Indicates that runtime exceptions should be generated on vilations of the strict AMQP. */ + protected boolean isStrictAMQPFATAL() + { + return _strictAMQPFATAL; + } + public static final class IdToConsumerMap<C extends BasicMessageConsumer> { private final BasicMessageConsumer[] _fastAccessConsumers = new BasicMessageConsumer[16]; @@ -173,8 +333,6 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic } } - final AMQSession<C, P> _thisSession = this; - /** Used for debugging. */ private static final Logger _logger = LoggerFactory.getLogger(AMQSession.class); @@ -182,34 +340,34 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic * The default value for immediate flag used by producers created by this session is false. That is, a consumer does * not need to be attached to a queue. */ - protected final boolean DEFAULT_IMMEDIATE = Boolean.parseBoolean(System.getProperty("qpid.default_immediate", "false")); + private final boolean _defaultImmediateValue = Boolean.parseBoolean(System.getProperty("qpid.default_immediate", "false")); /** * The default value for mandatory flag used by producers created by this session is true. That is, server will not * silently drop messages where no queue is connected to the exchange for the message. */ - protected final boolean DEFAULT_MANDATORY = Boolean.parseBoolean(System.getProperty("qpid.default_mandatory", "true")); + private final boolean _defaultMandatoryValue = Boolean.parseBoolean(System.getProperty("qpid.default_mandatory", "true")); /** * The period to wait while flow controlled before sending a log message confirming that the session is still * waiting on flow control being revoked */ - protected final long FLOW_CONTROL_WAIT_PERIOD = Long.getLong("qpid.flow_control_wait_notify_period",5000L); + private final long _flowControlWaitPeriod = Long.getLong("qpid.flow_control_wait_notify_period",5000L); /** * The period to wait while flow controlled before declaring a failure */ public static final long DEFAULT_FLOW_CONTROL_WAIT_FAILURE = 120000L; - protected final long FLOW_CONTROL_WAIT_FAILURE = Long.getLong("qpid.flow_control_wait_failure", + private final long _flowControlWaitFailure = Long.getLong("qpid.flow_control_wait_failure", DEFAULT_FLOW_CONTROL_WAIT_FAILURE); - protected final boolean DECLARE_QUEUES = + private final boolean _delareQueues = Boolean.parseBoolean(System.getProperty("qpid.declare_queues", "true")); - protected final boolean DECLARE_EXCHANGES = + private final boolean _declareExchanges = Boolean.parseBoolean(System.getProperty("qpid.declare_exchanges", "true")); - protected final boolean USE_AMQP_ENCODED_MAP_MESSAGE; + private final boolean _useAMQPEncodedMapMessage; /** System property to enable strict AMQP compliance. */ public static final String STRICT_AMQP = "STRICT_AMQP"; @@ -230,16 +388,16 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic public static final String IMMEDIATE_PREFETCH_DEFAULT = "false"; /** The connection to which this session belongs. */ - protected AMQConnection _connection; + private AMQConnection _connection; /** Used to indicate whether or not this is a transactional session. */ - protected final boolean _transacted; + private final boolean _transacted; /** Holds the sessions acknowledgement mode. */ - protected final int _acknowledgeMode; + private final int _acknowledgeMode; /** Holds this session unique identifier, used to distinguish it from other sessions. */ - protected int _channelId; + private int _channelId; private int _ticket; @@ -255,55 +413,30 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic /** Used to indicate that this session has been started at least once. */ private AtomicBoolean _startedAtLeastOnce = new AtomicBoolean(false); - /** - * Used to reference durable subscribers so that requests for unsubscribe can be handled correctly. Note this only - * keeps a record of subscriptions which have been created in the current instance. It does not remember - * subscriptions between executions of the client. - */ - protected final ConcurrentHashMap<String, TopicSubscriberAdaptor<C>> _subscriptions = + private final ConcurrentHashMap<String, TopicSubscriberAdaptor<C>> _subscriptions = new ConcurrentHashMap<String, TopicSubscriberAdaptor<C>>(); - /** - * Holds a mapping from message consumers to their identifying names, so that their subscriptions may be looked - * up in the {@link #_subscriptions} map. - */ - protected final ConcurrentHashMap<C, String> _reverseSubscriptionMap = new ConcurrentHashMap<C, String>(); + private final ConcurrentHashMap<C, String> _reverseSubscriptionMap = new ConcurrentHashMap<C, String>(); - /** - * Locks to keep access to subscriber details atomic. - * <p> - * Added for QPID2418 - */ - protected final Lock _subscriberDetails = new ReentrantLock(true); - protected final Lock _subscriberAccess = new ReentrantLock(true); + private final Lock _subscriberDetails = new ReentrantLock(true); + private final Lock _subscriberAccess = new ReentrantLock(true); - /** - * Used to hold incoming messages. - * - * @todo Weaken the type once {@link FlowControllingBlockingQueue} implements Queue. - */ - protected final FlowControllingBlockingQueue _queue; + private final FlowControllingBlockingQueue _queue; - /** Holds the highest received delivery tag. */ - protected final AtomicLong _highestDeliveryTag = new AtomicLong(-1); + private final AtomicLong _highestDeliveryTag = new AtomicLong(-1); private final AtomicLong _rollbackMark = new AtomicLong(-1); - /** Pre-fetched message tags */ - protected ConcurrentLinkedQueue<Long> _prefetchedMessageTags = new ConcurrentLinkedQueue<Long>(); + private ConcurrentLinkedQueue<Long> _prefetchedMessageTags = new ConcurrentLinkedQueue<Long>(); - /** All the not yet acknowledged message tags */ - protected ConcurrentLinkedQueue<Long> _unacknowledgedMessageTags = new ConcurrentLinkedQueue<Long>(); + private ConcurrentLinkedQueue<Long> _unacknowledgedMessageTags = new ConcurrentLinkedQueue<Long>(); - /** All the delivered message tags */ - protected ConcurrentLinkedQueue<Long> _deliveredMessageTags = new ConcurrentLinkedQueue<Long>(); + private ConcurrentLinkedQueue<Long> _deliveredMessageTags = new ConcurrentLinkedQueue<Long>(); - /** Holds the dispatcher thread for this session. */ - protected Dispatcher _dispatcher; + private Dispatcher _dispatcher; - protected Thread _dispatcherThread; + private Thread _dispatcherThread; - /** Holds the message factory factory for this session. */ - protected MessageFactoryRegistry _messageFactoryRegistry; + private MessageFactoryRegistry _messageFactoryRegistry; /** Holds all of the producers created by this session, keyed by their unique identifiers. */ private Map<Long, MessageProducer> _producers = new ConcurrentHashMap<Long, MessageProducer>(); @@ -314,11 +447,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic */ private int _nextTag = 1; - /** - * Maps from identifying tags to message consumers, in order to pass dispatch incoming messages to the right - * consumer. - */ - protected final IdToConsumerMap<C> _consumers = new IdToConsumerMap<C>(); + private final IdToConsumerMap<C> _consumers = new IdToConsumerMap<C>(); /** * Contains a list of consumers which have been removed but which might still have @@ -344,11 +473,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic */ private volatile boolean _sessionInRecovery; - /** - * Set when the dispatcher should direct incoming messages straight into the UnackedMessage list instead of - * to the syncRecieveQueue or MessageListener. Used during cleanup, e.g. in Session.recover(). - */ - protected volatile boolean _usingDispatcherForCleanup; + private volatile boolean _usingDispatcherForCleanup; /** Used to indicates that the connection to which this session belongs, has been stopped. */ private boolean _connectionStopped; @@ -365,21 +490,13 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic */ private final Object _suspensionLock = new Object(); - /** - * Used to ensure that only the first call to start the dispatcher can unsuspend the channel. - * - * @todo This is accessed only within a synchronized method, so does not need to be atomic. - */ - protected final AtomicBoolean _firstDispatcher = new AtomicBoolean(true); + private final AtomicBoolean _firstDispatcher = new AtomicBoolean(true); - /** Used to indicate that the session should start pre-fetching messages as soon as it is started. */ - protected final boolean _immediatePrefetch; + private final boolean _immediatePrefetch; - /** Indicates that warnings should be generated on violations of the strict AMQP. */ - protected final boolean _strictAMQP; + private final boolean _strictAMQP; - /** Indicates that runtime exceptions should be generated on vilations of the strict AMQP. */ - protected final boolean _strictAMQPFATAL; + private final boolean _strictAMQPFATAL; private final Object _messageDeliveryLock = new Object(); /** Session state : used to detect if commit is a) required b) allowed , i.e. does the tx span failover. */ @@ -420,7 +537,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic protected AMQSession(AMQConnection con, int channelId, boolean transacted, int acknowledgeMode, MessageFactoryRegistry messageFactoryRegistry, int defaultPrefetchHighMark, int defaultPrefetchLowMark) { - USE_AMQP_ENCODED_MAP_MESSAGE = con == null ? true : !con.isUseLegacyMapMessageFormat(); + _useAMQPEncodedMapMessage = con == null ? true : !con.isUseLegacyMapMessageFormat(); _strictAMQP = Boolean.parseBoolean(System.getProperties().getProperty(STRICT_AMQP, STRICT_AMQP_DEFAULT)); _strictAMQPFATAL = Boolean.parseBoolean(System.getProperties().getProperty(STRICT_AMQP_FATAL, STRICT_AMQP_FATAL_DEFAULT)); @@ -456,7 +573,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic { // If the session has been closed don't waste time creating a thread to do // flow control - if (!(_thisSession.isClosed() || _thisSession.isClosing())) + if (!(AMQSession.this.isClosed() || AMQSession.this.isClosing())) { // Only execute change if previous state // was False @@ -484,7 +601,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic { // If the session has been closed don't waste time creating a thread to do // flow control - if (!(_thisSession.isClosed() || _thisSession.isClosing())) + if (!(AMQSession.this.isClosed() || AMQSession.this.isClosing())) { // Only execute change if previous state // was true @@ -1136,7 +1253,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic public MapMessage createMapMessage() throws JMSException { checkNotClosed(); - if (USE_AMQP_ENCODED_MAP_MESSAGE) + if (_useAMQPEncodedMapMessage) { AMQPEncodedMapMessage msg = new AMQPEncodedMapMessage(getMessageDelegateFactory()); msg.setAMQSession(this); @@ -1173,12 +1290,12 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic public P createProducer(Destination destination) throws JMSException { - return createProducerImpl(destination, DEFAULT_MANDATORY, DEFAULT_IMMEDIATE); + return createProducerImpl(destination, _defaultMandatoryValue, _defaultImmediateValue); } public P createProducer(Destination destination, boolean immediate) throws JMSException { - return createProducerImpl(destination, DEFAULT_MANDATORY, immediate); + return createProducerImpl(destination, _defaultMandatoryValue, immediate); } public P createProducer(Destination destination, boolean mandatory, boolean immediate) @@ -1625,6 +1742,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic return (counter != null) && (counter.get() != 0); } + /** Indicates that warnings should be generated on violations of the strict AMQP. */ public boolean isStrictAMQP() { return _strictAMQP; @@ -2915,12 +3033,12 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic } else { - if (DECLARE_EXCHANGES) + if (_declareExchanges) { declareExchange(amqd, protocolHandler, nowait); } - if (DECLARE_QUEUES || amqd.isNameRequired()) + if (_delareQueues || amqd.isNameRequired()) { declareQueue(amqd, protocolHandler, consumer.isNoLocal(), nowait); } @@ -3141,17 +3259,17 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic synchronized (_flowControl) { while (!_flowControl.getFlowControl() && - (expiryTime == 0L ? (expiryTime = System.currentTimeMillis() + FLOW_CONTROL_WAIT_FAILURE) + (expiryTime == 0L ? (expiryTime = System.currentTimeMillis() + _flowControlWaitFailure) : expiryTime) >= System.currentTimeMillis() ) { - _flowControl.wait(FLOW_CONTROL_WAIT_PERIOD); - _logger.warn("Message send delayed by " + (System.currentTimeMillis() + FLOW_CONTROL_WAIT_FAILURE - expiryTime)/1000 + "s due to broker enforced flow control"); + _flowControl.wait(_flowControlWaitPeriod); + _logger.warn("Message send delayed by " + (System.currentTimeMillis() + _flowControlWaitFailure - expiryTime)/1000 + "s due to broker enforced flow control"); } if(!_flowControl.getFlowControl()) { _logger.error("Message send failed due to timeout waiting on broker enforced flow control"); - throw new JMSException("Unable to send message for " + FLOW_CONTROL_WAIT_FAILURE/1000 + " seconds due to broker enforced flow control"); + throw new JMSException("Unable to send message for " + _flowControlWaitFailure /1000 + " seconds due to broker enforced flow control"); } } @@ -3198,6 +3316,11 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic } + private AtomicBoolean getClosed() + { + return _closed; + } + public void rejectPending(C consumer) { synchronized (_lock) @@ -3333,7 +3456,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic if (_dispatcherLogger.isInfoEnabled()) { - _dispatcherLogger.info(_dispatcherThread.getName() + " thread terminating for channel " + _channelId + ":" + _thisSession); + _dispatcherLogger.info(_dispatcherThread.getName() + " thread terminating for channel " + _channelId + ":" + AMQSession.this); } } @@ -3454,7 +3577,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic if (_logger.isDebugEnabled()) { _logger.debug("Rejecting message with delivery tag " + message.getDeliveryTag() - + " for closing consumer " + String.valueOf(consumer == null? null: consumer._consumerTag)); + + " for closing consumer " + String.valueOf(consumer == null? null: consumer.getConsumerTag())); } rejectMessage(message, true); } @@ -3513,7 +3636,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic { // If the session has closed by the time we get here // then we should not attempt to write to the sesion/channel. - if (!(_thisSession.isClosed() || _thisSession.isClosing())) + if (!(AMQSession.this.isClosed() || AMQSession.this.isClosing())) { suspendChannel(_suspend.get()); } @@ -3521,11 +3644,11 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic } catch (AMQException e) { - _logger.warn("Unable to " + (_suspend.get() ? "suspend" : "unsuspend") + " session " + _thisSession + " due to: " + e); + _logger.warn("Unable to " + (_suspend.get() ? "suspend" : "unsuspend") + " session " + AMQSession.this + " due to: " + e); if (_logger.isDebugEnabled()) { _logger.debug("Is the _queue empty?" + _queue.isEmpty()); - _logger.debug("Is the dispatcher closed?" + (_dispatcher == null ? "it's Null" : _dispatcher._closed)); + _logger.debug("Is the dispatcher closed?" + (_dispatcher == null ? "it's Null" : _dispatcher.getClosed())); } } } @@ -3556,7 +3679,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic public boolean isDeclareExchanges() { - return DECLARE_EXCHANGES; + return _declareExchanges; } JMSException toJMSException(String message, TransportException e) diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java index 784e82237d..cfd5776c0a 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java @@ -78,6 +78,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic private static final Logger _logger = LoggerFactory.getLogger(AMQSession_0_10.class); private static Timer timer = new Timer("ack-flusher", true); + private static class Flusher extends TimerTask { @@ -120,7 +121,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic private AMQException _currentException; // a ref on the qpid connection - protected org.apache.qpid.transport.Connection _qpidConnection; + private org.apache.qpid.transport.Connection _qpidConnection; private long maxAckDelay = Long.getLong("qpid.session.max_ack_delay", 1000); private TimerTask flushTask = null; @@ -163,7 +164,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic _qpidSession = _qpidConnection.createSession(name,1); } _qpidSession.setSessionListener(this); - if (_transacted) + if (isTransacted()) { _qpidSession.txSelect(); _qpidSession.setTransacted(true); @@ -214,6 +215,11 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic } } + protected Connection getQpidConnection() + { + return _qpidConnection; + } + //------- overwritten methods of class AMQSession void failoverPrep() @@ -234,17 +240,17 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic { if (_logger.isDebugEnabled()) { - _logger.debug("Sending ack for delivery tag " + deliveryTag + " on session " + _channelId); + _logger.debug("Sending ack for delivery tag " + deliveryTag + " on session " + getChannelId()); } // acknowledge this message if (multiple) { - for (Long messageTag : _unacknowledgedMessageTags) + for (Long messageTag : getUnacknowledgedMessageTags()) { if( messageTag <= deliveryTag ) { addUnacked(messageTag.intValue()); - _unacknowledgedMessageTags.remove(messageTag); + getUnacknowledgedMessageTags().remove(messageTag); } } //empty the list of unack messages @@ -253,12 +259,12 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic else { addUnacked((int) deliveryTag); - _unacknowledgedMessageTags.remove(deliveryTag); + getUnacknowledgedMessageTags().remove(deliveryTag); } long prefetch = getAMQConnection().getMaxPrefetch(); - if (unackedCount >= prefetch/2 || maxAckDelay <= 0 || _acknowledgeMode == javax.jms.Session.AUTO_ACKNOWLEDGE) + if (unackedCount >= prefetch/2 || maxAckDelay <= 0 || getAcknowledgeMode() == javax.jms.Session.AUTO_ACKNOWLEDGE) { flushAcknowledgments(); } @@ -276,7 +282,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic if (unackedCount > 0) { messageAcknowledge - (unacked, _acknowledgeMode != org.apache.qpid.jms.Session.NO_ACKNOWLEDGE,setSyncBit); + (unacked, getAcknowledgeMode() != org.apache.qpid.jms.Session.NO_ACKNOWLEDGE,setSyncBit); clearUnacked(); } } @@ -444,8 +450,8 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic { // release all unacked messages RangeSet all = RangeSetFactory.createRangeSet(); - RangeSet delivered = gatherRangeSet(_unacknowledgedMessageTags); - RangeSet prefetched = gatherRangeSet(_prefetchedMessageTags); + RangeSet delivered = gatherRangeSet(getUnacknowledgedMessageTags()); + RangeSet prefetched = gatherRangeSet(getPrefetchedMessageTags()); for (Iterator<Range> deliveredIter = delivered.iterator(); deliveredIter.hasNext();) { Range range = deliveredIter.next(); @@ -526,9 +532,9 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic { final AMQProtocolHandler protocolHandler = getProtocolHandler(); - return new BasicMessageConsumer_0_10(_channelId, _connection, destination, messageSelector, noLocal, - _messageFactoryRegistry, this, protocolHandler, rawSelector, prefetchHigh, - prefetchLow, exclusive, _acknowledgeMode, noConsume, autoClose); + return new BasicMessageConsumer_0_10(getChannelId(), getAMQConnection(), destination, messageSelector, noLocal, + getMessageFactoryRegistry(), this, protocolHandler, rawSelector, prefetchHigh, + prefetchLow, exclusive, getAcknowledgeMode(), noConsume, autoClose); } /** @@ -630,7 +636,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic getQpidSession().messageFlow(consumerTag, MessageCreditUnit.BYTE, 0xFFFFFFFF, Option.UNRELIABLE); - if(capacity > 0 && _dispatcher != null && (isStarted() || _immediatePrefetch)) + if(capacity > 0 && getDispatcher() != null && (isStarted() || isImmediatePrefetch())) { // set the flow getQpidSession().messageFlow(consumerTag, @@ -653,7 +659,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic { try { - return new BasicMessageProducer_0_10(_connection, (AMQDestination) destination, _transacted, _channelId, this, + return new BasicMessageProducer_0_10(getAMQConnection(), (AMQDestination) destination, isTransacted(), getChannelId(), this, getProtocolHandler(), producerId, immediate, mandatory); } catch (AMQException e) @@ -795,7 +801,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic { if (suspend) { - for (BasicMessageConsumer consumer : _consumers.values()) + for (BasicMessageConsumer consumer : getConsumers().values()) { getQpidSession().messageStop(String.valueOf(consumer.getConsumerTag()), Option.UNRELIABLE); @@ -804,7 +810,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic } else { - for (BasicMessageConsumer_0_10 consumer : _consumers.values()) + for (BasicMessageConsumer_0_10 consumer : getConsumers().values()) { String consumerTag = String.valueOf(consumer.getConsumerTag()); //only set if msg list is null @@ -942,7 +948,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic } return send0_10QueueDeclare(amqd, protocolHandler, noLocal, nowait); } - }, _connection).execute(); + }, getAMQConnection()).execute(); } protected Long requestQueueDepth(AMQDestination amqd) @@ -969,8 +975,8 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic protected void sendTxCompletionsIfNecessary() { // this is a heuristic, we may want to have that configurable - if (_txSize > 0 && (_connection.getMaxPrefetch() == 1 || - _connection.getMaxPrefetch() != 0 && _txSize % (_connection.getMaxPrefetch() / 2) == 0)) + if (_txSize > 0 && (getAMQConnection().getMaxPrefetch() == 1 || + getAMQConnection().getMaxPrefetch() != 0 && _txSize % (getAMQConnection().getMaxPrefetch() / 2) == 0)) { // send completed so consumer credits don't dry up messageAcknowledge(_txRangeSet, false); @@ -1040,7 +1046,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic AMQException amqe = new AMQException(AMQConstant.getConstant(code), se.getMessage(), se.getCause()); _currentException = amqe; } - _connection.exceptionReceived(_currentException); + getAMQConnection().exceptionReceived(_currentException); } public AMQMessageDelegateFactory getMessageDelegateFactory() @@ -1159,7 +1165,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic boolean isConsumer, boolean noWait) throws AMQException { - if (dest.isAddressResolved() && dest.isResolvedAfter(_connection.getLastFailoverTime())) + if (dest.isAddressResolved() && dest.isResolvedAfter(getAMQConnection().getLastFailoverTime())) { if (isConsumer && AMQDestination.TOPIC_TYPE == dest.getAddressType()) { @@ -1329,7 +1335,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic protected void acknowledgeImpl() { - RangeSet ranges = gatherRangeSet(_unacknowledgedMessageTags); + RangeSet ranges = gatherRangeSet(getUnacknowledgedMessageTags()); if(ranges.size() > 0 ) { @@ -1345,13 +1351,13 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic // return the first <total number of msgs received on session> // messages sent by the brokers following the first rollback // after failover - _highestDeliveryTag.set(-1); + getHighestDeliveryTag().set(-1); // Clear txRangeSet/unacknowledgedMessageTags so we don't complete commands corresponding to //messages that came from the old broker. _txRangeSet.clear(); _txSize = 0; - _unacknowledgedMessageTags.clear(); - _prefetchedMessageTags.clear(); + getUnacknowledgedMessageTags().clear(); + getPrefetchedMessageTags().clear(); super.resubscribe(); getQpidSession().sync(); } @@ -1362,18 +1368,18 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic super.stop(); synchronized (getMessageDeliveryLock()) { - for (BasicMessageConsumer consumer : _consumers.values()) + for (BasicMessageConsumer consumer : getConsumers().values()) { List<Long> tags = consumer.drainReceiverQueueAndRetrieveDeliveryTags(); - _prefetchedMessageTags.addAll(tags); + getPrefetchedMessageTags().addAll(tags); } } - _usingDispatcherForCleanup = true; + setUsingDispatcherForCleanup(true); drainDispatchQueue(); - _usingDispatcherForCleanup = false; + setUsingDispatcherForCleanup(false); - RangeSet delivered = gatherRangeSet(_unacknowledgedMessageTags); - RangeSet prefetched = gatherRangeSet(_prefetchedMessageTags); + RangeSet delivered = gatherRangeSet(getUnacknowledgedMessageTags()); + RangeSet prefetched = gatherRangeSet(getPrefetchedMessageTags()); RangeSet all = RangeSetFactory.createRangeSet(delivered.size() + prefetched.size()); diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java index 574775804b..96994e7963 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java @@ -103,7 +103,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe { while (true) { - Long tag = _unacknowledgedMessageTags.poll(); + Long tag = getUnacknowledgedMessageTags().poll(); if (tag == null) { break; @@ -117,15 +117,15 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe { BasicAckBody body = getMethodRegistry().createBasicAckBody(deliveryTag, multiple); - final AMQFrame ackFrame = body.generateFrame(_channelId); + final AMQFrame ackFrame = body.generateFrame(getChannelId()); if (_logger.isDebugEnabled()) { - _logger.debug("Sending ack for delivery tag " + deliveryTag + " on channel " + _channelId); + _logger.debug("Sending ack for delivery tag " + deliveryTag + " on channel " + getChannelId()); } getProtocolHandler().writeFrame(ackFrame, !isTransacted()); - _unacknowledgedMessageTags.remove(deliveryTag); + getUnacknowledgedMessageTags().remove(deliveryTag); } public void sendQueueBind(final AMQShortString queueName, final AMQShortString routingKey, final FieldTable arguments, @@ -134,7 +134,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe { getProtocolHandler().syncWrite(getProtocolHandler().getMethodRegistry().createQueueBindBody (getTicket(),queueName,exchangeName,routingKey,false,arguments). - generateFrame(_channelId), QueueBindOkBody.class); + generateFrame(getChannelId()), QueueBindOkBody.class); } public void sendClose(long timeout) throws AMQException, FailoverException @@ -151,7 +151,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe getProtocolHandler().closeSession(this); getProtocolHandler().syncWrite(getProtocolHandler().getMethodRegistry().createChannelCloseBody(AMQConstant.REPLY_SUCCESS.getCode(), - new AMQShortString("JMS client closing channel"), 0, 0).generateFrame(_channelId), + new AMQShortString("JMS client closing channel"), 0, 0).generateFrame(getChannelId()), ChannelCloseOkBody.class, timeout); // When control resumes at this point, a reply will have been received that // indicates the broker has closed the channel successfully. @@ -163,7 +163,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe // Acknowledge all delivered messages while (true) { - Long tag = _deliveredMessageTags.poll(); + Long tag = getDeliveredMessageTags().poll(); if (tag == null) { break; @@ -174,7 +174,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe final AMQProtocolHandler handler = getProtocolHandler(); - handler.syncWrite(getProtocolHandler().getMethodRegistry().createTxCommitBody().generateFrame(_channelId), TxCommitOkBody.class); + handler.syncWrite(getProtocolHandler().getMethodRegistry().createTxCommitBody().generateFrame(getChannelId()), TxCommitOkBody.class); } public void sendCreateQueue(AMQShortString name, final boolean autoDelete, final boolean durable, final boolean exclusive, final Map<String, Object> arguments) throws AMQException, @@ -190,22 +190,22 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe } } QueueDeclareBody body = getMethodRegistry().createQueueDeclareBody(getTicket(),name,false,durable,exclusive,autoDelete,false,table); - AMQFrame queueDeclare = body.generateFrame(_channelId); + AMQFrame queueDeclare = body.generateFrame(getChannelId()); getProtocolHandler().syncWrite(queueDeclare, QueueDeclareOkBody.class); } public void sendRecover() throws AMQException, FailoverException { enforceRejectBehaviourDuringRecover(); - _prefetchedMessageTags.clear(); - _unacknowledgedMessageTags.clear(); + getPrefetchedMessageTags().clear(); + getUnacknowledgedMessageTags().clear(); if (isStrictAMQP()) { // We can't use the BasicRecoverBody-OK method as it isn't part of the spec. BasicRecoverBody body = getMethodRegistry().createBasicRecoverBody(false); - _connection.getProtocolHandler().writeFrame(body.generateFrame(_channelId)); + getAMQConnection().getProtocolHandler().writeFrame(body.generateFrame(getChannelId())); _logger.warn("Session Recover cannot be guaranteed with STRICT_AMQP. Messages may arrive out of order."); } else @@ -215,17 +215,17 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe if(getProtocolHandler().getProtocolVersion().equals(ProtocolVersion.v8_0)) { BasicRecoverBody body = getMethodRegistry().createBasicRecoverBody(false); - _connection.getProtocolHandler().syncWrite(body.generateFrame(_channelId), BasicRecoverOkBody.class); + getAMQConnection().getProtocolHandler().syncWrite(body.generateFrame(getChannelId()), BasicRecoverOkBody.class); } else if(getProtocolVersion().equals(ProtocolVersion.v0_9)) { BasicRecoverSyncBody body = ((MethodRegistry_0_9)getMethodRegistry()).createBasicRecoverSyncBody(false); - _connection.getProtocolHandler().syncWrite(body.generateFrame(_channelId), BasicRecoverSyncOkBody.class); + getAMQConnection().getProtocolHandler().syncWrite(body.generateFrame(getChannelId()), BasicRecoverSyncOkBody.class); } else if(getProtocolVersion().equals(ProtocolVersion.v0_91)) { BasicRecoverSyncBody body = ((MethodRegistry_0_91)getMethodRegistry()).createBasicRecoverSyncBody(false); - _connection.getProtocolHandler().syncWrite(body.generateFrame(_channelId), BasicRecoverSyncOkBody.class); + getAMQConnection().getProtocolHandler().syncWrite(body.generateFrame(getChannelId()), BasicRecoverSyncOkBody.class); } else { @@ -238,9 +238,9 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe { if (_logger.isDebugEnabled()) { - _logger.debug("Prefetched message: _unacknowledgedMessageTags :" + _unacknowledgedMessageTags); + _logger.debug("Prefetched message: _unacknowledgedMessageTags :" + getUnacknowledgedMessageTags()); } - ArrayList<BasicMessageConsumer_0_8> consumersToCheck = new ArrayList<BasicMessageConsumer_0_8>(_consumers.values()); + ArrayList<BasicMessageConsumer_0_8> consumersToCheck = new ArrayList<BasicMessageConsumer_0_8>(getConsumers().values()); boolean messageListenerFound = false; boolean serverRejectBehaviourFound = false; for(BasicMessageConsumer_0_8 consumer : consumersToCheck) @@ -259,7 +259,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe if (serverRejectBehaviourFound) { //reject(false) any messages we don't want returned again - switch(_acknowledgeMode) + switch(getAcknowledgeMode()) { case Session.DUPS_OK_ACKNOWLEDGE: case Session.AUTO_ACKNOWLEDGE: @@ -268,7 +268,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe break; } case Session.CLIENT_ACKNOWLEDGE: - for(Long tag : _unacknowledgedMessageTags) + for(Long tag : getUnacknowledgedMessageTags()) { rejectMessage(tag, false); } @@ -286,7 +286,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe // consumer on the queue. Whilst this is within the JMS spec it is not // user friendly and avoidable. boolean normalRejectBehaviour = true; - for (BasicMessageConsumer_0_8 consumer : _consumers.values()) + for (BasicMessageConsumer_0_8 consumer : getConsumers().values()) { if(RejectBehaviour.SERVER.equals(consumer.getRejectBehaviour())) { @@ -298,7 +298,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe while (true) { - Long tag = _deliveredMessageTags.poll(); + Long tag = getDeliveredMessageTags().poll(); if (tag == null) { break; @@ -310,8 +310,8 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe public void rejectMessage(long deliveryTag, boolean requeue) { - if ((_acknowledgeMode == CLIENT_ACKNOWLEDGE) || (_acknowledgeMode == SESSION_TRANSACTED)|| - ((_acknowledgeMode == AUTO_ACKNOWLEDGE || _acknowledgeMode == DUPS_OK_ACKNOWLEDGE ) && hasMessageListeners())) + if ((getAcknowledgeMode() == CLIENT_ACKNOWLEDGE) || (getAcknowledgeMode() == SESSION_TRANSACTED)|| + ((getAcknowledgeMode() == AUTO_ACKNOWLEDGE || getAcknowledgeMode() == DUPS_OK_ACKNOWLEDGE ) && hasMessageListeners())) { if (_logger.isDebugEnabled()) { @@ -319,9 +319,9 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe } BasicRejectBody body = getMethodRegistry().createBasicRejectBody(deliveryTag, requeue); - AMQFrame frame = body.generateFrame(_channelId); + AMQFrame frame = body.generateFrame(getChannelId()); - _connection.getProtocolHandler().writeFrame(frame); + getAMQConnection().getProtocolHandler().writeFrame(frame); } } @@ -342,12 +342,12 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe public AMQMethodEvent execute() throws AMQException, FailoverException { AMQFrame boundFrame = getProtocolHandler().getMethodRegistry().createExchangeBoundBody - (exchangeName, routingKey, queueName).generateFrame(_channelId); + (exchangeName, routingKey, queueName).generateFrame(getChannelId()); return getProtocolHandler().syncWrite(boundFrame, ExchangeBoundOkBody.class); } - }, _connection).execute(); + }, getAMQConnection()).execute(); // Extract and return the response code from the query. ExchangeBoundOkBody responseBody = (ExchangeBoundOkBody) response.getMethod(); @@ -378,7 +378,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe consumer.getArguments()); - AMQFrame jmsConsume = body.generateFrame(_channelId); + AMQFrame jmsConsume = body.generateFrame(getChannelId()); if (nowait) { @@ -396,7 +396,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe ExchangeDeclareBody body = getMethodRegistry().createExchangeDeclareBody(getTicket(),name,type, name.toString().startsWith("amq."), false,false,false,false,null); - AMQFrame exchangeDeclare = body.generateFrame(_channelId); + AMQFrame exchangeDeclare = body.generateFrame(getChannelId()); protocolHandler.syncWrite(exchangeDeclare, ExchangeDeclareOkBody.class); } @@ -406,7 +406,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe { QueueDeclareBody body = getMethodRegistry().createQueueDeclareBody(getTicket(),amqd.getAMQQueueName(),false,amqd.isDurable(),amqd.isExclusive(),amqd.isAutoDelete(),false,null); - AMQFrame queueDeclare = body.generateFrame(_channelId); + AMQFrame queueDeclare = body.generateFrame(getChannelId()); protocolHandler.syncWrite(queueDeclare, QueueDeclareOkBody.class); } @@ -418,7 +418,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe false, false, true); - AMQFrame queueDeleteFrame = body.generateFrame(_channelId); + AMQFrame queueDeleteFrame = body.generateFrame(getChannelId()); getProtocolHandler().syncWrite(queueDeleteFrame, QueueDeleteOkBody.class); } @@ -426,8 +426,8 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe public void sendSuspendChannel(boolean suspend) throws AMQException, FailoverException { ChannelFlowBody body = getMethodRegistry().createChannelFlowBody(!suspend); - AMQFrame channelFlowFrame = body.generateFrame(_channelId); - _connection.getProtocolHandler().syncWrite(channelFlowFrame, ChannelFlowOkBody.class); + AMQFrame channelFlowFrame = body.generateFrame(getChannelId()); + getAMQConnection().getProtocolHandler().syncWrite(channelFlowFrame, ChannelFlowOkBody.class); } public BasicMessageConsumer_0_8 createMessageConsumer(final AMQDestination destination, final int prefetchHigh, @@ -436,9 +436,9 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe { final AMQProtocolHandler protocolHandler = getProtocolHandler(); - return new BasicMessageConsumer_0_8(_channelId, _connection, destination, messageSelector, noLocal, - _messageFactoryRegistry,this, protocolHandler, arguments, prefetchHigh, prefetchLow, - exclusive, _acknowledgeMode, noConsume, autoClose); + return new BasicMessageConsumer_0_8(getChannelId(), getAMQConnection(), destination, messageSelector, noLocal, + getMessageFactoryRegistry(),this, protocolHandler, arguments, prefetchHigh, prefetchLow, + exclusive, getAcknowledgeMode(), noConsume, autoClose); } @@ -447,7 +447,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe { try { - return new BasicMessageProducer_0_8(_connection, (AMQDestination) destination, _transacted, _channelId, + return new BasicMessageProducer_0_8(getAMQConnection(), (AMQDestination) destination, isTransacted(), getChannelId(), this, getProtocolHandler(), producerId, immediate, mandatory); } catch (AMQException e) @@ -477,7 +477,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe private void returnBouncedMessage(final ReturnMessage msg) { - _connection.performConnectionTask(new Runnable() + getAMQConnection().performConnectionTask(new Runnable() { public void run() { @@ -485,8 +485,8 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe { // Bounced message is processed here, away from the mina thread AbstractJMSMessage bouncedMessage = - _messageFactoryRegistry.createMessage(0, false, msg.getExchange(), - msg.getRoutingKey(), msg.getContentHeader(), msg.getBodies(),_queueDestinationCache,_topicDestinationCache); + getMessageFactoryRegistry().createMessage(0, false, msg.getExchange(), + msg.getRoutingKey(), msg.getContentHeader(), msg.getBodies(), _queueDestinationCache, _topicDestinationCache); AMQConstant errorCode = AMQConstant.getConstant(msg.getReplyCode()); AMQShortString reason = msg.getReplyText(); _logger.debug("Message returned with error code " + errorCode + " (" + reason + ")"); @@ -494,20 +494,17 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe // @TODO should this be moved to an exception handler of sorts. Somewhere errors are converted to correct execeptions. if (errorCode == AMQConstant.NO_CONSUMERS) { - _connection.exceptionReceived(new AMQNoConsumersException("Error: " + reason, bouncedMessage, null)); - } - else if (errorCode == AMQConstant.NO_ROUTE) + getAMQConnection().exceptionReceived(new AMQNoConsumersException("Error: " + reason, bouncedMessage, null)); + } else if (errorCode == AMQConstant.NO_ROUTE) { - _connection.exceptionReceived(new AMQNoRouteException("Error: " + reason, bouncedMessage, null)); - } - else + getAMQConnection().exceptionReceived(new AMQNoRouteException("Error: " + reason, bouncedMessage, null)); + } else { - _connection.exceptionReceived( + getAMQConnection().exceptionReceived( new AMQUndeliveredException(errorCode, "Error: " + reason, bouncedMessage, null)); } - } - catch (Exception e) + } catch (Exception e) { _logger.error( "Caught exception trying to raise undelivered message exception (dump follows) - ignoring...", @@ -543,7 +540,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe return null; } - }, _connection).execute(); + }, getAMQConnection()).execute(); } public DestinationCache<AMQQueue> getQueueDestinationCache() @@ -579,6 +576,15 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe return matches; } + public long getMessageCount() + { + return _messageCount; + } + + public long getConsumerCount() + { + return _consumerCount; + } } protected Long requestQueueDepth(AMQDestination amqd) throws AMQException, FailoverException @@ -591,10 +597,10 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe amqd.isExclusive(), amqd.isAutoDelete(), false, - null).generateFrame(_channelId); + null).generateFrame(getChannelId()); QueueDeclareOkHandler okHandler = new QueueDeclareOkHandler(); getProtocolHandler().writeCommandFrameAndWaitForReply(queueDeclare, okHandler); - return okHandler._messageCount; + return okHandler.getMessageCount(); } protected boolean tagLE(long tag1, long tag2) @@ -655,7 +661,7 @@ public class AMQSession_0_8 extends AMQSession<BasicMessageConsumer_0_8, BasicMe { // if the Connection has closed then we should throw any exception that // has occurred that we were not waiting for - AMQStateManager manager = _connection.getProtocolHandler() + AMQStateManager manager = getAMQConnection().getProtocolHandler() .getStateManager(); Exception e = manager.getLastException(); diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java index 00df898ec4..f09ef5e01d 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopic.java @@ -174,7 +174,7 @@ public class AMQTopic extends AMQDestination implements Topic } else { - return _exchangeName; + return super.getExchangeName(); } } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopicSessionAdaptor.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopicSessionAdaptor.java index 597cd6301b..6e454cdae9 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopicSessionAdaptor.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQTopicSessionAdaptor.java @@ -26,7 +26,7 @@ import java.io.Serializable; public class AMQTopicSessionAdaptor implements TopicSession, AMQSessionAdapter { - protected final AMQSession _session; + private final AMQSession _session; public AMQTopicSessionAdaptor(Session session) { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java index 568d47080b..f0f2c85c2f 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java @@ -60,14 +60,13 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa { private static final Logger _logger = LoggerFactory.getLogger(BasicMessageConsumer.class); - /** The connection being used by this consumer */ - protected final AMQConnection _connection; + private final AMQConnection _connection; - protected final MessageFilter _messageSelectorFilter; + private final MessageFilter _messageSelectorFilter; private final boolean _noLocal; - protected AMQDestination _destination; + private AMQDestination _destination; /** * When true indicates that a blocking receive call is in progress @@ -78,23 +77,17 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa */ private final AtomicReference<MessageListener> _messageListener = new AtomicReference<MessageListener>(); - /** The consumer tag allows us to close the consumer by sending a jmsCancel method to the broker */ - protected int _consumerTag; + private int _consumerTag; - /** We need to know the channel id when constructing frames */ - protected final int _channelId; + private final int _channelId; - /** - * Used in the blocking receive methods to receive a message from the Session thread. <p/> Or to notify of errors - * <p/> Argument true indicates we want strict FIFO semantics - */ - protected final BlockingQueue _synchronousQueue; + private final BlockingQueue _synchronousQueue; - protected final MessageFactoryRegistry _messageFactory; + private final MessageFactoryRegistry _messageFactory; - protected final AMQSession _session; + private final AMQSession _session; - protected final AMQProtocolHandler _protocolHandler; + private final AMQProtocolHandler _protocolHandler; /** * We need to store the "raw" field table so that we can resubscribe in the event of failover being required @@ -113,17 +106,9 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa */ private final int _prefetchLow; - /** - * We store the exclusive field in order to be able to reuse it when resubscribing in the event of failover - */ - protected boolean _exclusive; + private boolean _exclusive; - /** - * The acknowledge mode in force for this consumer. Note that the AMQP protocol allows different ack modes per - * consumer whereas JMS defines this at the session level, hence why we associate it with the consumer in our - * implementation. - */ - protected final int _acknowledgeMode; + private final int _acknowledgeMode; /** * List of tags delievered, The last of which which should be acknowledged on commit in transaction mode. @@ -238,6 +223,11 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa return _messageListener.get(); } + /** + * The acknowledge mode in force for this consumer. Note that the AMQP protocol allows different ack modes per + * consumer whereas JMS defines this at the session level, hence why we associate it with the consumer in our + * implementation. + */ public int getAcknowledgeMode() { return _acknowledgeMode; @@ -377,6 +367,9 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa return _noLocal; } + /** + * We store the exclusive field in order to be able to reuse it when resubscribing in the event of failover + */ public boolean isExclusive() { return _exclusive; @@ -865,6 +858,7 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa _session.deregisterConsumer(this); } + /** The consumer tag allows us to close the consumer by sending a jmsCancel method to the broker */ public int getConsumerTag() { return _consumerTag; @@ -1014,4 +1008,40 @@ public abstract class BasicMessageConsumer<U> extends Closeable implements Messa public void failedOverPost() {} + /** The connection being used by this consumer */ + protected AMQConnection getConnection() + { + return _connection; + } + + protected void setDestination(AMQDestination destination) + { + _destination = destination; + } + + /** We need to know the channel id when constructing frames */ + protected int getChannelId() + { + return _channelId; + } + + /** + * Used in the blocking receive methods to receive a message from the Session thread. <p/> Or to notify of errors + * <p/> Argument true indicates we want strict FIFO semantics + */ + protected BlockingQueue getSynchronousQueue() + { + return _synchronousQueue; + } + + protected MessageFactoryRegistry getMessageFactory() + { + return _messageFactory; + } + + protected AMQProtocolHandler getProtocolHandler() + { + return _protocolHandler; + } + } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java index 5dadcd5ca3..ccde720673 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java @@ -57,7 +57,7 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM /** * This class logger */ - protected final Logger _logger = LoggerFactory.getLogger(getClass()); + private final Logger _logger = LoggerFactory.getLogger(getClass()); /** * The underlying QpidSession @@ -78,7 +78,7 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM private final long _capacity; /** Flag indicating if the server supports message selectors */ - protected final boolean _serverJmsSelectorSupport; + private final boolean _serverJmsSelectorSupport; protected BasicMessageConsumer_0_10(int channelId, AMQConnection connection, AMQDestination destination, String messageSelector, boolean noLocal, MessageFactoryRegistry messageFactory, @@ -103,8 +103,8 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM if (!namedQueue) { - _destination = destination.copyDestination(); - _destination.setQueueName(null); + setDestination(destination.copyDestination()); + getDestination().setQueueName(null); } } } @@ -192,14 +192,14 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM { super.preDeliver(jmsMsg); - if (_acknowledgeMode == org.apache.qpid.jms.Session.NO_ACKNOWLEDGE) + if (getAcknowledgeMode() == org.apache.qpid.jms.Session.NO_ACKNOWLEDGE) { //For 0-10 we need to ensure that all messages are indicated processed in some way to //ensure their AMQP command-id is marked completed, and so we must send a completion //even for no-ack messages even though there isnt actually an 'acknowledgement' occurring. //Add message to the unacked message list to ensure we dont lose record of it before //sending a completion of some sort. - _session.addUnacknowledgedMessage(jmsMsg.getDeliveryTag()); + getSession().addUnacknowledgedMessage(jmsMsg.getDeliveryTag()); } } @@ -207,7 +207,7 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM AMQMessageDelegateFactory delegateFactory, UnprocessedMessage_0_10 msg) throws Exception { AMQMessageDelegate_0_10.updateExchangeTypeMapping(msg.getMessageTransfer().getHeader(), ((AMQSession_0_10)getSession()).getQpidSession()); - return _messageFactory.createMessage(msg.getMessageTransfer()); + return getMessageFactory().createMessage(msg.getMessageTransfer()); } /** @@ -222,9 +222,9 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM boolean messageOk = true; try { - if (_messageSelectorFilter != null && !_serverJmsSelectorSupport) + if (getMessageSelectorFilter() != null && !_serverJmsSelectorSupport) { - messageOk = _messageSelectorFilter.matches(message); + messageOk = getMessageSelectorFilter().matches(message); } } catch (Exception e) @@ -285,7 +285,7 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM { _0_10session.messageAcknowledge (Range.newInstance((int) message.getDeliveryTag()), - _acknowledgeMode != org.apache.qpid.jms.Session.NO_ACKNOWLEDGE); + getAcknowledgeMode() != org.apache.qpid.jms.Session.NO_ACKNOWLEDGE); final AMQException amqe = _0_10session.getCurrentException(); if (amqe != null) @@ -349,20 +349,20 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM { messageFlow(); } - if (messageListener != null && !_synchronousQueue.isEmpty()) + if (messageListener != null && !getSynchronousQueue().isEmpty()) { - Iterator messages=_synchronousQueue.iterator(); + Iterator messages= getSynchronousQueue().iterator(); while (messages.hasNext()) { AbstractJMSMessage message=(AbstractJMSMessage) messages.next(); messages.remove(); - _session.rejectMessage(message, true); + getSession().rejectMessage(message, true); } } } catch(TransportException e) { - throw _session.toJMSException("Exception while setting message listener:"+ e.getMessage(), e); + throw getSession().toJMSException("Exception while setting message listener:" + e.getMessage(), e); } } @@ -389,7 +389,7 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM { _syncReceive.set(true); } - if (_0_10session.isStarted() && _capacity == 0 && _synchronousQueue.isEmpty()) + if (_0_10session.isStarted() && _capacity == 0 && getSynchronousQueue().isEmpty()) { messageFlow(); } @@ -426,19 +426,19 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM { super.postDeliver(msg); - switch (_acknowledgeMode) + switch (getAcknowledgeMode()) { case Session.SESSION_TRANSACTED: _0_10session.sendTxCompletionsIfNecessary(); break; case Session.NO_ACKNOWLEDGE: - if (!_session.isInRecovery()) + if (!getSession().isInRecovery()) { - _session.acknowledgeMessage(msg.getDeliveryTag(), false); + getSession().acknowledgeMessage(msg.getDeliveryTag(), false); } break; case Session.AUTO_ACKNOWLEDGE: - if (!_session.isInRecovery() && _session.getAMQConnection().getSyncAck()) + if (!getSession().isInRecovery() && getSession().getAMQConnection().getSyncAck()) { ((AMQSession_0_10) getSession()).getQpidSession().sync(); } @@ -454,10 +454,10 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM @Override public void rollbackPendingMessages() { - if (_synchronousQueue.size() > 0) + if (getSynchronousQueue().size() > 0) { RangeSet ranges = RangeSetFactory.createRangeSet(); - Iterator iterator = _synchronousQueue.iterator(); + Iterator iterator = getSynchronousQueue().iterator(); while (iterator.hasNext()) { @@ -497,7 +497,7 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM } else { - return _exclusive; + return super.isExclusive(); } } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java index 755c95fcfc..b00f9dd98a 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java @@ -44,7 +44,7 @@ import javax.jms.Message; public class BasicMessageConsumer_0_8 extends BasicMessageConsumer<UnprocessedMessage_0_8> { - protected final Logger _logger = LoggerFactory.getLogger(getClass()); + private final Logger _logger = LoggerFactory.getLogger(getClass()); private AMQSession_0_8.DestinationCache<AMQTopic> _topicDestinationCache; private AMQSession_0_8.DestinationCache<AMQQueue> _queueDestinationCache; @@ -95,11 +95,11 @@ public class BasicMessageConsumer_0_8 extends BasicMessageConsumer<UnprocessedMe void sendCancel() throws AMQException, FailoverException { - BasicCancelBody body = getSession().getMethodRegistry().createBasicCancelBody(new AMQShortString(String.valueOf(_consumerTag)), false); + BasicCancelBody body = getSession().getMethodRegistry().createBasicCancelBody(new AMQShortString(String.valueOf(getConsumerTag())), false); - final AMQFrame cancelFrame = body.generateFrame(_channelId); + final AMQFrame cancelFrame = body.generateFrame(getChannelId()); - _protocolHandler.syncWrite(cancelFrame, BasicCancelOkBody.class); + getProtocolHandler().syncWrite(cancelFrame, BasicCancelOkBody.class); if (_logger.isDebugEnabled()) { @@ -110,9 +110,9 @@ public class BasicMessageConsumer_0_8 extends BasicMessageConsumer<UnprocessedMe public AbstractJMSMessage createJMSMessageFromUnprocessedMessage(AMQMessageDelegateFactory delegateFactory, UnprocessedMessage_0_8 messageFrame)throws Exception { - return _messageFactory.createMessage(messageFrame.getDeliveryTag(), - messageFrame.isRedelivered(), messageFrame.getExchange(), - messageFrame.getRoutingKey(), messageFrame.getContentHeader(), messageFrame.getBodies(), + return getMessageFactory().createMessage(messageFrame.getDeliveryTag(), + messageFrame.isRedelivered(), messageFrame.getExchange(), + messageFrame.getRoutingKey(), messageFrame.getContentHeader(), messageFrame.getBodies(), _queueDestinationCache, _topicDestinationCache); } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java index 0275cd2fd5..84747d6f09 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java @@ -47,16 +47,76 @@ import java.util.UUID; public abstract class BasicMessageProducer extends Closeable implements org.apache.qpid.jms.MessageProducer { + /** + * If true, messages will not get a timestamp. + */ + protected boolean isDisableTimestamps() + { + return _disableTimestamps; + } + + protected void setDisableTimestamps(boolean disableTimestamps) + { + _disableTimestamps = disableTimestamps; + } + + protected void setDestination(AMQDestination destination) + { + _destination = destination; + } + + protected AMQProtocolHandler getProtocolHandler() + { + return _protocolHandler; + } + + protected void setProtocolHandler(AMQProtocolHandler protocolHandler) + { + _protocolHandler = protocolHandler; + } + + protected int getChannelId() + { + return _channelId; + } + + protected void setChannelId(int channelId) + { + _channelId = channelId; + } + + protected void setSession(AMQSession session) + { + _session = session; + } + + protected String getUserID() + { + return _userID; + } + + protected void setUserID(String userID) + { + _userID = userID; + } + + protected PublishMode getPublishMode() + { + return publishMode; + } + + protected void setPublishMode(PublishMode publishMode) + { + this.publishMode = publishMode; + } + enum PublishMode { ASYNC_PUBLISH_ALL, SYNC_PUBLISH_PERSISTENT, SYNC_PUBLISH_ALL }; - protected final Logger _logger = LoggerFactory.getLogger(getClass()); + private final Logger _logger = LoggerFactory.getLogger(getClass()); private AMQConnection _connection; - /** - * If true, messages will not get a timestamp. - */ - protected boolean _disableTimestamps; + private boolean _disableTimestamps; /** * Priority of messages created by this producer. @@ -73,10 +133,7 @@ public abstract class BasicMessageProducer extends Closeable implements org.apac */ private int _deliveryMode = DeliveryMode.PERSISTENT; - /** - * The Destination used for this consumer, if specified upon creation. - */ - protected AMQDestination _destination; + private AMQDestination _destination; /** * Default encoding used for messages produced by this producer. @@ -88,14 +145,14 @@ public abstract class BasicMessageProducer extends Closeable implements org.apac */ private String _mimeType; - protected AMQProtocolHandler _protocolHandler; + private AMQProtocolHandler _protocolHandler; /** * True if this producer was created from a transacted session */ private boolean _transacted; - protected int _channelId; + private int _channelId; /** * This is an id generated by the session and is used to tie individual producers to the session. This means we @@ -105,10 +162,7 @@ public abstract class BasicMessageProducer extends Closeable implements org.apac */ private long _producerId; - /** - * The session used to create this producer - */ - protected AMQSession _session; + private AMQSession _session; private final boolean _immediate; @@ -118,11 +172,11 @@ public abstract class BasicMessageProducer extends Closeable implements org.apac private UUIDGen _messageIdGenerator = UUIDs.newGenerator(); - protected String _userID; // ref user id used in the connection. + private String _userID; // ref user id used in the connection. private static final ContentBody[] NO_CONTENT_BODIES = new ContentBody[0]; - protected PublishMode publishMode = PublishMode.ASYNC_PUBLISH_ALL; + private PublishMode publishMode = PublishMode.ASYNC_PUBLISH_ALL; protected BasicMessageProducer(AMQConnection connection, AMQDestination destination, boolean transacted, int channelId, AMQSession session, AMQProtocolHandler protocolHandler, long producerId, boolean immediate, boolean mandatory) throws AMQException @@ -256,6 +310,14 @@ public abstract class BasicMessageProducer extends Closeable implements org.apac return _timeToLive; } + protected AMQDestination getAMQDestination() + { + return _destination; + } + + /** + * The Destination used for this consumer, if specified upon creation. + */ public Destination getDestination() throws JMSException { checkNotClosed(); @@ -564,6 +626,9 @@ public abstract class BasicMessageProducer extends Closeable implements org.apac } + /** + * The session used to create this producer + */ public AMQSession getSession() { return _session; @@ -580,4 +645,10 @@ public abstract class BasicMessageProducer extends Closeable implements org.apac throw getSession().toJMSException("Exception whilst checking destination binding:" + e.getMessage(), e); } } + + Logger getLogger() + { + return _logger; + } + } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java index 452e76776b..91811ccf98 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java @@ -65,7 +65,7 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer { super(connection, destination, transacted, channelId, session, protocolHandler, producerId, immediate, mandatory); - userIDBytes = Strings.toUTF8(_userID); + userIDBytes = Strings.toUTF8(getUserID()); } void declareDestination(AMQDestination destination) throws AMQException @@ -125,7 +125,7 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer } long currentTime = 0; - if (timeToLive > 0 || !_disableTimestamps) + if (timeToLive > 0 || !isDisableTimestamps()) { currentTime = System.currentTimeMillis(); } @@ -136,7 +136,7 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer message.setJMSExpiration(currentTime + timeToLive); } - if (!_disableTimestamps) + if (!isDisableTimestamps()) { deliveryProp.setTimestamp(currentTime); @@ -213,8 +213,8 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer // if true, we need to sync the delivery of this message boolean sync = false; - sync = ( (publishMode == PublishMode.SYNC_PUBLISH_ALL) || - (publishMode == PublishMode.SYNC_PUBLISH_PERSISTENT && + sync = ( (getPublishMode() == PublishMode.SYNC_PUBLISH_ALL) || + (getPublishMode() == PublishMode.SYNC_PUBLISH_PERSISTENT && deliveryMode == DeliveryMode.PERSISTENT) ); @@ -248,14 +248,14 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer @Override public boolean isBound(AMQDestination destination) throws JMSException { - return _session.isQueueBound(destination); + return getSession().isQueueBound(destination); } @Override public void close() throws JMSException { super.close(); - AMQDestination dest = _destination; + AMQDestination dest = getAMQDestination(); if (dest != null && dest.getDestSyntax() == AMQDestination.DestSyntax.ADDR) { if (dest.getDelete() == AddressOption.ALWAYS || @@ -264,7 +264,7 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer try { ((AMQSession_0_10) getSession()).getQpidSession().queueDelete( - _destination.getQueueName()); + getAMQDestination().getQueueName()); } catch(TransportException e) { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java index 94121db99f..3b5e361f97 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java @@ -54,7 +54,7 @@ public class BasicMessageProducer_0_8 extends BasicMessageProducer final MethodRegistry methodRegistry = getSession().getMethodRegistry(); ExchangeDeclareBody body = - methodRegistry.createExchangeDeclareBody(_session.getTicket(), + methodRegistry.createExchangeDeclareBody(getSession().getTicket(), destination.getExchangeName(), destination.getExchangeClass(), destination.getExchangeName().toString().startsWith("amq."), @@ -66,29 +66,29 @@ public class BasicMessageProducer_0_8 extends BasicMessageProducer // Declare the exchange // Note that the durable and internal arguments are ignored since passive is set to false - AMQFrame declare = body.generateFrame(_channelId); + AMQFrame declare = body.generateFrame(getChannelId()); - _protocolHandler.writeFrame(declare); + getProtocolHandler().writeFrame(declare); } void sendMessage(AMQDestination destination, Message origMessage, AbstractJMSMessage message, UUID messageId, int deliveryMode,int priority, long timeToLive, boolean mandatory, boolean immediate) throws JMSException { - BasicPublishBody body = getSession().getMethodRegistry().createBasicPublishBody(_session.getTicket(), + BasicPublishBody body = getSession().getMethodRegistry().createBasicPublishBody(getSession().getTicket(), destination.getExchangeName(), destination.getRoutingKey(), mandatory, immediate); - AMQFrame publishFrame = body.generateFrame(_channelId); + AMQFrame publishFrame = body.generateFrame(getChannelId()); message.prepareForSending(); ByteBuffer payload = message.getData(); AMQMessageDelegate_0_8 delegate = (AMQMessageDelegate_0_8) message.getDelegate(); BasicContentHeaderProperties contentHeaderProperties = delegate.getContentHeaderProperties(); - contentHeaderProperties.setUserId(_userID); + contentHeaderProperties.setUserId(getUserID()); //Set the JMS_QPID_DESTTYPE for 0-8/9 messages int type; @@ -108,7 +108,7 @@ public class BasicMessageProducer_0_8 extends BasicMessageProducer //Set JMS_QPID_DESTTYPE delegate.getContentHeaderProperties().getHeaders().setInteger(CustomJMSXProperty.JMS_QPID_DESTTYPE.getShortStringName(), type); - if (!_disableTimestamps) + if (!isDisableTimestamps()) { final long currentTime = System.currentTimeMillis(); contentHeaderProperties.setTimestamp(currentTime); @@ -132,12 +132,12 @@ public class BasicMessageProducer_0_8 extends BasicMessageProducer if (payload != null) { - createContentBodies(payload, frames, 2, _channelId); + createContentBodies(payload, frames, 2, getChannelId()); } - if ((contentBodyFrameCount != 0) && _logger.isDebugEnabled()) + if ((contentBodyFrameCount != 0) && getLogger().isDebugEnabled()) { - _logger.debug("Sending content body frames to " + destination); + getLogger().debug("Sending content body frames to " + destination); } @@ -145,11 +145,11 @@ public class BasicMessageProducer_0_8 extends BasicMessageProducer int classIfForBasic = getSession().getMethodRegistry().createBasicQosOkBody().getClazz(); AMQFrame contentHeaderFrame = - ContentHeaderBody.createAMQFrame(_channelId, + ContentHeaderBody.createAMQFrame(getChannelId(), classIfForBasic, 0, contentHeaderProperties, size); - if (_logger.isDebugEnabled()) + if (getLogger().isDebugEnabled()) { - _logger.debug("Sending content header frame to " + destination); + getLogger().debug("Sending content header frame to " + destination); } frames[0] = publishFrame; @@ -158,7 +158,7 @@ public class BasicMessageProducer_0_8 extends BasicMessageProducer try { - _session.checkFlowControl(); + getSession().checkFlowControl(); } catch (InterruptedException e) { @@ -168,7 +168,7 @@ public class BasicMessageProducer_0_8 extends BasicMessageProducer throw jmse; } - _protocolHandler.writeFrame(compositeFrame); + getProtocolHandler().writeFrame(compositeFrame); } /** @@ -192,7 +192,7 @@ public class BasicMessageProducer_0_8 extends BasicMessageProducer else { - final long framePayloadMax = _session.getAMQConnection().getMaximumFrameSize() - 1; + final long framePayloadMax = getSession().getAMQConnection().getMaximumFrameSize() - 1; long remaining = payload.remaining(); for (int i = offset; i < frames.length; i++) { @@ -222,7 +222,7 @@ public class BasicMessageProducer_0_8 extends BasicMessageProducer else { int dataLength = payload.remaining(); - final long framePayloadMax = _session.getAMQConnection().getMaximumFrameSize() - 1; + final long framePayloadMax = getSession().getAMQConnection().getMaximumFrameSize() - 1; int lastFrame = ((dataLength % framePayloadMax) > 0) ? 1 : 0; frameCount = (int) (dataLength / framePayloadMax) + lastFrame; } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/DispatcherCallback.java b/qpid/java/client/src/main/java/org/apache/qpid/client/DispatcherCallback.java index 81a55006ed..1cd8df6e4a 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/DispatcherCallback.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/DispatcherCallback.java @@ -24,7 +24,7 @@ import java.util.Queue; public abstract class DispatcherCallback { - BasicMessageConsumer _consumer; + private BasicMessageConsumer _consumer; public DispatcherCallback(BasicMessageConsumer mc) { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/MessageConsumerPair.java b/qpid/java/client/src/main/java/org/apache/qpid/client/MessageConsumerPair.java index 585d6db3fd..134159afe1 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/MessageConsumerPair.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/MessageConsumerPair.java @@ -22,8 +22,8 @@ package org.apache.qpid.client; public class MessageConsumerPair { - BasicMessageConsumer _consumer; - Object _item; + private BasicMessageConsumer _consumer; + private Object _item; public MessageConsumerPair(BasicMessageConsumer consumer, Object item) { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/QueueSenderAdapter.java b/qpid/java/client/src/main/java/org/apache/qpid/client/QueueSenderAdapter.java index 295c6a4091..0b797df9dd 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/QueueSenderAdapter.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/QueueSenderAdapter.java @@ -202,7 +202,7 @@ public class QueueSenderAdapter implements QueueSender { if (_delegate.getSession().isStrictAMQP()) { - _delegate._logger.warn("AMQP does not support destination validation before publish, "); + _delegate.getLogger().warn("AMQP does not support destination validation before publish, "); destination.setCheckedForQueueBinding(true); } else diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/XAConnectionImpl.java b/qpid/java/client/src/main/java/org/apache/qpid/client/XAConnectionImpl.java index a7494305c6..d9514338ce 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/XAConnectionImpl.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/XAConnectionImpl.java @@ -53,7 +53,7 @@ public class XAConnectionImpl extends AMQConnection implements XAConnection, XAQ public synchronized XASession createXASession() throws JMSException { checkNotClosed(); - return _delegate.createXASession(); + return getDelegate().createXASession(); } //-- Interface XAQueueConnection @@ -86,6 +86,6 @@ public class XAConnectionImpl extends AMQConnection implements XAConnection, XAQ public XASession createXASession(int ackMode) throws JMSException { checkNotClosed(); - return _delegate.createXASession(ackMode); + return getDelegate().createXASession(ackMode); } } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/XASessionImpl.java b/qpid/java/client/src/main/java/org/apache/qpid/client/XASessionImpl.java index 1d991372df..85623df8c0 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/XASessionImpl.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/XASessionImpl.java @@ -86,7 +86,7 @@ public class XASessionImpl extends AMQSession_0_10 implements XASession, XATopic */ public void createSession() { - _qpidDtxSession = _qpidConnection.createSession(0); + _qpidDtxSession = getQpidConnection().createSession(0); _qpidDtxSession.setSessionListener(this); _qpidDtxSession.dtxSelect(); } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverNoopSupport.java b/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverNoopSupport.java index 51cc94965a..a69e808880 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverNoopSupport.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverNoopSupport.java @@ -38,10 +38,10 @@ import org.apache.qpid.client.AMQConnection; public class FailoverNoopSupport<T, E extends Exception> implements FailoverSupport<T, E> { /** The protected operation that is to be retried in the event of fail-over. */ - FailoverProtectedOperation<T, E> operation; + private FailoverProtectedOperation<T, E> operation; /** The connection on which the fail-over protected operation is to be performed. */ - AMQConnection connection; + private AMQConnection connection; /** * Creates an automatic retrying fail-over handler for the specified operation. diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverRetrySupport.java b/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverRetrySupport.java index 0146f1935d..d3d33d3c75 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverRetrySupport.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverRetrySupport.java @@ -73,10 +73,10 @@ public class FailoverRetrySupport<T, E extends Exception> implements FailoverSup private static final Logger _log = LoggerFactory.getLogger(FailoverRetrySupport.class); /** The protected operation that is to be retried in the event of fail-over. */ - FailoverProtectedOperation<T, E> operation; + private FailoverProtectedOperation<T, E> operation; /** The connection on which the fail-over protected operation is to be performed. */ - AMQConnection connection; + private AMQConnection connection; /** * Creates an automatic retrying fail-over handler for the specified operation. diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ClientMethodDispatcherImpl.java b/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ClientMethodDispatcherImpl.java index 9af225aded..558d93538b 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ClientMethodDispatcherImpl.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ClientMethodDispatcherImpl.java @@ -104,7 +104,7 @@ public class ClientMethodDispatcherImpl implements MethodDispatcher return factory.createMethodDispatcher(session); } - AMQProtocolSession _session; + private AMQProtocolSession _session; public ClientMethodDispatcherImpl(AMQProtocolSession session) { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractAMQMessageDelegate.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractAMQMessageDelegate.java index 98ca8ed8cb..1395f39b99 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractAMQMessageDelegate.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractAMQMessageDelegate.java @@ -121,18 +121,18 @@ public abstract class AbstractAMQMessageDelegate implements AMQMessageDelegate exchangeInfo = new ExchangeInfo(exchange.asString(),"",AMQDestination.UNKNOWN_TYPE); } - if ("topic".equals(exchangeInfo.exchangeType)) + if ("topic".equals(exchangeInfo.getExchangeType())) { dest = new AMQTopic(exchange, routingKey, null); } - else if ("direct".equals(exchangeInfo.exchangeType)) + else if ("direct".equals(exchangeInfo.getExchangeType())) { dest = new AMQQueue(exchange, routingKey, routingKey); } else { dest = new AMQAnyDestination(exchange, - new AMQShortString(exchangeInfo.exchangeType), + new AMQShortString(exchangeInfo.getExchangeType()), routingKey, false, false, @@ -223,9 +223,9 @@ public abstract class AbstractAMQMessageDelegate implements AMQMessageDelegate class ExchangeInfo { - String exchangeName; - String exchangeType; - int destType = AMQDestination.QUEUE_TYPE; + private String exchangeName; + private String exchangeType; + private int destType = AMQDestination.QUEUE_TYPE; public ExchangeInfo(String exchangeName, String exchangeType, int destType) diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesTypedMessage.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesTypedMessage.java index a4173be1d7..9c7bd0bdcf 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesTypedMessage.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesTypedMessage.java @@ -34,7 +34,7 @@ import java.nio.ByteBuffer; */ public abstract class AbstractBytesTypedMessage extends AbstractJMSMessage { - protected boolean _readableMessage = false; + private boolean _readableMessage = false; AbstractBytesTypedMessage(AMQMessageDelegateFactory delegateFactory, boolean fromReceivedMessage) { @@ -75,6 +75,11 @@ public abstract class AbstractBytesTypedMessage extends AbstractJMSMessage _readableMessage = false; } + protected void setReadable(boolean readable) + { + _readableMessage = readable; + } + public String toBodyString() throws JMSException { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java index 442fca6fe3..d1e43447cc 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java @@ -36,7 +36,7 @@ public abstract class AbstractJMSMessage implements org.apache.qpid.jms.Message /** If the acknowledge mode is CLIENT_ACKNOWLEDGE the session is required */ - protected AMQMessageDelegate _delegate; + private AMQMessageDelegate _delegate; private boolean _redelivered; private boolean _receivedFromServer; diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java index 6fbcea8aed..608567674a 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java @@ -57,25 +57,25 @@ public abstract class AbstractJMSMessageFactory implements MessageFactory { if (debug) { - _logger.debug("Non-fragmented message body (bodySize=" + contentHeader.bodySize + ")"); + _logger.debug("Non-fragmented message body (bodySize=" + contentHeader.getBodySize() + ")"); } - data = ByteBuffer.wrap(((ContentBody) bodies.get(0))._payload); + data = ByteBuffer.wrap(((ContentBody) bodies.get(0)).getPayload()); } else if (bodies != null) { if (debug) { _logger.debug("Fragmented message body (" + bodies - .size() + " frames, bodySize=" + contentHeader.bodySize + ")"); + .size() + " frames, bodySize=" + contentHeader.getBodySize() + ")"); } - data = ByteBuffer.allocate((int) contentHeader.bodySize); // XXX: Is cast a problem? + data = ByteBuffer.allocate((int) contentHeader.getBodySize()); // XXX: Is cast a problem? final Iterator it = bodies.iterator(); while (it.hasNext()) { ContentBody cb = (ContentBody) it.next(); - final ByteBuffer payload = ByteBuffer.wrap(cb._payload); + final ByteBuffer payload = ByteBuffer.wrap(cb.getPayload()); if(payload.isDirect() || payload.isReadOnly()) { data.put(payload); diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSBytesMessage.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSBytesMessage.java index 98cc323ad3..b0320d0f4e 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSBytesMessage.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSBytesMessage.java @@ -52,7 +52,7 @@ public class JMSBytesMessage extends AbstractBytesTypedMessage implements BytesM public void reset() { - _readableMessage = true; + setReadable(true); if(_typedBytesContentReader != null) { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSStreamMessage.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSStreamMessage.java index 7fca76268f..b958d89515 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSStreamMessage.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSStreamMessage.java @@ -54,7 +54,7 @@ public class JMSStreamMessage extends AbstractBytesTypedMessage implements Strea public void reset() { - _readableMessage = true; + setReadable(true); if(_typedBytesContentReader != null) { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/UnprocessedMessage_0_8.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/UnprocessedMessage_0_8.java index 847975a5e5..c78b6ced93 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/UnprocessedMessage_0_8.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/UnprocessedMessage_0_8.java @@ -87,13 +87,13 @@ public class UnprocessedMessage_0_8 extends UnprocessedMessage public void receiveBody(ContentBody body) { - if (body._payload != null) + if (body.getPayload() != null) { - final long payloadSize = body._payload.length; + final long payloadSize = body.getPayload().length; if (_bodies == null) { - if (payloadSize == getContentHeader().bodySize) + if (payloadSize == getContentHeader().getBodySize()) { _bodies = Collections.singletonList(body); } @@ -124,7 +124,7 @@ public class UnprocessedMessage_0_8 extends UnprocessedMessage public boolean isAllBodyDataReceived() { - return _bytesReceived == getContentHeader().bodySize; + return _bytesReceived == getContentHeader().getBodySize(); } public BasicDeliverBody getDeliverBody() diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Link.java b/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Link.java index c73d800b14..41f6725c8f 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Link.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Link.java @@ -29,16 +29,16 @@ public class Link public enum Reliability { UNRELIABLE, AT_MOST_ONCE, AT_LEAST_ONCE, EXACTLY_ONCE } - protected String name; - protected String _filter; - protected FilterType _filterType = FilterType.SUBJECT; - protected boolean _isNoLocal; - protected boolean _isDurable; - protected int _consumerCapacity = 0; - protected int _producerCapacity = 0; - protected Node node; - protected Subscription subscription; - protected Reliability reliability = Reliability.AT_LEAST_ONCE; + private String name; + private String _filter; + private FilterType _filterType = FilterType.SUBJECT; + private boolean _isNoLocal; + private boolean _isDurable; + private int _consumerCapacity = 0; + private int _producerCapacity = 0; + private Node node; + private Subscription subscription; + private Reliability reliability = Reliability.AT_LEAST_ONCE; public Reliability getReliability() { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Node.java b/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Node.java index fe469090d8..bb5bba9068 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Node.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Node.java @@ -31,13 +31,18 @@ import java.util.Map; public abstract class Node { - protected int _nodeType = AMQDestination.UNKNOWN_TYPE; - protected boolean _isDurable; - protected boolean _isAutoDelete; - protected String _alternateExchange; - protected List<Binding> _bindings = new ArrayList<Binding>(); - protected Map<String,Object> _declareArgs = Collections.emptyMap(); - + private int _nodeType = AMQDestination.UNKNOWN_TYPE; + private boolean _isDurable; + private boolean _isAutoDelete; + private String _alternateExchange; + private List<Binding> _bindings = new ArrayList<Binding>(); + private Map<String,Object> _declareArgs = Collections.emptyMap(); + + protected Node(int nodeType) + { + _nodeType = nodeType; + } + public int getType() { return _nodeType; @@ -104,7 +109,7 @@ public abstract class Node public QueueNode() { - _nodeType = AMQDestination.QUEUE_TYPE; + super(AMQDestination.QUEUE_TYPE); } public boolean isExclusive() @@ -125,7 +130,7 @@ public abstract class Node public ExchangeNode() { - _nodeType = AMQDestination.TOPIC_TYPE; + super(AMQDestination.TOPIC_TYPE); } public String getExchangeType() @@ -142,5 +147,9 @@ public abstract class Node public static class UnknownNodeType extends Node { + public UnknownNodeType() + { + super(AMQDestination.UNKNOWN_TYPE); + } } } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java index c23e2ba985..d4da0ede32 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java @@ -865,159 +865,159 @@ public class AMQProtocolHandler implements ProtocolEngine } private static class BytesDataOutput implements DataOutput + { + private int _pos = 0; + private byte[] _buf; + + public BytesDataOutput(byte[] buf) { - int _pos = 0; - byte[] _buf; + _buf = buf; + } - public BytesDataOutput(byte[] buf) - { - _buf = buf; - } + public void setBuffer(byte[] buf) + { + _buf = buf; + _pos = 0; + } - public void setBuffer(byte[] buf) - { - _buf = buf; - _pos = 0; - } + public void reset() + { + _pos = 0; + } - public void reset() - { - _pos = 0; - } + public int length() + { + return _pos; + } - public int length() - { - return _pos; - } + public void write(int b) + { + _buf[_pos++] = (byte) b; + } - public void write(int b) - { - _buf[_pos++] = (byte) b; - } + public void write(byte[] b) + { + System.arraycopy(b, 0, _buf, _pos, b.length); + _pos+=b.length; + } - public void write(byte[] b) - { - System.arraycopy(b, 0, _buf, _pos, b.length); - _pos+=b.length; - } + public void write(byte[] b, int off, int len) + { + System.arraycopy(b, off, _buf, _pos, len); + _pos+=len; - public void write(byte[] b, int off, int len) - { - System.arraycopy(b, off, _buf, _pos, len); - _pos+=len; + } - } + public void writeBoolean(boolean v) + { + _buf[_pos++] = v ? (byte) 1 : (byte) 0; + } - public void writeBoolean(boolean v) - { - _buf[_pos++] = v ? (byte) 1 : (byte) 0; - } + public void writeByte(int v) + { + _buf[_pos++] = (byte) v; + } - public void writeByte(int v) - { - _buf[_pos++] = (byte) v; - } + public void writeShort(int v) + { + _buf[_pos++] = (byte) (v >>> 8); + _buf[_pos++] = (byte) v; + } - public void writeShort(int v) - { - _buf[_pos++] = (byte) (v >>> 8); - _buf[_pos++] = (byte) v; - } + public void writeChar(int v) + { + _buf[_pos++] = (byte) (v >>> 8); + _buf[_pos++] = (byte) v; + } - public void writeChar(int v) + public void writeInt(int v) + { + _buf[_pos++] = (byte) (v >>> 24); + _buf[_pos++] = (byte) (v >>> 16); + _buf[_pos++] = (byte) (v >>> 8); + _buf[_pos++] = (byte) v; + } + + public void writeLong(long v) + { + _buf[_pos++] = (byte) (v >>> 56); + _buf[_pos++] = (byte) (v >>> 48); + _buf[_pos++] = (byte) (v >>> 40); + _buf[_pos++] = (byte) (v >>> 32); + _buf[_pos++] = (byte) (v >>> 24); + _buf[_pos++] = (byte) (v >>> 16); + _buf[_pos++] = (byte) (v >>> 8); + _buf[_pos++] = (byte)v; + } + + public void writeFloat(float v) + { + writeInt(Float.floatToIntBits(v)); + } + + public void writeDouble(double v) + { + writeLong(Double.doubleToLongBits(v)); + } + + public void writeBytes(String s) + { + int len = s.length(); + for (int i = 0 ; i < len ; i++) { - _buf[_pos++] = (byte) (v >>> 8); - _buf[_pos++] = (byte) v; + _buf[_pos++] = ((byte)s.charAt(i)); } + } - public void writeInt(int v) + public void writeChars(String s) + { + int len = s.length(); + for (int i = 0 ; i < len ; i++) { - _buf[_pos++] = (byte) (v >>> 24); - _buf[_pos++] = (byte) (v >>> 16); + int v = s.charAt(i); _buf[_pos++] = (byte) (v >>> 8); _buf[_pos++] = (byte) v; } + } - public void writeLong(long v) - { - _buf[_pos++] = (byte) (v >>> 56); - _buf[_pos++] = (byte) (v >>> 48); - _buf[_pos++] = (byte) (v >>> 40); - _buf[_pos++] = (byte) (v >>> 32); - _buf[_pos++] = (byte) (v >>> 24); - _buf[_pos++] = (byte) (v >>> 16); - _buf[_pos++] = (byte) (v >>> 8); - _buf[_pos++] = (byte)v; - } + public void writeUTF(String s) + { + int strlen = s.length(); - public void writeFloat(float v) - { - writeInt(Float.floatToIntBits(v)); - } + int pos = _pos; + _pos+=2; - public void writeDouble(double v) - { - writeLong(Double.doubleToLongBits(v)); - } - public void writeBytes(String s) + for (int i = 0; i < strlen; i++) { - int len = s.length(); - for (int i = 0 ; i < len ; i++) + int c = s.charAt(i); + if ((c >= 0x0001) && (c <= 0x007F)) { - _buf[_pos++] = ((byte)s.charAt(i)); - } - } + c = s.charAt(i); + _buf[_pos++] = (byte) c; - public void writeChars(String s) - { - int len = s.length(); - for (int i = 0 ; i < len ; i++) + } + else if (c > 0x07FF) { - int v = s.charAt(i); - _buf[_pos++] = (byte) (v >>> 8); - _buf[_pos++] = (byte) v; + _buf[_pos++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); + _buf[_pos++] = (byte) (0x80 | ((c >> 6) & 0x3F)); + _buf[_pos++] = (byte) (0x80 | (c & 0x3F)); } - } - - public void writeUTF(String s) - { - int strlen = s.length(); - - int pos = _pos; - _pos+=2; - - - for (int i = 0; i < strlen; i++) + else { - int c = s.charAt(i); - if ((c >= 0x0001) && (c <= 0x007F)) - { - c = s.charAt(i); - _buf[_pos++] = (byte) c; - - } - else if (c > 0x07FF) - { - _buf[_pos++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); - _buf[_pos++] = (byte) (0x80 | ((c >> 6) & 0x3F)); - _buf[_pos++] = (byte) (0x80 | (c & 0x3F)); - } - else - { - _buf[_pos++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); - _buf[_pos++] = (byte) (0x80 | (c & 0x3F)); - } + _buf[_pos++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); + _buf[_pos++] = (byte) (0x80 | (c & 0x3F)); } - - int len = _pos - (pos + 2); - - _buf[pos++] = (byte) (len >>> 8); - _buf[pos] = (byte) len; } + int len = _pos - (pos + 2); + + _buf[pos++] = (byte) (len >>> 8); + _buf[pos] = (byte) len; } + } + } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java index 93a51adb68..c9b2e9cdc4 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java @@ -73,16 +73,11 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession protected static final String SASL_CLIENT = "SASLClient"; - /** - * The handler from which this session was created and which is used to handle protocol events. We send failover - * events to the handler. - */ - protected final AMQProtocolHandler _protocolHandler; + private final AMQProtocolHandler _protocolHandler; - /** Maps from the channel id to the AMQSession that it represents. */ - protected ConcurrentMap<Integer, AMQSession> _channelId2SessionMap = new ConcurrentHashMap<Integer, AMQSession>(); + private ConcurrentMap<Integer, AMQSession> _channelId2SessionMap = new ConcurrentHashMap<Integer, AMQSession>(); - protected ConcurrentMap _closingChannels = new ConcurrentHashMap(); + private ConcurrentMap _closingChannels = new ConcurrentHashMap(); /** * Maps from a channel id to an unprocessed message. This is used to tie together the JmsDeliverBody (which arrives @@ -91,9 +86,8 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession private final ConcurrentMap<Integer, UnprocessedMessage> _channelId2UnprocessedMsgMap = new ConcurrentHashMap<Integer, UnprocessedMessage>(); private final UnprocessedMessage[] _channelId2UnprocessedMsgArray = new UnprocessedMessage[16]; - /** Counter to ensure unique queue names */ - protected int _queueId = 1; - protected final Object _queueIdLock = new Object(); + private int _queueId = 1; + private final Object _queueIdLock = new Object(); private ProtocolVersion _protocolVersion; // private VersionSpecificRegistry _registry = @@ -104,7 +98,7 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession private MethodDispatcher _methodDispatcher; - protected final AMQConnection _connection; + private final AMQConnection _connection; private ConnectionTuneParameters _connectionTuneParameters; @@ -223,7 +217,7 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession } msg.setContentHeader(contentHeader); - if (contentHeader.bodySize == 0) + if (contentHeader.getBodySize() == 0) { deliverMessageToAMQSession(channelId, msg); } @@ -470,4 +464,55 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession { return "AMQProtocolSession[" + _connection + ']'; } + + /** + * The handler from which this session was created and which is used to handle protocol events. We send failover + * events to the handler. + */ + protected AMQProtocolHandler getProtocolHandler() + { + return _protocolHandler; + } + + /** Maps from the channel id to the AMQSession that it represents. */ + protected ConcurrentMap<Integer, AMQSession> getChannelId2SessionMap() + { + return _channelId2SessionMap; + } + + protected void setChannelId2SessionMap(ConcurrentMap<Integer, AMQSession> channelId2SessionMap) + { + _channelId2SessionMap = channelId2SessionMap; + } + + protected ConcurrentMap getClosingChannels() + { + return _closingChannels; + } + + protected void setClosingChannels(ConcurrentMap closingChannels) + { + _closingChannels = closingChannels; + } + + /** Counter to ensure unique queue names */ + protected int getQueueId() + { + return _queueId; + } + + protected void setQueueId(int queueId) + { + _queueId = queueId; + } + + protected Object getQueueIdLock() + { + return _queueIdLock; + } + + protected AMQConnection getConnection() + { + return _connection; + } } diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java index 4350b48a10..b865c51cb7 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java @@ -63,7 +63,7 @@ public abstract class BlockingMethodFrameListener extends BlockingWaiter<AMQMeth { /** Holds the channel id for the channel upon which this listener is waiting for a response. */ - protected int _channelId; + private int _channelId; /** * Creates a new method listener, that filters incoming method to just those that match the specified channel id. diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java b/qpid/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java index b52c121485..616c02f3aa 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java @@ -63,7 +63,7 @@ public class AMQStateManager implements AMQMethodListener private static final long MAXIMUM_STATE_WAIT_TIME = Long.parseLong(System.getProperty("amqj.MaximumStateWait", "30000")); - protected final List<StateWaiter> _waiters = new CopyOnWriteArrayList<StateWaiter>(); + private final List<StateWaiter> _waiters = new CopyOnWriteArrayList<StateWaiter>(); private Exception _lastException; public AMQStateManager() diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java b/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java index 6e47e2ce28..9e21e1c4ab 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java @@ -36,7 +36,7 @@ import org.apache.qpid.jms.BrokerDetails; */ public class AMQNoTransportForProtocolException extends AMQTransportConnectionException { - BrokerDetails _details; + private BrokerDetails _details; public AMQNoTransportForProtocolException(BrokerDetails details, String message, Throwable cause) { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/transport/ClientConnectionDelegate.java b/qpid/java/client/src/main/java/org/apache/qpid/client/transport/ClientConnectionDelegate.java index db7c16974a..3c9a6e1500 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/transport/ClientConnectionDelegate.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/transport/ClientConnectionDelegate.java @@ -85,7 +85,7 @@ public class ClientConnectionDelegate extends ClientDelegate protected SaslClient createSaslClient(List<Object> brokerMechs) throws ConnectionException, SaslException { final String brokerMechanisms = Strings.join(" ", brokerMechs); - final String restrictionList = _conSettings.getSaslMechs(); + final String restrictionList = getConnectionSettings().getSaslMechs(); final String selectedMech = CallbackHandlerRegistry.getInstance().selectMechanism(brokerMechanisms, restrictionList); if (selectedMech == null) { @@ -96,14 +96,14 @@ public class ClientConnectionDelegate extends ClientDelegate } Map<String,Object> saslProps = new HashMap<String,Object>(); - if (_conSettings.isUseSASLEncryption()) + if (getConnectionSettings().isUseSASLEncryption()) { saslProps.put(Sasl.QOP, "auth-conf"); } final AMQCallbackHandler handler = CallbackHandlerRegistry.getInstance().createCallbackHandler(selectedMech); handler.initialise(_connectionURL); - final SaslClient sc = Sasl.createSaslClient(new String[] {selectedMech}, null, _conSettings.getSaslProtocol(), _conSettings.getSaslServerName(), saslProps, handler); + final SaslClient sc = Sasl.createSaslClient(new String[] {selectedMech}, null, getConnectionSettings().getSaslProtocol(), getConnectionSettings().getSaslServerName(), saslProps, handler); return sc; } @@ -137,7 +137,7 @@ public class ClientConnectionDelegate extends ClientDelegate private String getKerberosUser() { LOGGER.debug("Obtaining userID from kerberos"); - String service = _conSettings.getSaslProtocol() + "@" + _conSettings.getSaslServerName(); + String service = getConnectionSettings().getSaslProtocol() + "@" + getConnectionSettings().getSaslServerName(); GSSManager manager = GSSManager.getInstance(); try diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/util/BlockingWaiter.java b/qpid/java/client/src/main/java/org/apache/qpid/client/util/BlockingWaiter.java index 5d36b2f19e..c371341265 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/util/BlockingWaiter.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/util/BlockingWaiter.java @@ -85,7 +85,7 @@ public abstract class BlockingWaiter<T> private volatile Exception _error; /** Holds the incomming Object. */ - protected Object _doneObject = null; + private Object _doneObject = null; private AtomicBoolean _waiting = new AtomicBoolean(false); private boolean _closed = false; diff --git a/qpid/java/client/src/main/java/org/apache/qpid/collections/ReferenceMap.java b/qpid/java/client/src/main/java/org/apache/qpid/collections/ReferenceMap.java index 7bc1322e02..84e4704867 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/collections/ReferenceMap.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/collections/ReferenceMap.java @@ -795,10 +795,10 @@ public class ReferenceMap extends AbstractMap // the mapping is stale and should be removed. private class Entry implements Map.Entry, KeyValue { - Object key; - Object value; - int hash; - Entry next; + private Object key; + private Object value; + private int hash; + private Entry next; public Entry(Object key, int hash, Object value, Entry next) { @@ -887,17 +887,17 @@ public class ReferenceMap extends AbstractMap private class EntryIterator implements Iterator { // These fields keep track of where we are in the table. - int index; - Entry entry; - Entry previous; + private int index; + private Entry entry; + private Entry previous; // These Object fields provide hard references to the // current and next entry; this assures that if hasNext() // returns true, next() will actually return a valid element. - Object nextKey, nextValue; - Object currentKey, currentValue; + private Object nextKey, nextValue; + private Object currentKey, currentValue; - int expectedModCount; + private int expectedModCount; public EntryIterator() { diff --git a/qpid/java/client/src/main/java/org/apache/qpid/collections/keyvalue/AbstractKeyValue.java b/qpid/java/client/src/main/java/org/apache/qpid/collections/keyvalue/AbstractKeyValue.java index a7ca67ad15..f1b6d11bee 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/collections/keyvalue/AbstractKeyValue.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/collections/keyvalue/AbstractKeyValue.java @@ -33,9 +33,9 @@ import org.apache.qpid.collections.KeyValue; public abstract class AbstractKeyValue implements KeyValue { /** The key */ - protected Object key; + private Object key; /** The value */ - protected Object value; + private Object value; /** * Constructs a new pair with the specified key and given value. @@ -68,6 +68,21 @@ public abstract class AbstractKeyValue implements KeyValue { } /** + * Sets the value stored in this <code>Map.Entry</code>. + * <p> + * This <code>Map.Entry</code> is not connected to a Map, so only the + * local data is changed. + * + * @param value the new value + * @return the previous value + */ + public Object setValue(Object value) { + Object answer = this.value; + this.value = value; + return answer; + } + + /** * Gets a debugging String view of the pair. * * @return a String view of the entry diff --git a/qpid/java/client/src/main/java/org/apache/qpid/collections/keyvalue/AbstractMapEntry.java b/qpid/java/client/src/main/java/org/apache/qpid/collections/keyvalue/AbstractMapEntry.java index a5223d2361..7135c31fd7 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/collections/keyvalue/AbstractMapEntry.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/collections/keyvalue/AbstractMapEntry.java @@ -43,20 +43,7 @@ public abstract class AbstractMapEntry extends AbstractKeyValue implements Map.E // Map.Entry interface //------------------------------------------------------------------------- - /** - * Sets the value stored in this <code>Map.Entry</code>. - * <p> - * This <code>Map.Entry</code> is not connected to a Map, so only the - * local data is changed. - * - * @param value the new value - * @return the previous value - */ - public Object setValue(Object value) { - Object answer = this.value; - this.value = value; - return answer; - } + /** * Compares this <code>Map.Entry</code> with another <code>Map.Entry</code>. diff --git a/qpid/java/client/src/main/java/org/apache/qpid/filter/ArithmeticExpression.java b/qpid/java/client/src/main/java/org/apache/qpid/filter/ArithmeticExpression.java index a86613f10c..df5e2acd66 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/filter/ArithmeticExpression.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/filter/ArithmeticExpression.java @@ -243,13 +243,13 @@ public abstract class ArithmeticExpression extends BinaryExpression public Object evaluate(AbstractJMSMessage message) throws AMQInternalException { - 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/qpid/java/client/src/main/java/org/apache/qpid/filter/BinaryExpression.java b/qpid/java/client/src/main/java/org/apache/qpid/filter/BinaryExpression.java index f97f858fad..a08a6cc094 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/filter/BinaryExpression.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/filter/BinaryExpression.java @@ -22,8 +22,8 @@ package org.apache.qpid.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) { @@ -84,20 +84,5 @@ 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/qpid/java/client/src/main/java/org/apache/qpid/filter/ComparisonExpression.java b/qpid/java/client/src/main/java/org/apache/qpid/filter/ComparisonExpression.java index eebfec0b2d..87d43ec343 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/filter/ComparisonExpression.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/filter/ComparisonExpression.java @@ -69,7 +69,7 @@ public abstract class ComparisonExpression extends BinaryExpression implements B static class LikeExpression extends UnaryExpression implements BooleanExpression { - Pattern likePattern; + private Pattern likePattern; /** * @param right @@ -236,8 +236,8 @@ public abstract class ComparisonExpression extends BinaryExpression implements B public Object evaluate(AbstractJMSMessage message) throws AMQInternalException { - 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)) @@ -419,13 +419,13 @@ public abstract class ComparisonExpression extends BinaryExpression implements B public Object evaluate(AbstractJMSMessage message) throws AMQInternalException { - 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; diff --git a/qpid/java/client/src/main/java/org/apache/qpid/filter/LogicExpression.java b/qpid/java/client/src/main/java/org/apache/qpid/filter/LogicExpression.java index 7ef85cbacb..b08b93228f 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/filter/LogicExpression.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/filter/LogicExpression.java @@ -35,14 +35,14 @@ public abstract class LogicExpression extends BinaryExpression implements Boolea public Object evaluate(AbstractJMSMessage message) throws AMQInternalException { - 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; } @@ -62,7 +62,7 @@ public abstract class LogicExpression extends BinaryExpression implements Boolea public Object evaluate(AbstractJMSMessage message) throws AMQInternalException { - Boolean lv = (Boolean) left.evaluate(message); + Boolean lv = (Boolean) getLeft().evaluate(message); // Can we do an AND shortcut?? if (lv == null) @@ -75,7 +75,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/qpid/java/client/src/main/java/org/apache/qpid/nclient/util/MessagePartListenerAdapter.java b/qpid/java/client/src/main/java/org/apache/qpid/nclient/util/MessagePartListenerAdapter.java index ad0a625c6a..9a2e9de3d9 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/nclient/util/MessagePartListenerAdapter.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/nclient/util/MessagePartListenerAdapter.java @@ -38,8 +38,8 @@ import java.nio.ByteBuffer; */ public class MessagePartListenerAdapter implements MessagePartListener { - MessageListener _adaptee; - ByteBufferMessage _currentMsg; + private MessageListener _adaptee; + private ByteBufferMessage _currentMsg; public MessagePartListenerAdapter(MessageListener listener) { diff --git a/qpid/java/client/src/test/java/org/apache/qpid/client/AMQQueueTest.java b/qpid/java/client/src/test/java/org/apache/qpid/client/AMQQueueTest.java index d862acf28d..bc48ee8895 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/client/AMQQueueTest.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/client/AMQQueueTest.java @@ -26,11 +26,11 @@ import org.apache.qpid.framing.AMQShortString; public class AMQQueueTest extends TestCase { - AMQShortString exchange = new AMQShortString("test.exchange"); - AMQShortString routingkey = new AMQShortString("test-route"); - AMQShortString qname = new AMQShortString("test-queue"); - AMQShortString[] oneBinding = new AMQShortString[]{new AMQShortString("bindingA")}; - AMQShortString[] bindings = new AMQShortString[]{new AMQShortString("bindingB"), + private AMQShortString exchange = new AMQShortString("test.exchange"); + private AMQShortString routingkey = new AMQShortString("test-route"); + private AMQShortString qname = new AMQShortString("test-queue"); + private AMQShortString[] oneBinding = new AMQShortString[]{new AMQShortString("bindingA")}; + private AMQShortString[] bindings = new AMQShortString[]{new AMQShortString("bindingB"), new AMQShortString("bindingC")}; public void testToURLNoBindings() diff --git a/qpid/java/client/src/test/java/org/apache/qpid/client/MockAMQConnection.java b/qpid/java/client/src/test/java/org/apache/qpid/client/MockAMQConnection.java index 919809edc3..009598d8a4 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/client/MockAMQConnection.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/client/MockAMQConnection.java @@ -51,13 +51,13 @@ public class MockAMQConnection extends AMQConnection @Override public ProtocolVersion makeBrokerConnection(BrokerDetails brokerDetail) throws IOException { - _connected = true; - _protocolHandler.getStateManager().changeState(AMQState.CONNECTION_OPEN); + setConnected(true); + getProtocolHandler().getStateManager().changeState(AMQState.CONNECTION_OPEN); return null; } public AMQConnectionDelegate getDelegate() { - return _delegate; + return super.getDelegate(); } } diff --git a/qpid/java/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java b/qpid/java/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java index 6b5fc81be6..9a5ca33174 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/client/protocol/AMQProtocolHandlerTest.java @@ -59,15 +59,15 @@ public class AMQProtocolHandlerTest extends TestCase private static final Logger _logger = LoggerFactory.getLogger(AMQProtocolHandlerTest.class); // The handler to test - AMQProtocolHandler _handler; + private AMQProtocolHandler _handler; // A frame to block upon whilst waiting the exception - AMQFrame _blockFrame; + private AMQFrame _blockFrame; // Latch to know when the listener receives an exception private CountDownLatch _handleCountDown; // The listener that will receive an exception - BlockToAccessFrameListener _listener; + private BlockToAccessFrameListener _listener; @Override public void setUp() throws Exception diff --git a/qpid/java/client/src/test/java/org/apache/qpid/client/util/ClassLoadingAwareObjectInputStreamTest.java b/qpid/java/client/src/test/java/org/apache/qpid/client/util/ClassLoadingAwareObjectInputStreamTest.java index 8cd320b06e..91460ab4e7 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/client/util/ClassLoadingAwareObjectInputStreamTest.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/client/util/ClassLoadingAwareObjectInputStreamTest.java @@ -31,8 +31,8 @@ import java.util.List; public class ClassLoadingAwareObjectInputStreamTest extends QpidTestCase { - InputStream _in; - ClassLoadingAwareObjectInputStream _claOIS; + private InputStream _in; + private ClassLoadingAwareObjectInputStream _claOIS; protected void setUp() throws Exception { diff --git a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/jndi/JNDIPropertyFileTest.java b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/jndi/JNDIPropertyFileTest.java index 5690a05254..576ab4fa05 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/jndi/JNDIPropertyFileTest.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/jndi/JNDIPropertyFileTest.java @@ -34,7 +34,7 @@ import java.util.Properties; public class JNDIPropertyFileTest extends TestCase { - Context ctx; + private Context ctx; public JNDIPropertyFileTest() throws Exception { diff --git a/qpid/java/common/Composite.tpl b/qpid/java/common/Composite.tpl index ad166a0170..18b5374965 100644 --- a/qpid/java/common/Composite.tpl +++ b/qpid/java/common/Composite.tpl @@ -187,7 +187,7 @@ ${ if not f.empty: out(" this.$(f.name) = $(f.default);") } - this.dirty = true; + setDirty(true); return this; } """) @@ -221,7 +221,7 @@ if pack > 0: else: out(" packing_flags |= $(f.flag_mask(pack));") } - this.dirty = true; + setDirty(true); return this; } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java index 92eca6bfbe..c7a0816f91 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java @@ -47,7 +47,7 @@ public class AMQConnectionException extends AMQException /** AMQP version for which exception ocurred, minor code. */ private final byte minor; - boolean _closeConnetion; + private boolean _closeConnetion; public AMQConnectionException(AMQConstant errorCode, String msg, int classId, int methodId, byte major, byte minor, Throwable cause) diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java index 3b1b04220f..d9a9ee0782 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java @@ -36,7 +36,7 @@ import java.util.Collection; */ public class AMQConnectionFailureException extends AMQException { - Collection<Exception> _exceptions; + private Collection<Exception> _exceptions; public AMQConnectionFailureException(String message, Throwable cause) { diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java index eee3e6afcf..82ffe583c3 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java @@ -35,7 +35,7 @@ package org.apache.qpid; */ public class AMQUnresolvedAddressException extends AMQException { - String _broker; + private String _broker; public AMQUnresolvedAddressException(String message, String broker, Throwable cause) { diff --git a/qpid/java/common/src/main/java/org/apache/qpid/QpidConfig.java b/qpid/java/common/src/main/java/org/apache/qpid/QpidConfig.java index b4cad44130..67cac48613 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/QpidConfig.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/QpidConfig.java @@ -67,8 +67,8 @@ public class QpidConfig public static class SecurityMechanism { - String type; - String handler; + private String type; + private String handler; SecurityMechanism(String type,String handler) { @@ -89,8 +89,8 @@ public class QpidConfig public static class SaslClientFactory { - String type; - String factoryClass; + private String type; + private String factoryClass; SaslClientFactory(String type,String factoryClass) { diff --git a/qpid/java/common/src/main/java/org/apache/qpid/configuration/Accessor.java b/qpid/java/common/src/main/java/org/apache/qpid/configuration/Accessor.java index 134bd9da72..63a78f7971 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/configuration/Accessor.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/configuration/Accessor.java @@ -61,13 +61,18 @@ public interface Accessor static class MapAccessor implements Accessor { - protected Map<Object,Object> source; + private Map<Object,Object> source; public MapAccessor(Map<Object,Object> map) { source = map; } - + + protected void setSource(Map<Object, Object> source) + { + this.source = source; + } + public Boolean getBoolean(String name) { if (source != null && source.containsKey(name)) @@ -160,8 +165,10 @@ public interface Accessor { inStream.close(); } - source = props; + setSource(props); } + + } static class CombinedAccessor implements Accessor diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockDecoder.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockDecoder.java index 9867bbf4e2..9d5e654ad0 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockDecoder.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockDecoder.java @@ -39,7 +39,7 @@ public class AMQDataBlockDecoder _bodiesSupported[HeartbeatBody.TYPE] = new HeartbeatBodyFactory(); } - Logger _logger = LoggerFactory.getLogger(AMQDataBlockDecoder.class); + private Logger _logger = LoggerFactory.getLogger(AMQDataBlockDecoder.class); public AMQDataBlockDecoder() { } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentBody.java index 26b3bcc34c..6d6ec708d0 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentBody.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentBody.java @@ -33,7 +33,7 @@ public class ContentBody implements AMQBody { public static final byte TYPE = 3; - public byte[] _payload; + private byte[] _payload; public ContentBody() { @@ -42,7 +42,7 @@ public class ContentBody implements AMQBody public ContentBody(DataInput buffer, long size) throws AMQFrameDecodingException, IOException { _payload = new byte[(int)size]; - buffer.readFully(_payload); + buffer.readFully(getPayload()); } @@ -58,12 +58,12 @@ public class ContentBody implements AMQBody public int getSize() { - return _payload == null ? 0 : _payload.length; + return getPayload() == null ? 0 : getPayload().length; } public void writePayload(DataOutput buffer) throws IOException { - buffer.write(_payload); + buffer.write(getPayload()); } public void handle(final int channelId, final AMQVersionAwareProtocolSession session) @@ -77,7 +77,7 @@ public class ContentBody implements AMQBody if (size > 0) { _payload = new byte[(int)size]; - buffer.read(_payload); + buffer.read(getPayload()); } } @@ -86,6 +86,11 @@ public class ContentBody implements AMQBody { } + public byte[] getPayload() + { + return _payload; + } + private static class BufferContentBody implements AMQBody { private final int _length; diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java index 46f4c294b4..a0ed90244d 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java @@ -32,12 +32,11 @@ public class ContentHeaderBody implements AMQBody { public static final byte TYPE = 2; - public int classId; + private int classId; - public int weight; + private int weight; - /** unsigned long but java can't handle that anyway when allocating byte array */ - public long bodySize; + private long bodySize; /** must never be null */ private ContentHeaderProperties properties; @@ -153,4 +152,25 @@ public class ContentHeaderBody implements AMQBody ", properties=" + properties + '}'; } + + public int getClassId() + { + return classId; + } + + public int getWeight() + { + return weight; + } + + /** unsigned long but java can't handle that anyway when allocating byte array */ + public long getBodySize() + { + return bodySize; + } + + public void setBodySize(long bodySize) + { + this.bodySize = bodySize; + } } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolInitiation.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolInitiation.java index f2cac92c78..3c1e67f488 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolInitiation.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/ProtocolInitiation.java @@ -37,11 +37,11 @@ public class ProtocolInitiation extends AMQDataBlock implements EncodableAMQData private static final byte CURRENT_PROTOCOL_CLASS = 1; private static final byte TCP_PROTOCOL_INSTANCE = 1; - public final byte[] _protocolHeader; - public final byte _protocolClass; - public final byte _protocolInstance; - public final byte _protocolMajor; - public final byte _protocolMinor; + private final byte[] _protocolHeader; + private final byte _protocolClass; + private final byte _protocolInstance; + private final byte _protocolMajor; + private final byte _protocolMinor; // public ProtocolInitiation() {} @@ -207,6 +207,26 @@ public class ProtocolInitiation extends AMQDataBlock implements EncodableAMQData return pv; } + public byte getProtocolClass() + { + return _protocolClass; + } + + public byte getProtocolInstance() + { + return _protocolInstance; + } + + public byte getProtocolMajor() + { + return _protocolMajor; + } + + public byte getProtocolMinor() + { + return _protocolMinor; + } + public String toString() { StringBuffer buffer = new StringBuffer(new String(_protocolHeader)); diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_0_9/MethodConverter_0_9.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_0_9/MethodConverter_0_9.java index d2a639591a..b3eb1211a5 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_0_9/MethodConverter_0_9.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_0_9/MethodConverter_0_9.java @@ -119,7 +119,7 @@ public class MethodConverter_0_9 extends AbstractMethodConverter implements Prot public byte[] getData() { - return _contentBodyChunk._payload; + return _contentBodyChunk.getPayload(); } public void reduceToFit() diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_0_91/MethodConverter_0_91.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_0_91/MethodConverter_0_91.java index 6067a6ca6b..d33749d795 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_0_91/MethodConverter_0_91.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_0_91/MethodConverter_0_91.java @@ -118,7 +118,7 @@ public class MethodConverter_0_91 extends AbstractMethodConverter implements Pro public byte[] getData() { - return _contentBodyChunk._payload; + return _contentBodyChunk.getPayload(); } public void reduceToFit() diff --git a/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_8_0/MethodConverter_8_0.java b/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_8_0/MethodConverter_8_0.java index 80e47bb84c..4c7772a3a9 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_8_0/MethodConverter_8_0.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/framing/amqp_8_0/MethodConverter_8_0.java @@ -63,7 +63,7 @@ public class MethodConverter_8_0 extends AbstractMethodConverter implements Prot public byte[] getData() { - return contentBodyChunk._payload; + return contentBodyChunk.getPayload(); } public void reduceToFit() diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java index 9bf37f07ec..34ebdb441b 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java @@ -45,11 +45,11 @@ public class ClientDelegate extends ConnectionDelegate - protected final ConnectionSettings _conSettings; + private final ConnectionSettings _connectionSettings; public ClientDelegate(ConnectionSettings settings) { - this._conSettings = settings; + _connectionSettings = settings; } public void init(Connection conn, ProtocolHeader hdr) @@ -65,9 +65,9 @@ public class ClientDelegate extends ConnectionDelegate { Map<String,Object> clientProperties = new HashMap<String,Object>(); - if(this._conSettings.getClientProperties() != null) + if(this._connectionSettings.getClientProperties() != null) { - clientProperties.putAll(_conSettings.getClientProperties()); + clientProperties.putAll(_connectionSettings.getClientProperties()); } clientProperties.put("qpid.session_flow", 1); @@ -130,7 +130,7 @@ public class ClientDelegate extends ConnectionDelegate @Override public void connectionTune(Connection conn, ConnectionTune tune) { - int hb_interval = calculateHeartbeatInterval(_conSettings.getHeartbeatInterval(), + int hb_interval = calculateHeartbeatInterval(_connectionSettings.getHeartbeatInterval(), tune.getHeartbeatMin(), tune.getHeartbeatMax() ); @@ -145,7 +145,7 @@ public class ClientDelegate extends ConnectionDelegate //(or that forced by protocol limitations [0xFFFF]) conn.setChannelMax(channelMax == 0 ? Connection.MAX_CHANNEL_MAX : channelMax); - conn.connectionOpen(_conSettings.getVhost(), null, Option.INSIST); + conn.connectionOpen(_connectionSettings.getVhost(), null, Option.INSIST); } @Override @@ -220,7 +220,8 @@ public class ClientDelegate extends ConnectionDelegate } - - - + public ConnectionSettings getConnectionSettings() + { + return _connectionSettings; + } } diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java index f2216184aa..e04511497a 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/ConnectionSettings.java @@ -34,37 +34,37 @@ public class ConnectionSettings { public static final String WILDCARD_ADDRESS = "*"; - String protocol = "tcp"; - String host = "localhost"; - String vhost; - String username = "guest"; - String password = "guest"; - int port = 5672; - boolean tcpNodelay = Boolean.valueOf(System.getProperty(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, + private String protocol = "tcp"; + private String host = "localhost"; + private String vhost; + private String username = "guest"; + private String password = "guest"; + private int port = 5672; + private boolean tcpNodelay = Boolean.valueOf(System.getProperty(ClientProperties.QPID_TCP_NODELAY_PROP_NAME, System.getProperty(ClientProperties.AMQJ_TCP_NODELAY_PROP_NAME, "true"))); - int maxChannelCount = 32767; - int maxFrameSize = 65535; - int heartbeatInterval; - int readBufferSize = 65535; - int writeBufferSize = 65535; - long transportTimeout = 60000; + private int maxChannelCount = 32767; + private int maxFrameSize = 65535; + private int heartbeatInterval; + private int readBufferSize = 65535; + private int writeBufferSize = 65535; + private long transportTimeout = 60000; // SSL props - boolean useSSL; - String keyStorePath = System.getProperty("javax.net.ssl.keyStore"); - String keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword"); - String keyStoreCertType = System.getProperty("qpid.ssl.keyStoreCertType","SunX509");; - String trustStoreCertType = System.getProperty("qpid.ssl.trustStoreCertType","SunX509");; - String trustStorePath = System.getProperty("javax.net.ssl.trustStore");; - String trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");; - String certAlias; - boolean verifyHostname; + private boolean useSSL; + private String keyStorePath = System.getProperty("javax.net.ssl.keyStore"); + private String keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword"); + private String keyStoreCertType = System.getProperty("qpid.ssl.keyStoreCertType","SunX509");; + private String trustStoreCertType = System.getProperty("qpid.ssl.trustStoreCertType","SunX509");; + private String trustStorePath = System.getProperty("javax.net.ssl.trustStore");; + private String trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");; + private String certAlias; + private boolean verifyHostname; // SASL props - String saslMechs = System.getProperty("qpid.sasl_mechs", null); - String saslProtocol = System.getProperty("qpid.sasl_protocol", "AMQP"); - String saslServerName = System.getProperty("qpid.sasl_server_name", "localhost"); - boolean useSASLEncryption; + private String saslMechs = System.getProperty("qpid.sasl_mechs", null); + private String saslProtocol = System.getProperty("qpid.sasl_protocol", "AMQP"); + private String saslServerName = System.getProperty("qpid.sasl_server_name", "localhost"); + private boolean useSASLEncryption; private Map<String, Object> _clientProperties; diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/Struct.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/Struct.java index d3ff33ee3b..9b703a3117 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/Struct.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/Struct.java @@ -41,7 +41,7 @@ public abstract class Struct implements Encodable return StructFactory.create(type); } - boolean dirty = true; + private boolean dirty = true; public boolean isDirty() { diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java index 5e8acc22a8..a9321fbec1 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/sasl/SASLReceiver.java @@ -30,7 +30,7 @@ import java.nio.ByteBuffer; public class SASLReceiver extends SASLEncryptor implements Receiver<ByteBuffer> { - Receiver<ByteBuffer> delegate; + private Receiver<ByteBuffer> delegate; private byte[] netData; private static final Logger log = Logger.get(SASLReceiver.class); diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java index da31c271e1..7879f2c849 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/network/security/ssl/QpidClientX509KeyManager.java @@ -37,8 +37,8 @@ public class QpidClientX509KeyManager extends X509ExtendedKeyManager { private static final Logger log = Logger.get(QpidClientX509KeyManager.class); - X509ExtendedKeyManager delegate; - String alias; + private X509ExtendedKeyManager delegate; + private String alias; public QpidClientX509KeyManager(String alias, String keyStorePath, String keyStorePassword,String keyStoreCertType) throws GeneralSecurityException, IOException diff --git a/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java b/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java index 857d1decc4..3b9a0baab2 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java @@ -33,12 +33,12 @@ public class AMQBindingURL implements BindingURL { private static final Logger _logger = LoggerFactory.getLogger(AMQBindingURL.class); - String _url; - AMQShortString _exchangeClass = ExchangeDefaults.DIRECT_EXCHANGE_CLASS; - AMQShortString _exchangeName = new AMQShortString(""); - AMQShortString _destinationName = new AMQShortString("");; - AMQShortString _queueName = new AMQShortString(""); - AMQShortString[] _bindingKeys = new AMQShortString[0]; + private String _url; + private AMQShortString _exchangeClass = ExchangeDefaults.DIRECT_EXCHANGE_CLASS; + private AMQShortString _exchangeName = new AMQShortString(""); + private AMQShortString _destinationName = new AMQShortString("");; + private AMQShortString _queueName = new AMQShortString(""); + private AMQShortString[] _bindingKeys = new AMQShortString[0]; private HashMap<String, String> _options; public AMQBindingURL(String url) throws URISyntaxException diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java b/qpid/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java index cb276a70e5..e4cebb6926 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java @@ -655,22 +655,22 @@ public class CommandLineParser protected static class CommandLineOption { /** Holds the text for the flag to match this argument with. */ - public String option = null; + private String option = null; /** Holds a string describing how to use this command line argument. */ - public String argument = null; + private String argument = null; /** Flag that determines whether or not this command line argument can take arguments. */ - public boolean expectsArgs = false; + private boolean expectsArgs = false; /** Holds a short comment describing what this command line argument is for. */ - public String comment = null; + private String comment = null; /** Flag that determines whether or not this is an mandatory command line argument. */ - public boolean mandatory = false; + private boolean mandatory = false; /** A regular expression describing what format the argument to this option muist have. */ - public String argumentFormatRegexp = null; + private String argumentFormatRegexp = null; /** * Create a command line option object that holds specific information about a command line option. diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/ConcurrentLinkedMessageQueueAtomicSize.java b/qpid/java/common/src/main/java/org/apache/qpid/util/ConcurrentLinkedMessageQueueAtomicSize.java index 633cf4fe3a..0f9bd64233 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/util/ConcurrentLinkedMessageQueueAtomicSize.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/util/ConcurrentLinkedMessageQueueAtomicSize.java @@ -186,10 +186,10 @@ public class ConcurrentLinkedMessageQueueAtomicSize<E> extends ConcurrentLinkedQ return new Iterator<E>() { - final Iterator<E> _headIterator = _messageHead.iterator(); - final Iterator<E> _mainIterator = mainMessageIterator; + private final Iterator<E> _headIterator = _messageHead.iterator(); + private final Iterator<E> _mainIterator = mainMessageIterator; - Iterator<E> last; + private Iterator<E> last; public boolean hasNext() { @@ -217,7 +217,7 @@ public class ConcurrentLinkedMessageQueueAtomicSize<E> extends ConcurrentLinkedQ last.remove(); if(last == _mainIterator) { - _size.decrementAndGet(); + decrementSize(); } else { diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/ConcurrentLinkedQueueAtomicSize.java b/qpid/java/common/src/main/java/org/apache/qpid/util/ConcurrentLinkedQueueAtomicSize.java index c4d7683a02..dd91a067b5 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/util/ConcurrentLinkedQueueAtomicSize.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/util/ConcurrentLinkedQueueAtomicSize.java @@ -25,13 +25,20 @@ import java.util.concurrent.atomic.AtomicInteger; public class ConcurrentLinkedQueueAtomicSize<E> extends ConcurrentLinkedQueue<E> { - AtomicInteger _size = new AtomicInteger(0); + private AtomicInteger _size = new AtomicInteger(0); public int size() { return _size.get(); } + protected final void decrementSize() + { + _size.decrementAndGet(); + } + + + public boolean offer(E o) { diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent/BatchSynchQueueBase.java b/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent/BatchSynchQueueBase.java index de48925076..1d5f3b5e46 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent/BatchSynchQueueBase.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent/BatchSynchQueueBase.java @@ -70,7 +70,7 @@ public abstract class BatchSynchQueueBase<E> extends AbstractQueue<E> implements private static final Logger log = LoggerFactory.getLogger(BatchSynchQueueBase.class); /** Holds a reference to the queue implementation that holds the buffer. */ - Queue<SynchRecordImpl<E>> buffer; + private Queue<SynchRecordImpl<E>> buffer; /** Holds the number of items in the queue */ private int count; @@ -705,10 +705,10 @@ public abstract class BatchSynchQueueBase<E> extends AbstractQueue<E> implements public class SynchRefImpl implements SynchRef { /** Holds the number of synch records associated with this reference. */ - int numRecords; + private int numRecords; /** Holds a reference to the collection of synch records managed by this. */ - Collection<SynchRecord<E>> records; + private Collection<SynchRecord<E>> records; public SynchRefImpl(int n, Collection<SynchRecord<E>> records) { @@ -753,10 +753,10 @@ public abstract class BatchSynchQueueBase<E> extends AbstractQueue<E> implements public class SynchRecordImpl<E> implements SynchRecord<E> { /** A boolean latch that determines when the producer for this data item will be allowed to continue. */ - BooleanLatch latch = new BooleanLatch(); + private BooleanLatch latch = new BooleanLatch(); /** The data element associated with this item. */ - E element; + private E element; /** * Create a new synch record. diff --git a/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent/SynchException.java b/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent/SynchException.java index 99a83f96cd..23ee695079 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent/SynchException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent/SynchException.java @@ -34,7 +34,7 @@ package org.apache.qpid.util.concurrent; public class SynchException extends Exception { /** Holds the data element that is in error. */ - Object element; + private Object element; /** * Creates a new BaseApplicationException object. diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java index 4818ecc3d3..1a2c5283b0 100644 --- a/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java +++ b/qpid/java/common/src/test/java/org/apache/qpid/framing/BasicContentHeaderPropertiesTest.java @@ -32,10 +32,10 @@ import java.io.IOException; public class BasicContentHeaderPropertiesTest extends TestCase { - BasicContentHeaderProperties _testProperties; - FieldTable _testTable; - String _testString = "This is a test string"; - int _testint = 666; + private BasicContentHeaderProperties _testProperties; + private FieldTable _testTable; + private String _testString = "This is a test string"; + private int _testint = 666; /** * Currently only test setting/getting String, int and boolean props diff --git a/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java b/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java index ad075ff0c2..5a57db1650 100644 --- a/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java +++ b/qpid/java/common/src/test/java/org/apache/qpid/framing/abstraction/MessagePublishInfoImplTest.java @@ -26,9 +26,9 @@ import org.apache.qpid.framing.AMQShortString; public class MessagePublishInfoImplTest extends TestCase { - MessagePublishInfoImpl _mpi; - final AMQShortString _exchange = new AMQShortString("exchange"); - final AMQShortString _routingKey = new AMQShortString("routingKey"); + private MessagePublishInfoImpl _mpi; + private final AMQShortString _exchange = new AMQShortString("exchange"); + private final AMQShortString _routingKey = new AMQShortString("routingKey"); public void setUp() { diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java index 57c0549193..7d28f079ec 100644 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java +++ b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java @@ -25,7 +25,7 @@ import org.apache.qpid.test.utils.QpidTestCase; public class ConnectionSettingsTest extends QpidTestCase { - ConnectionSettings _conConnectionSettings; + private ConnectionSettings _conConnectionSettings; protected void setUp() throws Exception { diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskHandler.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskHandler.java index b91ce41ad3..631f4dcdf0 100644 --- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskHandler.java +++ b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskHandler.java @@ -43,10 +43,10 @@ import java.util.Queue; public class SetupTaskHandler implements SetupTaskAware { /** Holds the set up tasks. */ - Queue<Runnable> setups = new LinkedList<Runnable>(); + private Queue<Runnable> setups = new LinkedList<Runnable>(); /** Holds the tear down tasks. */ - Queue<Runnable> teardowns = new StackQueue<Runnable>(); + private Queue<Runnable> teardowns = new StackQueue<Runnable>(); /** * Adds the specified task to the tests setup. diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/XMLTestListener.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/XMLTestListener.java index ac875f89cf..003bd0cecc 100644 --- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/XMLTestListener.java +++ b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/XMLTestListener.java @@ -81,25 +81,25 @@ public class XMLTestListener implements TKTestListener, ShutdownHookable * explicit thread id must be used, where notifications come from different threads than the ones that called * the test method. */ - Map<Long, Result> threadLocalResults = Collections.synchronizedMap(new LinkedHashMap<Long, Result>()); + private Map<Long, Result> threadLocalResults = Collections.synchronizedMap(new LinkedHashMap<Long, Result>()); /** * Holds results for tests that have ended. Transferring these results here from the per-thread results map, means * that the thread id is freed for the thread to generate more results. */ - List<Result> results = new ArrayList<Result>(); + private List<Result> results = new ArrayList<Result>(); /** Holds the overall error count. */ - protected int errors = 0; + private int errors = 0; /** Holds the overall failure count. */ - protected int failures = 0; + private int failures = 0; /** Holds the overall tests run count. */ - protected int runs = 0; + private int runs = 0; /** Holds the name of the class that tests are being run for. */ - String testClassName; + private String testClassName; /** * Creates a new XML results output listener that writes to the specified location. diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Application.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Application.java index a1c4b7ddb0..5855b9ae55 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Application.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Application.java @@ -31,7 +31,7 @@ import org.eclipse.ui.PlatformUI; */ public class Application implements IPlatformRunnable { - static Shell shell = null; + private static Shell shell = null; /* * The call to createAndRunWorkbench will not return until the workbench is closed. diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/AttributeData.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/AttributeData.java index 5b188d8046..36c67a6ae1 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/AttributeData.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/AttributeData.java @@ -22,12 +22,12 @@ package org.apache.qpid.management.ui.model; public class AttributeData { - String name = ""; - String description = ""; - String dataType = ""; - Object value = ""; - boolean readable = true; - boolean writable = false; + private String name = ""; + private String description = ""; + private String dataType = ""; + private Object value = ""; + private boolean readable = true; + private boolean writable = false; public String getDataType() diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/ManagedAttributeModel.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/ManagedAttributeModel.java index c4d2b91f81..41a37bf428 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/ManagedAttributeModel.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/ManagedAttributeModel.java @@ -26,7 +26,7 @@ import java.util.List; public class ManagedAttributeModel { - HashMap<String, AttributeData> _attributeMap = new HashMap<String, AttributeData>(); + private HashMap<String, AttributeData> _attributeMap = new HashMap<String, AttributeData>(); public void setAttributeValue(String name, Object value) { diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationInfoModel.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationInfoModel.java index 6d4160889e..7cfc9e41c2 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationInfoModel.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/NotificationInfoModel.java @@ -22,9 +22,9 @@ package org.apache.qpid.management.ui.model; public class NotificationInfoModel { - String name; - String description; - String[] types; + private String name; + private String description; + private String[] types; public NotificationInfoModel(String name, String desc, String[] types) { diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/OperationDataModel.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/OperationDataModel.java index 2595841287..95f6d0c9b8 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/OperationDataModel.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/model/OperationDataModel.java @@ -28,7 +28,7 @@ import java.util.List; public class OperationDataModel { - HashMap<String, OperationData> _operationMap = new HashMap<String, OperationData>(); + private HashMap<String, OperationData> _operationMap = new HashMap<String, OperationData>(); public void addOperation(MBeanOperationInfo opInfo) { diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java index f929e73353..de356ddb13 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java @@ -94,7 +94,7 @@ public class AttributesTabControl extends TabControl private Composite _buttonsComposite = null; private DisposeListener tableDisposeListener = new DisposeListenerImpl(); - final Image image; + private final Image image; private Button _detailsButton = null; private Button _editButton = null; private Button _graphButton = null; @@ -288,8 +288,8 @@ public class AttributesTabControl extends TabControl */ private class MouseListenerImpl implements MouseTrackListener, MouseMoveListener, KeyListener, MouseListener { - Shell tooltipShell = null; - Label tooltipLabel = null; + private Shell tooltipShell = null; + private Label tooltipLabel = null; public void mouseHover(MouseEvent event) { TableItem item = _table.getItem (new Point (event.x, event.y)); @@ -418,7 +418,7 @@ public class AttributesTabControl extends TabControl /** * Listener class for table tooltip label */ - final Listener tooltipLabelListener = new Listener () + private final Listener tooltipLabelListener = new Listener () { public void handleEvent (Event event) { @@ -850,7 +850,7 @@ public class AttributesTabControl extends TabControl IFontProvider, IColorProvider { - AttributeData attribute = null; + private AttributeData attribute = null; public String getColumnText(Object element, int columnIndex) { String result = ""; diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java index 6723f751e9..d2cf99a1d4 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java @@ -176,8 +176,8 @@ public class NavigationView extends ViewPart // with right click. _treeViewer.getTree().addListener(SWT.MenuDetect, new Listener() { - Display display = getSite().getShell().getDisplay(); - final Shell shell = new Shell(display); + private Display display = getSite().getShell().getDisplay(); + private final Shell shell = new Shell(display); public void handleEvent(Event event) { diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java index 1c9e221dee..4fc4ddc07b 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java @@ -220,8 +220,8 @@ public class VHNotificationsTabControl extends TabControl { _tableViewer.addDoubleClickListener(new IDoubleClickListener() { - Display display = null; - Shell shell = null; + private Display display = null; + private Shell shell = null; public void doubleClick(DoubleClickEvent event) { display = Display.getCurrent(); @@ -344,7 +344,7 @@ public class VHNotificationsTabControl extends TabControl */ protected static class LabelProviderImpl implements ITableLabelProvider { - List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>(); + private List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>(); public void addListener(ILabelProviderListener listener) { listeners.add(listener); diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java index 10e2f78c1c..ba4e091b73 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java @@ -99,8 +99,8 @@ public class ViewUtility } private static final int DEFAULT_CONTENT_SIZE = 198; - static Button _firstButton, _nextButton, _previousButton, _lastButton; - static Text _hexNumTextToEnd, _hexNumTextToStart; + private static Button _firstButton, _nextButton, _previousButton, _lastButton; + private static Text _hexNumTextToEnd, _hexNumTextToStart; /** * Populates the composite with given openmbean data type (TabularType or CompositeType) diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/exchange/ExchangeOperationsTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/exchange/ExchangeOperationsTabControl.java index 07620a1cba..43db89baea 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/exchange/ExchangeOperationsTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/exchange/ExchangeOperationsTabControl.java @@ -397,7 +397,7 @@ public class ExchangeOperationsTabControl extends TabControl */ private static class ContentProviderImpl implements IStructuredContentProvider { - String type; + private String type; public ContentProviderImpl(String type) { @@ -435,7 +435,7 @@ public class ExchangeOperationsTabControl extends TabControl */ private static class LabelProviderImpl extends LabelProvider implements ITableLabelProvider { - String type; + private String type; public LabelProviderImpl(String type) { diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/exchange/HeadersExchangeOperationsTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/exchange/HeadersExchangeOperationsTabControl.java index d9043e7cb4..6b8b744c43 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/exchange/HeadersExchangeOperationsTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/exchange/HeadersExchangeOperationsTabControl.java @@ -336,7 +336,7 @@ public class HeadersExchangeOperationsTabControl extends TabControl */ private static class ContentProviderImpl implements IStructuredContentProvider { - String type; + private String type; public ContentProviderImpl(String type) { @@ -374,7 +374,7 @@ public class HeadersExchangeOperationsTabControl extends TabControl */ private static class LabelProviderImpl extends LabelProvider implements ITableLabelProvider { - String type; + private String type; public LabelProviderImpl(String type) { diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/ConnectionTypeTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/ConnectionTypeTabControl.java index 0251401686..37bd17c3c3 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/ConnectionTypeTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/ConnectionTypeTabControl.java @@ -45,7 +45,7 @@ public class ConnectionTypeTabControl extends MBeanTypeTabControl @Override protected List<ManagedBean> getMbeans() { - return _serverRegistry.getConnections(_virtualHost); + return getServerRegistry().getConnections(getVirtualHost()); } } diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/ExchangeTypeTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/ExchangeTypeTabControl.java index e793751711..3995f94eb0 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/ExchangeTypeTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/ExchangeTypeTabControl.java @@ -40,7 +40,7 @@ public class ExchangeTypeTabControl extends MBeanTypeTabControl @Override protected List<ManagedBean> getMbeans() { - return _serverRegistry.getExchanges(_virtualHost); + return getServerRegistry().getExchanges(getVirtualHost()); } } diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java index 4f33b7eb04..17d430efee 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/MBeanTypeTabControl.java @@ -65,20 +65,20 @@ import java.util.List; public abstract class MBeanTypeTabControl extends TabControl { - protected FormToolkit _toolkit; - protected Form _form; - protected Table _table = null; - protected TableViewer _tableViewer = null; - - protected List<ManagedBean> _mbeans = null; - protected String _type; - protected ApiVersion _ApiVersion; - protected JMXManagedObject _vhostMbean; - protected String _virtualHost; - protected JMXServerRegistry _serverRegistry; - protected Composite _tableComposite; - protected Button _favouritesButton; - protected Button _openButton; + private FormToolkit _toolkit; + private Form _form; + private Table _table = null; + private TableViewer _tableViewer = null; + + private List<ManagedBean> _mbeanList = null; + private String _type; + private ApiVersion _ApiVersion; + private JMXManagedObject _vhostMbean; + private String _virtualHost; + private JMXServerRegistry _serverRegistry; + private Composite _tableComposite; + private Button _favouritesButton; + private Button _openButton; public MBeanTypeTabControl(TabFolder tabFolder, ManagedServer server, String virtualHost, String type) { @@ -125,9 +125,9 @@ public abstract class MBeanTypeTabControl extends TabControl @Override public void refresh(ManagedBean mbean) { - _mbeans = getMbeans(); + _mbeanList = getMbeans(); - _tableViewer.setInput(_mbeans); + _tableViewer.setInput(_mbeanList); layout(); } @@ -291,7 +291,72 @@ public abstract class MBeanTypeTabControl extends TabControl { } - + + protected FormToolkit getToolkit() + { + return _toolkit; + } + + protected Table getTable() + { + return _table; + } + + protected void setTable(Table table) + { + _table = table; + } + + protected TableViewer getTableViewer() + { + return _tableViewer; + } + + protected void setTableViewer(TableViewer tableViewer) + { + _tableViewer = tableViewer; + } + + protected List<ManagedBean> getMbeanList() + { + return _mbeanList; + } + + protected void setMbeanList(List<ManagedBean> mbeanList) + { + _mbeanList = mbeanList; + } + + protected String getType() + { + return _type; + } + + protected ApiVersion getApiVersion() + { + return _ApiVersion; + } + + protected JMXManagedObject getVhostMbean() + { + return _vhostMbean; + } + + protected String getVirtualHost() + { + return _virtualHost; + } + + protected JMXServerRegistry getServerRegistry() + { + return _serverRegistry; + } + + protected Composite getTableComposite() + { + return _tableComposite; + } + /** * Content Provider class for the table viewer */ diff --git a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java index 592dc1e4cb..6cf9981c9e 100644 --- a/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java +++ b/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/type/QueueTypeTabControl.java @@ -110,11 +110,11 @@ public class QueueTypeTabControl extends MBeanTypeTabControl public QueueTypeTabControl(TabFolder tabFolder, ManagedServer server, String virtualHost) { super(tabFolder,server,virtualHost,QUEUE); - _mbsc = (MBeanServerConnection) _serverRegistry.getServerConnection(); + _mbsc = (MBeanServerConnection) getServerRegistry().getServerConnection(); //create a proxy for the VirtualHostManager mbean to use in retrieving the attribute names/values _vhmb = MBeanServerInvocationHandler.newProxyInstance(_mbsc, - _vhostMbean.getObjectName(), ManagedBroker.class, false); + getVhostMbean().getObjectName(), ManagedBroker.class, false); } @@ -235,7 +235,7 @@ public class QueueTypeTabControl extends MBeanTypeTabControl { List<List<Object>> values = null; - if(_ApiVersion.greaterThanOrEqualTo(1, 3)) + if(getApiVersion().greaterThanOrEqualTo(1, 3)) { //Qpid JMX API 1.3+, use this virtualhosts VirtualHostManager MBean //to retrieve the attributes values requested for all queues at once @@ -245,18 +245,18 @@ public class QueueTypeTabControl extends MBeanTypeTabControl } catch(Exception e) { - MBeanUtility.handleException(_vhostMbean, e); + MBeanUtility.handleException(getVhostMbean(), e); } } else { //Qpid JMX API 1.2 or below, use the local ManagedBeans and look //up the attribute values for each queue individually - _mbeans = getMbeans(); - values = MBeanUtility.getQueueAttributes(_mbeans, _selectedAttributes.toArray(new String[0])); + setMbeanList(getMbeans()); + values = MBeanUtility.getQueueAttributes(getMbeanList(), _selectedAttributes.toArray(new String[0])); } - _tableViewer.setInput(values); + getTableViewer().setInput(values); layout(); } finally @@ -270,31 +270,31 @@ public class QueueTypeTabControl extends MBeanTypeTabControl @Override protected List<ManagedBean> getMbeans() { - return _serverRegistry.getQueues(_virtualHost); + return getServerRegistry().getQueues(getVirtualHost()); } private void clearTableComposite() { - ViewUtility.disposeChildren(_tableComposite); + ViewUtility.disposeChildren(getTableComposite()); } @Override protected void createTable() { - _table = new Table (_tableComposite, SWT.MULTI | SWT.SCROLL_LINE | SWT.BORDER | SWT.FULL_SELECTION); - _table.setLinesVisible (true); - _table.setHeaderVisible (true); + setTable(new Table (getTableComposite(), SWT.MULTI | SWT.SCROLL_LINE | SWT.BORDER | SWT.FULL_SELECTION)); + getTable().setLinesVisible(true); + getTable().setHeaderVisible(true); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); - _table.setLayoutData(data); + getTable().setLayoutData(data); - _tableViewer = new TableViewer(_table); + setTableViewer(new TableViewer(getTable())); final QueueTableSorter tableSorter = new QueueTableSorter(); for (int i = 0; i < _selectedAttributes.size(); i++) { final int index = i; - final TableViewerColumn viewerColumn = new TableViewerColumn(_tableViewer, SWT.NONE); + final TableViewerColumn viewerColumn = new TableViewerColumn(getTableViewer(), SWT.NONE); final TableColumn column = viewerColumn.getColumn(); String attrName = _selectedAttributes.get(i); @@ -320,7 +320,7 @@ public class QueueTypeTabControl extends MBeanTypeTabControl public void widgetSelected(SelectionEvent e) { tableSorter.setColumn(index); - final TableViewer viewer = _tableViewer; + final TableViewer viewer = getTableViewer(); int dir = viewer .getTable().getSortDirection(); if (viewer.getTable().getSortColumn() == column) { @@ -338,25 +338,25 @@ public class QueueTypeTabControl extends MBeanTypeTabControl } - _tableViewer.setContentProvider(new QueueContentProviderImpl()); - _tableViewer.setLabelProvider(new QueueLabelProviderImpl()); + getTableViewer().setContentProvider(new QueueContentProviderImpl()); + getTableViewer().setLabelProvider(new QueueLabelProviderImpl()); - _tableViewer.setUseHashlookup(true); - _tableViewer.setSorter(tableSorter); - _table.setSortColumn(_table.getColumn(0)); - _table.setSortDirection(SWT.UP); + getTableViewer().setUseHashlookup(true); + getTableViewer().setSorter(tableSorter); + getTable().setSortColumn(getTable().getColumn(0)); + getTable().setSortDirection(SWT.UP); addTableListeners(); } protected void createLowerAreaButton(Composite parent) { - Composite lowerButtonComposite = _toolkit.createComposite(parent, SWT.NONE); + Composite lowerButtonComposite = getToolkit().createComposite(parent, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); lowerButtonComposite.setLayoutData(gridData); lowerButtonComposite.setLayout(new GridLayout()); - final Button attributesButton = _toolkit.createButton(lowerButtonComposite, "Select Attributes ...", SWT.PUSH); + final Button attributesButton = getToolkit().createButton(lowerButtonComposite, "Select Attributes ...", SWT.PUSH); gridData = new GridData(SWT.RIGHT, SWT.CENTER, true, false); attributesButton.setLayoutData(gridData); attributesButton.addSelectionListener(new SelectionAdapter() @@ -372,7 +372,7 @@ public class QueueTypeTabControl extends MBeanTypeTabControl { List<String> availableAttributes; - if(_ApiVersion.greaterThanOrEqualTo(1, 3)) + if(getApiVersion().greaterThanOrEqualTo(1, 3)) { //Qpid JMX API 1.3+, request the current queue attributes names from the broker try @@ -395,7 +395,7 @@ public class QueueTypeTabControl extends MBeanTypeTabControl final Shell shell = ViewUtility.createModalDialogShell(parent, "Select Attributes"); - Composite attributesComposite = _toolkit.createComposite(shell, SWT.NONE); + Composite attributesComposite = getToolkit().createComposite(shell, SWT.NONE); attributesComposite.setBackground(shell.getBackground()); attributesComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); attributesComposite.setLayout(new GridLayout(2,false)); @@ -441,14 +441,14 @@ public class QueueTypeTabControl extends MBeanTypeTabControl }); } - Composite okCancelButtonsComp = _toolkit.createComposite(shell); + Composite okCancelButtonsComp = getToolkit().createComposite(shell); okCancelButtonsComp.setBackground(shell.getBackground()); okCancelButtonsComp.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, true)); okCancelButtonsComp.setLayout(new GridLayout(2,false)); - Button okButton = _toolkit.createButton(okCancelButtonsComp, "OK", SWT.PUSH); + Button okButton = getToolkit().createButton(okCancelButtonsComp, "OK", SWT.PUSH); okButton.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); - Button cancelButton = _toolkit.createButton(okCancelButtonsComp, "Cancel", SWT.PUSH); + Button cancelButton = getToolkit().createButton(okCancelButtonsComp, "Cancel", SWT.PUSH); cancelButton.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); okButton.addSelectionListener(new SelectionAdapter() @@ -506,7 +506,7 @@ public class QueueTypeTabControl extends MBeanTypeTabControl return "-"; } - if (_ApiVersion.greaterThanOrEqualTo(1,2)) + if (getApiVersion().greaterThanOrEqualTo(1, 2)) { //Qpid JMX API 1.2 or above, returns Bytes return convertLongBytesToText(value); @@ -675,14 +675,14 @@ public class QueueTypeTabControl extends MBeanTypeTabControl @Override protected void addMBeanToFavourites() { - int selectionIndex = _table.getSelectionIndex(); + int selectionIndex = getTable().getSelectionIndex(); if (selectionIndex == -1) { return; } - int[] selectedIndices = _table.getSelectionIndices(); + int[] selectedIndices = getTable().getSelectionIndices(); ArrayList<ManagedBean> selectedMBeans = new ArrayList<ManagedBean>(); @@ -690,10 +690,10 @@ public class QueueTypeTabControl extends MBeanTypeTabControl //the entries are created from an List<Object> with the attribute values (name first) for(int index = 0; index < selectedIndices.length ; index++) { - List<Object> queueEntry = (List<Object>) _table.getItem(selectedIndices[index]).getData(); + List<Object> queueEntry = (List<Object>) getTable().getItem(selectedIndices[index]).getData(); String queueName = (String) queueEntry.get(0); - ManagedBean queueMBean = _serverRegistry.getQueue(queueName, _virtualHost); + ManagedBean queueMBean = getServerRegistry().getQueue(queueName, getVirtualHost()); //check queue had not already been unregistered before trying to add it if(queueMBean != null) @@ -740,7 +740,7 @@ public class QueueTypeTabControl extends MBeanTypeTabControl @Override protected void openMBean() { - int selectionIndex = _table.getSelectionIndex(); + int selectionIndex = getTable().getSelectionIndex(); if (selectionIndex == -1) { @@ -750,9 +750,9 @@ public class QueueTypeTabControl extends MBeanTypeTabControl ManagedBean selectedMBean; //the entries are created from an List<Object> with the attribute values (name first) - List<Object> queueEntry = (List<Object>) _table.getItem(selectionIndex).getData(); + List<Object> queueEntry = (List<Object>) getTable().getItem(selectionIndex).getData(); String queueName = (String) queueEntry.get(0); - selectedMBean = _serverRegistry.getQueue(queueName, _virtualHost); + selectedMBean = getServerRegistry().getQueue(queueName, getVirtualHost()); if(selectedMBean == null) { diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/TopicWithSelectorsTransientVolumeTest.java b/qpid/java/perftests/src/main/java/org/apache/qpid/topic/TopicWithSelectorsTransientVolumeTest.java index e0c0b00335..1d6ec07bb0 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/TopicWithSelectorsTransientVolumeTest.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/topic/TopicWithSelectorsTransientVolumeTest.java @@ -51,8 +51,8 @@ public class TopicWithSelectorsTransientVolumeTest extends QpidBrokerTestCase private static final int MSG_SIZE = 1024; private static final byte[] BYTE_ARRAY = new byte[MSG_SIZE]; - ArrayList<MyMessageSubscriber> _subscribers = new ArrayList<MyMessageSubscriber>(); - HashMap<String,Long> _queueMsgCounts = new HashMap<String,Long>(); + private ArrayList<MyMessageSubscriber> _subscribers = new ArrayList<MyMessageSubscriber>(); + private HashMap<String,Long> _queueMsgCounts = new HashMap<String,Long>(); private final static Object _lock=new Object(); private boolean _producerFailed; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/AMQTestConnection_0_10.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/AMQTestConnection_0_10.java index 09a03a17a0..c5dd523214 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/AMQTestConnection_0_10.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/AMQTestConnection_0_10.java @@ -29,6 +29,6 @@ public class AMQTestConnection_0_10 extends AMQConnection public Connection getConnection() { - return((AMQConnectionDelegate_0_10)_delegate).getQpidConnection(); + return((AMQConnectionDelegate_0_10)getDelegate()).getQpidConnection(); } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/DispatcherTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/DispatcherTest.java index b42293066c..3537dd0533 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/DispatcherTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/DispatcherTest.java @@ -53,15 +53,15 @@ public class DispatcherTest extends QpidBrokerTestCase { private static final Logger _logger = LoggerFactory.getLogger(DispatcherTest.class); - Context _context; + private Context _context; private static final int MSG_COUNT = 6; private int _receivedCount = 0; private int _receivedCountWhileStopped = 0; private Connection _clientConnection, _producerConnection; private MessageConsumer _consumer; - MessageProducer _producer; - Session _clientSession, _producerSession; + private MessageProducer _producer; + private Session _clientSession, _producerSession; private final CountDownLatch _allFirstMessagesSent = new CountDownLatch(1); // all messages Sent Lock private final CountDownLatch _allSecondMessagesSent = new CountDownLatch(1); // all messages Sent Lock diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/MessageListenerMultiConsumerTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/MessageListenerMultiConsumerTest.java index 615d765ed5..4fd10a0134 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/MessageListenerMultiConsumerTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/MessageListenerMultiConsumerTest.java @@ -50,7 +50,7 @@ public class MessageListenerMultiConsumerTest extends QpidBrokerTestCase { private static final Logger _logger = LoggerFactory.getLogger(MessageListenerMultiConsumerTest.class); - Context _context; + private Context _context; private static final int MSG_COUNT = 6; private int receivedCount1 = 0; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/MessageListenerTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/MessageListenerTest.java index 1fdd7ce681..142f301bd0 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/MessageListenerTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/MessageListenerTest.java @@ -52,7 +52,7 @@ public class MessageListenerTest extends QpidBrokerTestCase implements MessageLi { private static final Logger _logger = LoggerFactory.getLogger(MessageListenerTest.class); - Context _context; + private Context _context; private static final int MSG_COUNT = 5; private int _receivedCount = 0; @@ -245,7 +245,6 @@ public class MessageListenerTest extends QpidBrokerTestCase implements MessageLi _awaitMessages.countDown(); } - @Override public void onException(JMSException e) { _logger.info("Exception received", e); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/ResetMessageListenerTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/ResetMessageListenerTest.java index 53f02bb234..6ff6681c47 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/ResetMessageListenerTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/ResetMessageListenerTest.java @@ -51,13 +51,13 @@ public class ResetMessageListenerTest extends QpidBrokerTestCase { private static final Logger _logger = LoggerFactory.getLogger(ResetMessageListenerTest.class); - Context _context; + private Context _context; private static final int MSG_COUNT = 6; private Connection _clientConnection, _producerConnection; private MessageConsumer _consumer1; - MessageProducer _producer; - Session _clientSession, _producerSession; + private MessageProducer _producer; + private Session _clientSession, _producerSession; private final CountDownLatch _allFirstMessagesSent = new CountDownLatch(MSG_COUNT); // all messages Sent Lock private final CountDownLatch _allSecondMessagesSent = new CountDownLatch(MSG_COUNT); // all messages Sent Lock diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/SessionCreateTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/SessionCreateTest.java index 9bf96abe91..d7295b298e 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/SessionCreateTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/SessionCreateTest.java @@ -37,7 +37,7 @@ public class SessionCreateTest extends QpidBrokerTestCase { private static final Logger _logger = LoggerFactory.getLogger(MessageListenerTest.class); - Context _context; + private Context _context; private Connection _clientConnection; protected int maxSessions = 65555; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/message/AMQPEncodedMapMessageTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/message/AMQPEncodedMapMessageTest.java index 4a26f93cfd..c4b1b08eea 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/message/AMQPEncodedMapMessageTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/message/AMQPEncodedMapMessageTest.java @@ -42,9 +42,9 @@ public class AMQPEncodedMapMessageTest extends QpidBrokerTestCase { private Connection _connection; private Session _session; - MessageConsumer _consumer; - MessageProducer _producer; - UUID myUUID = UUID.randomUUID(); + private MessageConsumer _consumer; + private MessageProducer _producer; + private UUID myUUID = UUID.randomUUID(); public void setUp() throws Exception { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java index 60bb7ed46a..6f54a56e93 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java @@ -33,7 +33,7 @@ import org.apache.qpid.test.utils.QpidBrokerTestCase; */ public class ServerConfigurationFileTest extends QpidBrokerTestCase { - ServerConfiguration _serverConfig; + private ServerConfiguration _serverConfig; public void setUp() throws ConfigurationException { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java index 379f6c89d3..b666b1f424 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AbstractTestLogging.java @@ -47,7 +47,7 @@ public class AbstractTestLogging extends QpidBrokerTestCase public static final String TEST_LOG_PREFIX = "MESSAGE"; protected LogMonitor _monitor; - InternalBrokerBaseCase _configLoader; + private InternalBrokerBaseCase _configLoader; @Override public void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java index be2da128bc..2c7288de14 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/BindingLoggingTest.java @@ -45,10 +45,10 @@ public class BindingLoggingTest extends AbstractTestLogging static final String BND_PREFIX = "BND-"; - Connection _connection; - Session _session; - Queue _queue; - Topic _topic; + private Connection _connection; + private Session _session; + private Queue _queue; + private Topic _topic; @Override public void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java index 10aa4011bb..edffa7c0c0 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java @@ -53,11 +53,11 @@ public class ExchangeLoggingTest extends AbstractTestLogging static final String EXH_PREFIX = "EXH-"; - Connection _connection; - Session _session; - Queue _queue; - String _name; - String _type; + private Connection _connection; + private Session _session; + private Queue _queue; + private String _name; + private String _type; @Override public void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java index 9190a4c203..ddcb96b4db 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java @@ -49,10 +49,10 @@ public class SubscriptionLoggingTest extends AbstractTestLogging { static final String SUB_PREFIX = "SUB-"; - Connection _connection; - Session _session; - Queue _queue; - Topic _topic; + private Connection _connection; + private Session _session; + private Queue _queue; + private Topic _topic; @Override public void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/TestingBaseCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/TestingBaseCase.java index dd0ee7e5e1..86c9462fc9 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/TestingBaseCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/TestingBaseCase.java @@ -43,7 +43,7 @@ import java.util.concurrent.TimeUnit; public class TestingBaseCase extends QpidBrokerTestCase implements ExceptionListener, ConnectionListener { - Topic _destination; + private Topic _destination; protected CountDownLatch _disconnectionLatch = new CountDownLatch(1); protected int MAX_QUEUE_MESSAGE_COUNT; protected int MESSAGE_SIZE = DEFAULT_MESSAGE_SIZE; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java index e7c1452a7f..e06ed6e171 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java @@ -96,7 +96,7 @@ public class DupsOkTest extends QpidBrokerTestCase consumer.setMessageListener(new MessageListener() { - int _msgCount = 0; + private int _msgCount = 0; public void onMessage(Message message) { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/MessageToStringTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/MessageToStringTest.java index 106d3a3a16..dc1f690b1e 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/MessageToStringTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/MessageToStringTest.java @@ -47,7 +47,7 @@ public class MessageToStringTest extends QpidBrokerTestCase private Connection _connection; private Session _session; private Queue _queue; - MessageConsumer _consumer; + private MessageConsumer _consumer; private static final String BYTE_TEST = "MapByteTest"; public void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/ObjectMessageTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/ObjectMessageTest.java index b0bf1421b4..3bd2c4a44e 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/ObjectMessageTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/ObjectMessageTest.java @@ -37,8 +37,8 @@ public class ObjectMessageTest extends QpidBrokerTestCase { private Connection _connection; private Session _session; - MessageConsumer _consumer; - MessageProducer _producer; + private MessageConsumer _consumer; + private MessageProducer _producer; public void setUp() throws Exception { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/ExceptionMonitor.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/ExceptionMonitor.java index 71725140cd..afb7b5bc5b 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/ExceptionMonitor.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/ExceptionMonitor.java @@ -58,7 +58,7 @@ public class ExceptionMonitor implements ExceptionListener private final Logger log = Logger.getLogger(ExceptionMonitor.class); /** Holds the received exceptions. */ - List<Exception> exceptions = new ArrayList<Exception>(); + private List<Exception> exceptions = new ArrayList<Exception>(); /** * Receives incoming exceptions. diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java index 8df82d6922..809bb1dd2f 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java @@ -57,7 +57,7 @@ public class FanOutTestDecorator extends DistributedTestDecorator implements Mes private static final Logger log = Logger.getLogger(FanOutTestDecorator.class); /** Holds the currently running test case. */ - FrameworkBaseCase currentTest = null; + private FrameworkBaseCase currentTest = null; /** * Creates a wrapped suite test decorator from another one. diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java index 4c4f5ecc2d..833f5fb674 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java @@ -65,7 +65,7 @@ import java.util.Properties; public class FanOutCircuitFactory extends BaseCircuitFactory { /** Used for debugging. */ - Logger log = Logger.getLogger(FanOutCircuitFactory.class); + private Logger log = Logger.getLogger(FanOutCircuitFactory.class); /** * Creates a test circuit for the test, configered by the test parameters specified. diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java index e36b052e48..a4c6888d68 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java @@ -58,7 +58,7 @@ import java.util.Properties; public class InteropCircuitFactory extends BaseCircuitFactory { /** Used for debugging. */ - Logger log = Logger.getLogger(InteropCircuitFactory.class); + private Logger log = Logger.getLogger(InteropCircuitFactory.class); /** * Creates a test circuit for the test, configered by the test parameters specified. diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java index 6cd67068ee..23ea4ac258 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java @@ -382,8 +382,8 @@ public class RecoverTest extends QpidBrokerTestCase cons.setMessageListener(new MessageListener() { - int messageSeen = 0; - int expectedIndex = 0; + private int messageSeen = 0; + private int expectedIndex = 0; public void onMessage(Message message) { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/FieldTableMessageTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/FieldTableMessageTest.java index 1d0beb155b..599c8061a7 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/FieldTableMessageTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/FieldTableMessageTest.java @@ -55,7 +55,7 @@ public class FieldTableMessageTest extends QpidBrokerTestCase implements Message private final ArrayList<JMSBytesMessage> received = new ArrayList<JMSBytesMessage>(); private FieldTable _expected; private int _count = 10; - public String _connectionString = "vm://:1"; + private String _connectionString = "vm://:1"; private CountDownLatch _waitForCompletion; protected void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java index 7774144a29..3c26cbb3c9 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java @@ -72,6 +72,11 @@ public class MultipleConnectionTest extends QpidBrokerTestCase { _connection.close(); } + + public MessageCounter[] getCounters() + { + return _counters; + } } private class Publisher @@ -151,7 +156,7 @@ public class MultipleConnectionTest extends QpidBrokerTestCase { for (int i = 0; i < receivers.length; i++) { - waitForCompletion(expected, wait, receivers[i]._counters); + waitForCompletion(expected, wait, receivers[i].getCounters()); } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java index fcf27ffe8a..c20eefd987 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java @@ -52,7 +52,7 @@ public class ChannelCloseTest extends QpidBrokerTestCase implements ExceptionLis { private static final Logger _logger = LoggerFactory.getLogger(ChannelCloseTest.class); - Connection _connection; + private Connection _connection; private Session _session; private static final long SYNC_TIMEOUT = 500; private int TEST = 0; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java index aebcdffd20..0650531d2b 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionStartTest.java @@ -38,9 +38,9 @@ import java.util.concurrent.TimeUnit; public class ConnectionStartTest extends QpidBrokerTestCase { - String _broker = "vm://:1"; + private String _broker = "vm://:1"; - AMQConnection _connection; + private AMQConnection _connection; private Session _consumerSess; private MessageConsumer _consumer; diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java index 57f34277c4..375626a2fa 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java @@ -43,9 +43,9 @@ import javax.jms.TopicSession; public class ConnectionTest extends QpidBrokerTestCase { - String _broker_NotRunning = "tcp://localhost:" + findFreePort(); + private String _broker_NotRunning = "tcp://localhost:" + findFreePort(); - String _broker_BadDNS = "tcp://hg3sgaaw4lgihjs"; + private String _broker_BadDNS = "tcp://hg3sgaaw4lgihjs"; public void testSimpleConnection() throws Exception { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/protocol/AMQProtocolSessionTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/protocol/AMQProtocolSessionTest.java index 477d9d835a..1a7e9dfc96 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/protocol/AMQProtocolSessionTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/protocol/AMQProtocolSessionTest.java @@ -44,7 +44,7 @@ public class AMQProtocolSessionTest extends QpidBrokerTestCase public TestNetworkConnection getNetworkConnection() { - return (TestNetworkConnection) _protocolHandler.getNetworkConnection(); + return (TestNetworkConnection) getProtocolHandler().getNetworkConnection(); } public AMQShortString genQueueName() diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/CloseBeforeAckTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/CloseBeforeAckTest.java index fde537e99e..4da9a1db29 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/CloseBeforeAckTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/CloseBeforeAckTest.java @@ -45,8 +45,8 @@ public class CloseBeforeAckTest extends QpidBrokerTestCase { private static final Logger log = LoggerFactory.getLogger(CloseBeforeAckTest.class); - Connection connection; - Session session; + private Connection connection; + private Session session; public static final String TEST_QUEUE_NAME = "TestQueue"; private int TEST_COUNT = 25; @@ -68,9 +68,9 @@ public class CloseBeforeAckTest extends QpidBrokerTestCase } } - TestThread1 testThread1 = new TestThread1(); + private TestThread1 testThread1 = new TestThread1(); - TestRunnable testThread2 = + private TestRunnable testThread2 = new TestRunnable() { public void runWithExceptions() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/MessageRequeueTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/MessageRequeueTest.java index 90c96d84e2..a4e9a992b4 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/MessageRequeueTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/MessageRequeueTest.java @@ -54,7 +54,7 @@ public class MessageRequeueTest extends QpidBrokerTestCase private long[] receieved = new long[numTestMessages + 1]; private boolean passed = false; - QpidClientConnection conn; + private QpidClientConnection conn; protected void setUp() throws Exception diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/ConversationFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/ConversationFactory.java index 08b45bbe1a..3a9354d822 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/ConversationFactory.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/ConversationFactory.java @@ -121,19 +121,19 @@ public class ConversationFactory private Session session; /** The message consumer for incoming messages. */ - MessageConsumer consumer; + private MessageConsumer consumer; /** The message producer for outgoing messages. */ - MessageProducer producer; + private MessageProducer producer; /** The well-known or temporary destination to receive replies on. */ - Destination receiveDestination; + private Destination receiveDestination; /** Holds the queue implementation class for the reply queue. */ - Class<? extends BlockingQueue> queueClass; + private Class<? extends BlockingQueue> queueClass; /** Used to hold any replies that are received outside of the context of a conversation. */ - BlockingQueue<Message> deadLetterBox = new LinkedBlockingQueue<Message>(); + private BlockingQueue<Message> deadLetterBox = new LinkedBlockingQueue<Message>(); /* Used to hold conversation state on a per thread basis. */ /* @@ -151,7 +151,7 @@ public class ConversationFactory */ /** Generates new coversation id's as needed. */ - AtomicLong conversationIdGenerator = new AtomicLong(); + private AtomicLong conversationIdGenerator = new AtomicLong(); /** * Creates a conversation helper on the specified connection with the default sending destination, and listening @@ -246,13 +246,13 @@ public class ConversationFactory public class Conversation { /** Holds the correlation id for the context. */ - long conversationId; + private long conversationId; /** * Holds the send destination for the context. This will automatically be updated to the most recently received * reply-to destination. */ - Destination sendDestination; + private Destination sendDestination; /** * Sends a message to the default sending location. The correlation id of the message will be assigned by this diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java index 71f9c9de1b..6311322522 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java @@ -331,7 +331,7 @@ public class QpidBrokerTestCase extends QpidTestCase this.stopped = stopped; this.seenReady = false; - if (this.ready != null && !this.ready.equals("")) + if (this.getReady() != null && !this.getReady().equals("")) { this.latch = new CountDownLatch(1); } @@ -372,7 +372,7 @@ public class QpidBrokerTestCase extends QpidTestCase } out.println(line); - if (latch != null && line.contains(ready)) + if (latch != null && line.contains(getReady())) { seenReady = true; latch.countDown(); @@ -402,6 +402,11 @@ public class QpidBrokerTestCase extends QpidTestCase { return stopLine; } + + public String getReady() + { + return ready; + } } /** @@ -574,7 +579,7 @@ public class QpidBrokerTestCase extends QpidTestCase if (!p.await(30, TimeUnit.SECONDS)) { - _logger.info("broker failed to become ready (" + p.ready + "):" + p.getStopLine()); + _logger.info("broker failed to become ready (" + p.getReady() + "):" + p.getStopLine()); //Ensure broker has stopped process.destroy(); cleanBrokerWork(qpidWork); diff --git a/qpid/java/tools/src/main/java/org/apache/qpid/testkit/Receiver.java b/qpid/java/tools/src/main/java/org/apache/qpid/testkit/Receiver.java index b4294ee4cc..8dcf59e9c1 100644 --- a/qpid/java/tools/src/main/java/org/apache/qpid/testkit/Receiver.java +++ b/qpid/java/tools/src/main/java/org/apache/qpid/testkit/Receiver.java @@ -70,13 +70,13 @@ import org.apache.qpid.client.AMQConnection; */ public class Receiver extends Client implements MessageListener { - long msg_count = 0; - int sequence = 0; - boolean syncRcv = Boolean.getBoolean("sync_rcv"); - boolean jmsDurableSub = Boolean.getBoolean("jms_durable_sub"); - boolean checkForDups = Boolean.getBoolean("check_for_dups"); - MessageConsumer consumer; - List<Integer> duplicateMessages = new ArrayList<Integer>(); + private long msg_count = 0; + private int sequence = 0; + private boolean syncRcv = Boolean.getBoolean("sync_rcv"); + private boolean jmsDurableSub = Boolean.getBoolean("jms_durable_sub"); + private boolean checkForDups = Boolean.getBoolean("check_for_dups"); + private MessageConsumer consumer; + private List<Integer> duplicateMessages = new ArrayList<Integer>(); public Receiver(Connection con,String addr) throws Exception { diff --git a/qpid/java/tools/src/main/java/org/apache/qpid/tools/JNDICheck.java b/qpid/java/tools/src/main/java/org/apache/qpid/tools/JNDICheck.java index 2390516ef0..c604b24408 100644 --- a/qpid/java/tools/src/main/java/org/apache/qpid/tools/JNDICheck.java +++ b/qpid/java/tools/src/main/java/org/apache/qpid/tools/JNDICheck.java @@ -70,8 +70,8 @@ public class JNDICheck private static String JAVA_NAMING = "java.naming.factory.initial"; - Context _context = null; - Hashtable _environment = null; + private Context _context = null; + private Hashtable _environment = null; public JNDICheck(String propertyFile) { diff --git a/qpid/java/tools/src/main/java/org/apache/qpid/tools/LatencyTest.java b/qpid/java/tools/src/main/java/org/apache/qpid/tools/LatencyTest.java index 90ee7e28ae..16149d17c9 100644 --- a/qpid/java/tools/src/main/java/org/apache/qpid/tools/LatencyTest.java +++ b/qpid/java/tools/src/main/java/org/apache/qpid/tools/LatencyTest.java @@ -56,24 +56,24 @@ import org.apache.qpid.thread.Threading; public class LatencyTest extends PerfBase implements MessageListener { - MessageProducer producer; - MessageConsumer consumer; - Message msg; - byte[] payload; - long maxLatency = 0; - long minLatency = Long.MAX_VALUE; - long totalLatency = 0; // to calculate avg latency. - int rcvdMsgCount = 0; - double stdDev = 0; - double avgLatency = 0; - boolean warmup_mode = true; - boolean transacted = false; - int transSize = 0; - - final List<Long> latencies; - final Lock lock = new ReentrantLock(); - final Condition warmedUp; - final Condition testCompleted; + private MessageProducer producer; + private MessageConsumer consumer; + private Message msg; + private byte[] payload; + private long maxLatency = 0; + private long minLatency = Long.MAX_VALUE; + private long totalLatency = 0; // to calculate avg latency. + private int rcvdMsgCount = 0; + private double stdDev = 0; + private double avgLatency = 0; + private boolean warmup_mode = true; + private boolean transacted = false; + private int transSize = 0; + + private final List<Long> latencies; + private final Lock lock = new ReentrantLock(); + private final Condition warmedUp; + private final Condition testCompleted; public LatencyTest() { |
