summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2012-06-28 12:38:36 +0000
committerRobert Gemmell <robbie@apache.org>2012-06-28 12:38:36 +0000
commit384e192d7a5029b062f0016ed1739609bcc43498 (patch)
tree131451fc92f9c87e775847b448bad74ac0081d5d /qpid/java
parentb2c74d9af14e9383c06cfee390fe21b1161ea8d9 (diff)
parentd5a5322d7c9644308a159d6f5d1f24c6e289bf1f (diff)
downloadqpid-python-384e192d7a5029b062f0016ed1739609bcc43498.tar.gz
merge changes from trunk up to r1354912
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/java-config-and-management@1354981 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java15
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java22
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxBranch.java4
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java7
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java31
5 files changed, 39 insertions, 40 deletions
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
index 88f79e8823..408643b98a 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
@@ -20,7 +20,6 @@
package org.apache.qpid.server.store.berkeleydb;
import java.io.File;
-import java.io.IOException;
import java.util.Set;
import javax.jms.Connection;
@@ -35,8 +34,6 @@ import org.apache.log4j.Logger;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.url.URLSyntaxException;
-import com.sleepycat.je.rep.ReplicationConfig;
-
/**
* The HA white box tests test the BDB cluster where the test retains the knowledge of the
* individual test nodes. It uses this knowledge to examine the nodes to ensure that they
@@ -103,7 +100,7 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
final Connection initialConnection = getConnectionToNodeInCluster();
assertNotNull(initialConnection);
- killConnectionBroker(initialConnection);
+ closeConnectionAndKillBroker(initialConnection);
final Connection subsequentConnection = getConnectionToNodeInCluster();
assertNotNull(subsequentConnection);
@@ -119,7 +116,7 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
final Connection initialConnection = getConnectionToNodeInCluster();
assertNotNull(initialConnection);
- killConnectionBroker(initialConnection);
+ closeConnectionAndKillBroker(initialConnection);
final Connection subsequentConnection = getConnectionToNodeInCluster();
assertNotNull(subsequentConnection);
@@ -139,6 +136,7 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
assertNotNull(connection);
final int brokerPortNumber = _clusterCreator.getBrokerPortNumberFromConnection(connection);
+ connection.close();
_clusterCreator.stopNode(brokerPortNumber);
_clusterCreator.startNode(brokerPortNumber);
@@ -157,7 +155,7 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
populateBrokerWithData(initialConnection, inbuiltExchangeQueueUrl, customExchangeQueueUrl);
- killConnectionBroker(initialConnection);
+ closeConnectionAndKillBroker(initialConnection);
final Connection subsequentConnection = getConnectionToNodeInCluster();
@@ -229,10 +227,11 @@ public class HAClusterWhiteboxTest extends QpidBrokerTestCase
return connection;
}
- private void killConnectionBroker(final Connection initialConnection) throws IOException,
- InterruptedException
+ private void closeConnectionAndKillBroker(final Connection initialConnection) throws Exception
{
final int initialPortNumber = _clusterCreator.getBrokerPortNumberFromConnection(initialConnection);
+ initialConnection.close();
+
killBroker(initialPortNumber); // kill awaits the death of the child
}
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java
index 417244d3f9..9914485638 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/transport/ServerSession.java
@@ -20,19 +20,11 @@
*/
package org.apache.qpid.server.transport;
-import java.util.Collections;
-import java.util.HashSet;
-import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.CHANNEL_FORMAT;
-import org.apache.qpid.server.message.InboundMessage;
-import org.apache.qpid.server.message.MessageMetaData_0_10;
-import org.apache.qpid.server.message.MessageTransferMessage;
-import org.apache.qpid.server.txn.RollbackOnlyDtxException;
-import org.apache.qpid.server.txn.TimeoutDtxException;
-import static org.apache.qpid.util.Serial.gt;
-
import java.security.Principal;
import java.text.MessageFormat;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -46,9 +38,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-
import javax.security.auth.Subject;
-
import org.apache.qpid.AMQException;
import org.apache.qpid.AMQStoreException;
import org.apache.qpid.protocol.AMQConstant;
@@ -64,7 +54,10 @@ import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.actors.GenericActor;
import org.apache.qpid.server.logging.messages.ChannelMessages;
import org.apache.qpid.server.logging.subjects.ChannelLogSubject;
+import org.apache.qpid.server.message.InboundMessage;
+import org.apache.qpid.server.message.MessageMetaData_0_10;
import org.apache.qpid.server.message.MessageReference;
+import org.apache.qpid.server.message.MessageTransferMessage;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.protocol.AMQConnectionModel;
import org.apache.qpid.server.protocol.AMQSessionModel;
@@ -83,14 +76,19 @@ import org.apache.qpid.server.txn.IncorrectDtxStateException;
import org.apache.qpid.server.txn.JoinAndResumeDtxException;
import org.apache.qpid.server.txn.LocalTransaction;
import org.apache.qpid.server.txn.NotAssociatedDtxException;
+import org.apache.qpid.server.txn.RollbackOnlyDtxException;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.txn.SuspendAndFailDtxException;
+import org.apache.qpid.server.txn.TimeoutDtxException;
import org.apache.qpid.server.txn.UnknownDtxBranchException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.CHANNEL_FORMAT;
+import static org.apache.qpid.util.Serial.gt;
+
public class ServerSession extends Session
implements AuthorizationHolder, SessionConfig,
AMQSessionModel, LogSubject, AsyncAutoCommitTransaction.FutureRecorder
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxBranch.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
index 3ac71fc6a6..900e2ef222 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
@@ -103,7 +103,7 @@ public class DtxBranch
_timeoutFuture.cancel(false);
}
_timeout = timeout;
- _expiration = timeout == 0 ? 0 : System.currentTimeMillis() + timeout;
+ _expiration = timeout == 0 ? 0 : System.currentTimeMillis() + (1000 * timeout);
if(_timeout == 0)
{
@@ -111,7 +111,7 @@ public class DtxBranch
}
else
{
- _timeoutFuture = _vhost.scheduleTask(_timeout, new Runnable()
+ _timeoutFuture = _vhost.scheduleTask(1000*_timeout, new Runnable()
{
public void run()
{
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java
index e3bc076d72..117beb82ef 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java
@@ -37,7 +37,7 @@ public class DtxRegistry
private static final class ComparableXid
{
private final Xid _xid;
-
+
private ComparableXid(Xid xid)
{
_xid = xid;
@@ -58,7 +58,7 @@ public class DtxRegistry
ComparableXid that = (ComparableXid) o;
return compareBytes(_xid.getBranchId(), that._xid.getBranchId())
- && compareBytes(_xid.getGlobalId(), that._xid.getGlobalId());
+ && compareBytes(_xid.getGlobalId(), that._xid.getGlobalId());
}
private static boolean compareBytes(byte[] a, byte[] b)
@@ -94,7 +94,7 @@ public class DtxRegistry
return result;
}
}
-
+
public synchronized DtxBranch getBranch(Xid xid)
{
return _branches.get(new ComparableXid(xid));
@@ -318,6 +318,7 @@ public class DtxRegistry
branch.disassociateSession(session);
}
}
+
}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java
index e940a73bbb..2ba509e96a 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java
@@ -1,6 +1,6 @@
package org.apache.qpid.test.unit.xa;
/*
- *
+ *
* 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
@@ -8,16 +8,16 @@ package org.apache.qpid.test.unit.xa;
* 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.
- *
+ *
*/
@@ -344,7 +344,7 @@ public class FaultTest extends AbstractXATestCase
{
assertEquals("Wrong error code: ", XAException.XAER_PROTO, e.errorCode);
}
- }
+ }
/**
* Strategy:
@@ -366,27 +366,28 @@ public class FaultTest extends AbstractXATestCase
/**
* Strategy:
* Check that a transaction timeout as expected
- * - set timeout to 10ms
- * - sleep 1000ms
+ * - set timeout to 1s
+ * - sleep 1500ms
* - call end and check that the expected exception is thrown
*/
public void testTransactionTimeout() throws Exception
{
+ _xaResource.setTransactionTimeout(1);
+
Xid xid = getNewXid();
try
{
_xaResource.start(xid, XAResource.TMNOFLAGS);
- assertEquals("Wrong timeout", _xaResource.getTransactionTimeout(), 0);
- _xaResource.setTransactionTimeout(10);
- Thread.sleep(1000);
+ Thread.sleep(1500);
_xaResource.end(xid, XAResource.TMSUCCESS);
+ fail("Timeout expected ");
}
catch (XAException e)
{
assertEquals("Wrong error code: ", XAException.XA_RBTIMEOUT, e.errorCode);
}
}
-
+
/**
* Strategy:
* Set the transaction timeout to 1000
@@ -394,18 +395,18 @@ public class FaultTest extends AbstractXATestCase
public void testTransactionTimeoutAfterCommit() throws Exception
{
Xid xid = getNewXid();
-
+
_xaResource.start(xid, XAResource.TMNOFLAGS);
_xaResource.setTransactionTimeout(1000);
assertEquals("Wrong timeout", 1000,_xaResource.getTransactionTimeout());
-
+
//_xaResource.prepare(xid);
_xaResource.end(xid, XAResource.TMSUCCESS);
_xaResource.commit(xid, true);
-
+
_xaResource.setTransactionTimeout(2000);
assertEquals("Wrong timeout", 2000,_xaResource.getTransactionTimeout());
-
+
xid = getNewXid();
_xaResource.start(xid, XAResource.TMNOFLAGS);
assertEquals("Wrong timeout", 2000, _xaResource.getTransactionTimeout());