At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge
------------------------------------------------------------
revno: 226
revision-id: mtaylor@stripped
parent: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Tue 2007-10-30 19:19:45 +0000
message:
Merging changes.
added:
java/testsuite/ndbj/ImmediatePollTimeoutTest.java
immediatepolltimeout-20071030180642-3bfrv97t3q8mc2m6-1
------------------------------------------------------------
revno: 217.1.7
revision-id: mtaylor@stripped
parent: mtaylor@stripped
parent: root@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Tue 2007-10-30 19:17:06 +0000
message:
Merged in new test from David Shepherd for testing ImmediatePollTimeout
added:
java/testsuite/ndbj/ImmediatePollTimeoutTest.java
immediatepolltimeout-20071030180642-3bfrv97t3q8mc2m6-1
------------------------------------------------------------
revno: 217.1.5.1.1
revision-id: root@stripped
parent: mtaylor@stripped
committer: root <root@stripped>
branch nick: work
timestamp: Tue 2007-10-30 18:06:46 +0000
message:
h
added:
java/testsuite/ndbj/ImmediatePollTimeoutTest.java
immediatepolltimeout-20071030180642-3bfrv97t3q8mc2m6-1
------------------------------------------------------------
revno: 217.1.6
revision-id: mtaylor@stripped
parent: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Tue 2007-10-30 18:16:00 +0000
message:
Merged in changes for async timing.
modified:
configure.in configure.in-20070228020914-u2pk759xg7thauwf-13
java/com/mysql/cluster/ndbj/examples/TestEvent.java
testevent.java-20071026232217-5tigfbdmcudrnbbx-1
java/ndbj.i ndbj.i-20070913223244-5938mztpztyn9sry-1
swig/NdbTransaction.i ndbtransaction.i-20070227184716-ecjyhh3jgvmye4de-7
swig/ndbglobals.i globals.i-20070228021421-qkr4cbpxymyqdrf3-7
------------------------------------------------------------
revno: 217.1.5
revision-id: mtaylor@stripped
parent: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Tue 2007-10-30 12:02:51 +0000
message:
Merged in changes.
modified:
acinclude.m4 acinclude.m4-20070228020914-u2pk759xg7thauwf-8
java/com/mysql/cluster/ndbj/examples/TestAsync.java
testasync.java-20070703002120-jsnz1ul38pp1h3w3-1
swig/ndbglobals.i globals.i-20070228021421-qkr4cbpxymyqdrf3-7
------------------------------------------------------------
revno: 217.1.4
revision-id: mtaylor@stripped
parent: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Mon 2007-10-29 18:15:09 +0000
message:
Merged changes.
------------------------------------------------------------
revno: 217.1.3
revision-id: mtaylor@stripped
parent: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Mon 2007-10-29 17:56:16 +0000
message:
Merged ndbjmerge changes.
modified:
java/com/mysql/cluster/ndbj/Ndb.java ndb.java-20070517181935-98huwjarzuh25b30-2
swig/Ndb.i ndb.i-20070228021421-qkr4cbpxymyqdrf3-1
=== added file 'java/testsuite/ndbj/ImmediatePollTimeoutTest.java'
--- a/java/testsuite/ndbj/ImmediatePollTimeoutTest.java 1970-01-01 00:00:00 +0000
+++ b/java/testsuite/ndbj/ImmediatePollTimeoutTest.java 2007-10-30 18:06:46 +0000
@@ -0,0 +1,180 @@
+package testsuite.ndbj;
+
+import java.util.*;
+
+import testsuite.BaseNdbjTestCase;
+import com.mysql.cluster.ndbj.*;
+
+public class ImmediatePollTimeoutTest extends BaseNdbjTestCase {
+
+ static boolean alreadySetUp = false;
+ static long ourTotalTransactionCount = 0;
+ static long ourOutstandingTransactionCount = 0;
+ static long ourCallbackCount = 0;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // GENERAL STUFF
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ static int MAXIMUM_OPERATION_VOLUME = 300; // TO DO: Calculate this
+
+ static int NUMBER_OF_ELEMENT_INSERTIONS = 50;
+
+ static int NUM_REQUEST_TRANSACTIONS = 2;
+ static int REQUEST_TRANSACTIONS_TIMEOUT = 0;
+
+ static int FORCE_SEND = 1;
+
+ static boolean USE_SYNCHRONOUS = false;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // TABLE METADATA
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ static String tablename = "t_immediatepolltimeouttest";
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // INITIALISATION CODE
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+ public ImmediatePollTimeoutTest(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ if (!alreadySetUp) {
+ // Create required tables
+
+ System.out.print("Creating tables...");
+
+ this.createTable(tablename,
+ " (ATTR1 INT UNSIGNED auto_increment not null," +
+ " ATTR2 INT UNSIGNED NOT NULL," +
+ " PRIMARY KEY (ATTR1) )" +
+ " ENGINE=NDBCLUSTER");
+
+ System.out.println("done.");
+
+ System.out.print("Storing column indices...");
+ System.out.println("done.");
+
+ alreadySetUp = true;
+ }
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // TEST CODE
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public void testOperation() {
+
+ HashMap<Integer,BaseCallback> hash=new HashMap<Integer,BaseCallback>();
+
+ try {
+ for (int loop = 0;
+ loop < 100;
+ loop++) {
+ // Process request transaction
+
+ NdbOperation orderOp;
+ BaseCallback callback;
+
+ for (int elementCount = 0;
+ elementCount < NUMBER_OF_ELEMENT_INSERTIONS;
+ elementCount++) {
+ int id = (NUMBER_OF_ELEMENT_INSERTIONS * loop) + elementCount;
+
+ trans = ndb.startTransaction();
+ orderOp = trans.getNdbOperation(tablename);
+ orderOp.insertTuple();
+ orderOp.equalInt("ATTR1", id);
+ orderOp.setInt("ATTR2", id);
+
+ callback = new MyCallback(hash, id, ndb, orderOp.resultData());
+ hash.put(callback.hashCode(), callback);
+
+ trans.executeAsynchPrepare(ExecType.Commit,
+ callback,
+ AbortOption.AbortOnError);
+
+ ourOutstandingTransactionCount++;
+ }
+
+ ourCallbackCount = 0;
+
+ ndb.sendPreparedTransactions(FORCE_SEND);
+
+ long then = System.nanoTime();
+ ndb.pollNdb(REQUEST_TRANSACTIONS_TIMEOUT);
+ long now = System.nanoTime();
+
+ ourOutstandingTransactionCount = ourOutstandingTransactionCount - ourCallbackCount;
+ System.out.println("Poll took " + (now - then) + " nanos (" + ourCallbackCount +
+ " txs received) [" + ourOutstandingTransactionCount + " outstanding]");
+ }
+
+ System.out.println("Performing cooldown");
+
+ ourCallbackCount = 0;
+
+ long then = System.nanoTime();
+ ndb.pollNdb(100000,100000);
+ long now = System.nanoTime();
+
+ ourOutstandingTransactionCount = ourOutstandingTransactionCount - ourCallbackCount;
+ System.out.println("Closedown poll took " + (now - then) + " nanos (" +
ourCallbackCount +
+ " txs received) [" + ourOutstandingTransactionCount + " outstanding]");
+ }
+ catch (NdbApiException e) {
+ System.out.println("Caught NdbApiException in Insert:\t" + e.getMessage());
+ e.printStackTrace();
+ assertFalse(true);
+ }
+ finally {
+ // Do something ;o)
+ }
+ }
+
+ class HashCallback extends BaseCallback {
+
+
+ int myCallbackNum;
+ Ndb myNdb;
+ NdbResultSet myResults;
+ HashMap<Integer, BaseCallback> myMap;
+
+ public HashCallback(HashMap<Integer, BaseCallback> theMap, int theCallbackNum,
Ndb theNdb, NdbResultSet theResults) {
+ myMap = theMap;
+ myCallbackNum = theCallbackNum;
+ myNdb = theNdb;
+ myResults = theResults;
+ }
+
+ public void callback(int res, NdbTransactionImpl trans) {
+
+ if (res!=0)
System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHASSSSSSSSSSSSSSSSSSSSHHH");
+
+ trans.close();
+ myMap.remove(this.hashCode());
+
+ ourCallbackCount++;
+ }
+
+ }
+
+ class MyCallback extends HashCallback {
+
+ public MyCallback(HashMap<Integer, BaseCallback> theMap,int theCallbackNum,
Ndb theNdb, NdbResultSet theResults) {
+ super(theMap, theCallbackNum, theNdb, theResults);
+ }
+
+ }
+
+}
| Thread |
|---|
| • Rev 226: Merging changes. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge | Monty Taylor | 30 Oct |