summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2007-04-09 09:37:54 +0000
committerRobert Greig <rgreig@apache.org>2007-04-09 09:37:54 +0000
commit362695aab16f1669ca5cc9b4b2094a2a47911675 (patch)
tree8b5909fcd20a747c46317774b8edf86b2c76a09e /java
parent8ef73fe7003c6a5a528277743d4ebfd9f6e31b89 (diff)
downloadqpid-python-362695aab16f1669ca5cc9b4b2094a2a47911675.tar.gz
Added shell script.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@526689 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/broker/bin/bdbbackup21
-rw-r--r--java/distribution/src/main/assembly/bin.xml6
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java41
3 files changed, 62 insertions, 6 deletions
diff --git a/java/broker/bin/bdbbackup b/java/broker/bin/bdbbackup
new file mode 100644
index 0000000000..34743cd873
--- /dev/null
+++ b/java/broker/bin/bdbbackup
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+. qpid-run org.apache.qpid.server.store.berkeleydb.BDBBackup "$@"
diff --git a/java/distribution/src/main/assembly/bin.xml b/java/distribution/src/main/assembly/bin.xml
index fc782b26bb..0d4146ed1d 100644
--- a/java/distribution/src/main/assembly/bin.xml
+++ b/java/distribution/src/main/assembly/bin.xml
@@ -148,6 +148,12 @@
<destName>runAll</destName>
<fileMode>493</fileMode>
</file>
+ <file>
+ <source>../broker/bin/bdbbackup</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>bdbbackup</destName>
+ <fileMode>493</fileMode>
+ </file>
</files>
<dependencySets>
<dependencySet>
diff --git a/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java b/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java
index 9439604acd..82e43e542f 100644
--- a/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java
+++ b/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java
@@ -58,10 +58,11 @@ import uk.co.thebadgerset.junit.extensions.util.ParsedProperties;
* additionally accepts the following parameters:
*
* <p/><table><caption>Parameters</caption>
- * <tr><th> Parameter <th> Default <th> Comments
- * <tr><td> numMessages <th> 100 <th> The total number of messages to send.
- * <tr><td> duration <th> 30S <th> The length of time to ping for. (Format dDhHmMsS, for d days, h hours,
- * m minutes and s seconds).
+ * <tr><th> Parameter <th> Default <th> Comments
+ * <tr><td> numMessages <td> 100 <td> The total number of messages to send.
+ * <tr><td> numMessagesToAction <td> -1 <td> The number of messages to send before taking a custom 'action'.
+ * <tr><td> duration <td> 30S <td> The length of time to ping for. (Format dDhHmMsS, for d days, h hours,
+ * m minutes and s seconds).
* </table>
*
* <p/>This ping client also overrides some of the defaults of its parent class, to provide a reasonable set up
@@ -81,12 +82,18 @@ import uk.co.thebadgerset.junit.extensions.util.ParsedProperties;
* is reached. Reaching the limit will be interpreted as the first signal to stop sending, and the ping client will
* wait for the second signal before receiving its pings.
*
+ * <p/>This class provides a mechanism for extensions to add arbitrary actions, after a particular number of messages
+ * have been sent. When the number of messages equal the value set in the 'numMessagesToAction' property is method,
+ * the {@link #takeAction} method is called. By default this does nothing, but extensions of this class can provide
+ * custom behaviour with alternative implementations of this method (for example taking a backup).
+ *
* <p><table id="crc"><caption>CRC Card</caption>
* <tr><th> Responsibilities <th> Collaborations
* <tr><td> Send and receive pings.
* <tr><td> Accept user input to signal stop sending.
* <tr><td> Accept user input to signal start receiving.
* <tr><td> Provide feedback on pings sent versus pings received.
+ * <tr><td> Provide extension point for arbitrary action on a particular message count.
* </table>
*/
public class PingDurableClient extends PingPongProducer implements ExceptionListener
@@ -97,6 +104,8 @@ public class PingDurableClient extends PingPongProducer implements ExceptionList
public static final String NUM_MESSAGES_DEFAULT = "100";
public static final String DURATION_PROPNAME = "duration";
public static final String DURATION_DEFAULT = "30S";
+ public static final String NUM_MESSAGES_TO_ACTION_PROPNAME = "numMessagesToAction";
+ public static final String NUM_MESSAGES_TO_ACTION_DEFAULT = "-1";
/** The maximum length of time to wait whilst receiving pings before assuming that no more are coming. */
private static final long TIME_OUT = 3000;
@@ -111,11 +120,15 @@ public class PingDurableClient extends PingPongProducer implements ExceptionList
defaults.setProperty(TX_BATCH_SIZE_PROPNAME, "10");
defaults.setProperty(RATE_PROPNAME, "20");
defaults.setProperty(DURABLE_DESTS_PROPNAME, "true");
+ defaults.setProperty(NUM_MESSAGES_TO_ACTION_PROPNAME, NUM_MESSAGES_TO_ACTION_DEFAULT);
}
/** Specifies the number of pings to send, if larger than 0. 0 means send until told to stop. */
private int numMessages;
+ /** Holds the number of messages to send before taking triggering the action. */
+ private int numMessagesToAction;
+
/** Sepcifies how long to ping for, if larger than 0. 0 means send until told to stop. */
private long duration;
@@ -136,6 +149,7 @@ public class PingDurableClient extends PingPongProducer implements ExceptionList
numMessages = properties.getPropertyAsInteger(NUM_MESSAGES_PROPNAME);
String durationSpec = properties.getProperty(DURATION_PROPNAME);
+ numMessagesToAction = properties.getPropertyAsInteger(NUM_MESSAGES_TO_ACTION_PROPNAME);
if (durationSpec != null)
{
@@ -180,7 +194,7 @@ public class PingDurableClient extends PingPongProducer implements ExceptionList
/**
* Performs the main test procedure implemented by this ping client. See the class level comment for details.
*/
- public int send() throws Exception
+ protected int send() throws Exception
{
log.debug("public void sendWaitReceive(): called");
@@ -245,6 +259,14 @@ public class PingDurableClient extends PingPongProducer implements ExceptionList
_publish = false;
}
+ // Perform the arbitrary action if the number of messages sent has reached the right number.
+ if (messagesSent == numMessagesToAction)
+ {
+ System.out.println("At action point, Messages sent = " + messagesSent + ", Messages Committed = "
+ + messagesCommitted + ", Messages not Committed = " + messagesNotCommitted);
+ takeAction();
+ }
+
// Determine if the end condition has been met, based on the number of messages, time passed, errors on
// the connection or user input.
long now = System.nanoTime();
@@ -293,7 +315,7 @@ public class PingDurableClient extends PingPongProducer implements ExceptionList
return messagesSent;
}
- private void receive(int messagesSent) throws Exception
+ protected void receive(int messagesSent) throws Exception
{
// Re-establish the connection and the message consumer.
_queueJVMSequenceID = new AtomicInteger();
@@ -389,4 +411,11 @@ public class PingDurableClient extends PingPongProducer implements ExceptionList
}
});
}
+
+ /**
+ * Performs an aribtrary action once the 'numMesagesToAction' count is reached on sending messages. This default
+ * implementation does nothing.
+ */
+ public void takeAction()
+ { }
}