You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2007/08/12 07:27:34 UTC
svn commit: r565003 [17/17] - in /activemq/trunk:
activemq-fileserver/src/main/java/org/apache/activemq/util/
activemq-fileserver/src/test/java/org/apache/activemq/util/
activemq-jaas/src/main/java/org/apache/activemq/jaas/
activemq-jaas/src/test/java/...
Modified: activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/Consumer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/Consumer.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/Consumer.java (original)
+++ activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/Consumer.java Sat Aug 11 22:27:21 2007
@@ -31,6 +31,9 @@
*/
public class Consumer extends BenchmarkSupport implements MessageListener {
+ public Consumer() {
+ }
+
public static void main(String[] args) {
Consumer tool = new Consumer();
if (args.length > 0) {
@@ -51,16 +54,12 @@
try {
tool.run();
- }
- catch (Exception e) {
+ } catch (Exception e) {
System.out.println("Caught: " + e);
e.printStackTrace();
}
}
- public Consumer() {
- }
-
public void run() throws JMSException {
start();
subscribe();
@@ -81,9 +80,8 @@
MessageConsumer consumer = null;
if (isDurable() && isTopic()) {
- consumer = session.createDurableSubscriber((Topic) destination, getClass().getName());
- }
- else {
+ consumer = session.createDurableSubscriber((Topic)destination, getClass().getName());
+ } else {
consumer = session.createConsumer(destination);
}
consumer.setMessageListener(this);
@@ -92,17 +90,16 @@
public void onMessage(Message message) {
try {
- TextMessage textMessage = (TextMessage) message;
+ TextMessage textMessage = (TextMessage)message;
// lets force the content to be deserialized
- String text = textMessage.getText();
+ textMessage.getText();
count(1);
-
+
// lets count the messages
- //message.acknowledge();
- }
- catch (JMSException e) {
+ // message.acknowledge();
+ } catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Modified: activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/Producer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/Producer.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/Producer.java (original)
+++ activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/Producer.java Sat Aug 11 22:27:21 2007
@@ -16,16 +16,17 @@
*/
package org.apache.activemq.benchmark;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
/**
* @author James Strachan
@@ -37,6 +38,9 @@
int loopSize = 1000;
private int messageSize = 1000;
+ public Producer() {
+ }
+
public static void main(String[] args) {
Producer tool = new Producer();
if (args.length > 0) {
@@ -59,23 +63,19 @@
}
try {
tool.run();
- }
- catch (Exception e) {
+ } catch (Exception e) {
System.out.println("Caught: " + e);
e.printStackTrace();
}
}
- public Producer() {
- }
-
public void run() throws Exception {
start();
publish();
}
// Properties
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
public int getMessageSize() {
return messageSize;
}
@@ -93,7 +93,7 @@
}
// Implementation methods
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
protected void publish() throws Exception {
final String text = getMessage();
@@ -106,8 +106,7 @@
public void run() {
try {
publish(text, subject);
- }
- catch (JMSException e) {
+ } catch (JMSException e) {
System.out.println("Caught: " + e);
e.printStackTrace();
}
@@ -135,8 +134,7 @@
MessageProducer publisher = session.createProducer(destination);
if (isDurable()) {
publisher.setDeliveryMode(DeliveryMode.PERSISTENT);
- }
- else {
+ } else {
publisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
}
@@ -147,8 +145,7 @@
while (true) {
publishLoop(session, publisher, text);
}
- }
- else {
+ } else {
for (int i = 0; i < loops; i++) {
publishLoop(session, publisher, text);
}
Modified: activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/ProducerConsumer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/ProducerConsumer.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/ProducerConsumer.java (original)
+++ activemq/trunk/assembly/src/test/java/org/apache/activemq/benchmark/ProducerConsumer.java Sat Aug 11 22:27:21 2007
@@ -16,7 +16,6 @@
*/
package org.apache.activemq.benchmark;
-
/**
* @author James Strachan
* @version $Revision$
@@ -25,6 +24,9 @@
private Consumer consumer = new Consumer();
+ public ProducerConsumer() {
+ }
+
public static void main(String[] args) {
ProducerConsumer tool = new ProducerConsumer();
if (args.length > 0) {
@@ -44,14 +46,10 @@
}
try {
tool.run();
- }
- catch (Exception e) {
+ } catch (Exception e) {
System.out.println("Caught: " + e);
e.printStackTrace();
}
- }
-
- public ProducerConsumer() {
}
public void run() throws Exception {
Modified: activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java (original)
+++ activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java Sat Aug 11 22:27:21 2007
@@ -16,15 +16,14 @@
*/
package org.apache.activemq.config;
+import javax.jms.Connection;
+import javax.jms.JMSException;
+
import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import java.io.File;
-
/**
* @version $Revision: 1.2 $
*/
@@ -39,13 +38,11 @@
connection.start();
connection.close();
connection = null;
- }
- catch (Exception e) {
+ } catch (Exception e) {
if (connection != null) {
try {
connection.close();
- }
- catch (JMSException e1) {
+ } catch (JMSException e1) {
// ignore exception as we're throwing one anyway
}
}
@@ -55,7 +52,7 @@
protected void setUp() throws Exception {
System.setProperty("activemq.base", "target");
- //new File("target/data").mkdirs();
+ // new File("target/data").mkdirs();
broker = BrokerFactory.createBroker("xbean:src/release/conf/activemq.xml");
}