[jboss-cvs] JBoss Messaging SVN: r3171 - in trunk: src/main/org/jboss/jms/server/endpoint and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 4 13:56:25 EDT 2007
Author: timfox
Date: 2007-10-04 13:56:25 -0400 (Thu, 04 Oct 2007)
New Revision: 3171
Modified:
trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
trunk/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java
trunk/src/main/org/jboss/jms/wireformat/SessionSendRequest.java
trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
Log:
Hack to allow np messages to be send one way
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-10-03 15:37:08 UTC (rev 3170)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-10-04 17:56:25 UTC (rev 3171)
@@ -439,12 +439,23 @@
{
throw new IllegalStateException("This invocation should not be handled here!");
}
+
+ private long sequence;
public void send(JBossMessage m, boolean checkForDuplicates) throws JMSException
- {
- RequestSupport req = new SessionSendRequest(id, version, m, checkForDuplicates);
+ {
+ long seq = m.isReliable() ? -1 : sequence++;
+
+ RequestSupport req = new SessionSendRequest(id, version, m, checkForDuplicates, seq);
- doInvoke(client, req);
+ if (seq != -1)
+ {
+ doInvoke(client, req);
+ }
+ else
+ {
+ doInvokeOneway(client, req);
+ }
}
public void cancelDeliveries(List cancels) throws JMSException
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-10-03 15:37:08 UTC (rev 3170)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-10-04 17:56:25 UTC (rev 3171)
@@ -336,11 +336,51 @@
return -1;
}
+ private long expectedSequence = 0;
+
+ private Map<Long, JBossMessage> heldBack = new HashMap<Long, JBossMessage>();
+
public void send(JBossMessage message, boolean checkForDuplicates) throws JMSException
{
+ throw new IllegalStateException("Should not be handled on the server");
+ }
+
+ public synchronized void send(JBossMessage message, boolean checkForDuplicates, long thisSequence) throws JMSException
+ {
try
{
- connectionEndpoint.sendMessage(message, null, checkForDuplicates);
+ if (!message.isReliable())
+ {
+ //Need to make sure it is in correct order since np messages are sent
+ //one way so they can arrive out of sequence
+
+ //This is a workaround to allow us to use one way messages for np messages for performance
+ //reasons
+
+ if (thisSequence == expectedSequence)
+ {
+ do
+ {
+ connectionEndpoint.sendMessage(message, null, false);
+
+ expectedSequence++;
+
+ message = (JBossMessage)heldBack.remove(expectedSequence);
+
+ } while (message != null);
+
+ }
+ else
+ {
+ //Not the expected one - add it to the map
+
+ heldBack.put(thisSequence, message);
+ }
+ }
+ else
+ {
+ connectionEndpoint.sendMessage(message, null, checkForDuplicates);
+ }
}
catch (Throwable t)
{
Modified: trunk/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java 2007-10-03 15:37:08 UTC (rev 3170)
+++ trunk/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java 2007-10-04 17:56:25 UTC (rev 3171)
@@ -308,7 +308,7 @@
// Sanity check
if (DEFAULT_SUCKER_USER_PASSWORD.equals(password))
{
- log.warn("*** THE DEFAULT SUCKER USER PASSWORD HAS NOT BE CHANGED FROM THE INSTALLATION DEFAULT - THIS IS A SECURITY RISK - PLEASE CHANGE THIS!! **");
+ log.warn("*** THE DEFAULT SUCKER USER PASSWORD HAS NOT BEEN CHANGED FROM THE INSTALLATION DEFAULT - THIS IS A SECURITY RISK - PLEASE CHANGE THIS!! **");
}
}
Modified: trunk/src/main/org/jboss/jms/wireformat/SessionSendRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/SessionSendRequest.java 2007-10-03 15:37:08 UTC (rev 3170)
+++ trunk/src/main/org/jboss/jms/wireformat/SessionSendRequest.java 2007-10-04 17:56:25 UTC (rev 3171)
@@ -27,6 +27,7 @@
import org.jboss.jms.delegate.SessionEndpoint;
import org.jboss.jms.message.JBossMessage;
+import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
import org.jboss.messaging.core.impl.message.MessageFactory;
/**
@@ -44,6 +45,7 @@
private JBossMessage msg;
private boolean checkForDuplicates;
+ private long sequence;
public SessionSendRequest()
{
@@ -52,11 +54,13 @@
public SessionSendRequest(String objectId,
byte version,
JBossMessage msg,
- boolean checkForDuplicates)
+ boolean checkForDuplicates,
+ long sequence)
{
super(objectId, PacketSupport.REQ_SESSION_SEND, version);
this.msg = msg;
this.checkForDuplicates = checkForDuplicates;
+ this.sequence = sequence;
}
public void read(DataInputStream is) throws Exception
@@ -70,6 +74,8 @@
msg.read(is);
checkForDuplicates = is.readBoolean();
+
+ sequence = is.readLong();
}
public ResponseSupport serverInvoke() throws Exception
@@ -82,7 +88,7 @@
throw new IllegalStateException("Cannot find object in dispatcher with id " + objectId);
}
- endpoint.send(msg, checkForDuplicates);
+ ((ServerSessionEndpoint)endpoint).send(msg, checkForDuplicates, sequence);
return null;
}
@@ -97,6 +103,8 @@
os.writeBoolean(checkForDuplicates);
+ os.writeLong(sequence);
+
os.flush();
}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-10-03 15:37:08 UTC (rev 3170)
+++ trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-10-04 17:56:25 UTC (rev 3171)
@@ -667,7 +667,7 @@
JBossMessage msg = new JBossMessage(123);
RequestSupport req =
- new SessionSendRequest("23", (byte)77, msg, false);
+ new SessionSendRequest("23", (byte)77, msg, false, 123);
testPacket(req, PacketSupport.REQ_SESSION_SEND);
}
More information about the jboss-cvs-commits
mailing list