This closes #562
This commit is contained in:
commit
25316e4232
|
@ -79,10 +79,6 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana
|
||||||
// while this is still sending requests causing a dead lock
|
// while this is still sending requests causing a dead lock
|
||||||
if (needInit) {
|
if (needInit) {
|
||||||
credits.init(context);
|
credits.init(context);
|
||||||
|
|
||||||
// Setting default address on the session
|
|
||||||
session.setAddress(null, address);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return credits;
|
return credits;
|
||||||
|
|
|
@ -210,10 +210,13 @@ public class ClientProducerImpl implements ClientProducerInternal {
|
||||||
closed = true;
|
closed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSend(final SimpleString address1,
|
private void doSend(SimpleString sendingAddress,
|
||||||
final Message msg,
|
final Message msg,
|
||||||
final SendAcknowledgementHandler handler,
|
final SendAcknowledgementHandler handler,
|
||||||
final boolean forceAsync) throws ActiveMQException {
|
final boolean forceAsync) throws ActiveMQException {
|
||||||
|
if (sendingAddress == null) {
|
||||||
|
sendingAddress = this.address;
|
||||||
|
}
|
||||||
session.startCall();
|
session.startCall();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -233,28 +236,16 @@ public class ClientProducerImpl implements ClientProducerInternal {
|
||||||
isLarge = false;
|
isLarge = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (address1 != null) {
|
if (!isLarge) {
|
||||||
if (!isLarge) {
|
session.setAddress(msg, sendingAddress);
|
||||||
session.setAddress(msg, address1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
msg.setAddress(address1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Anonymous
|
|
||||||
theCredits = session.getCredits(address1, true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!isLarge) {
|
msg.setAddress(sendingAddress);
|
||||||
session.setAddress(msg, this.address);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
msg.setAddress(this.address);
|
|
||||||
}
|
|
||||||
|
|
||||||
theCredits = producerCredits;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Anonymous
|
||||||
|
theCredits = session.getCredits(sendingAddress, true);
|
||||||
|
|
||||||
if (rateLimiter != null) {
|
if (rateLimiter != null) {
|
||||||
// Rate flow control
|
// Rate flow control
|
||||||
|
|
||||||
|
@ -276,6 +267,7 @@ public class ClientProducerImpl implements ClientProducerInternal {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sendRegularMessage(msgI, sendBlocking, theCredits, handler);
|
sendRegularMessage(msgI, sendBlocking, theCredits, handler);
|
||||||
|
session.checkDefaultAddress(sendingAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
|
@ -1053,22 +1053,30 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
||||||
public void setAddress(final Message message, final SimpleString address) {
|
public void setAddress(final Message message, final SimpleString address) {
|
||||||
if (defaultAddress == null) {
|
if (defaultAddress == null) {
|
||||||
logger.tracef("setAddress() Setting default address as %s", address);
|
logger.tracef("setAddress() Setting default address as %s", address);
|
||||||
defaultAddress = address;
|
|
||||||
|
|
||||||
if (message != null) {
|
message.setAddress(address);
|
||||||
message.setAddress(address);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (message != null) {
|
else {
|
||||||
if (!address.equals(defaultAddress)) {
|
if (!address.equals(defaultAddress)) {
|
||||||
|
logger.tracef("setAddress() setting non default address %s on message", address);
|
||||||
message.setAddress(address);
|
message.setAddress(address);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
logger.trace("setAddress() being set as null");
|
||||||
message.setAddress(null);
|
message.setAddress(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkDefaultAddress(SimpleString address) {
|
||||||
|
if (defaultAddress == null) {
|
||||||
|
logger.tracef("checkDefaultAddress(%s)", address);
|
||||||
|
defaultAddress = address;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPacketSize(final int packetSize) {
|
public void setPacketSize(final int packetSize) {
|
||||||
if (packetSize > this.initialMessagePacketSize) {
|
if (packetSize > this.initialMessagePacketSize) {
|
||||||
|
|
|
@ -87,8 +87,11 @@ public interface ClientSessionInternal extends ClientSession {
|
||||||
|
|
||||||
ClientProducerCreditManager getProducerCreditManager();
|
ClientProducerCreditManager getProducerCreditManager();
|
||||||
|
|
||||||
|
/** This will set the address at the message */
|
||||||
void setAddress(Message message, SimpleString address);
|
void setAddress(Message message, SimpleString address);
|
||||||
|
|
||||||
|
void checkDefaultAddress(SimpleString address);
|
||||||
|
|
||||||
void setPacketSize(int packetSize);
|
void setPacketSize(int packetSize);
|
||||||
|
|
||||||
void resetIfNeeded() throws ActiveMQException;
|
void resetIfNeeded() throws ActiveMQException;
|
||||||
|
|
|
@ -1233,7 +1233,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
||||||
|
|
||||||
SimpleString address = message.getAddress();
|
SimpleString address = message.getAddress();
|
||||||
|
|
||||||
checkDefaultAddress(address);
|
if (defaultAddress == null && address != null) {
|
||||||
|
defaultAddress = address;
|
||||||
|
}
|
||||||
|
|
||||||
if (address == null) {
|
if (address == null) {
|
||||||
if (message.isDurable()) {
|
if (message.isDurable()) {
|
||||||
|
@ -1267,14 +1269,6 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkDefaultAddress(SimpleString address) {
|
|
||||||
logger.tracef("checkDefaultAddress %s, defaultAddress=%s", address, defaultAddress);
|
|
||||||
if (defaultAddress == null && address != null) {
|
|
||||||
logger.tracef("checkDefaultAddress setting as %s", address);
|
|
||||||
defaultAddress = address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendContinuations(final int packetSize,
|
public void sendContinuations(final int packetSize,
|
||||||
final long messageBodySize,
|
final long messageBodySize,
|
||||||
|
@ -1304,10 +1298,6 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void requestProducerCredits(final SimpleString address, final int credits) throws Exception {
|
public void requestProducerCredits(final SimpleString address, final int credits) throws Exception {
|
||||||
// When the client gets the producer credits it already has the intention of sending messages
|
|
||||||
// and it will already register the default address on the core protocol
|
|
||||||
// hence we need to set it here when we request credits as well
|
|
||||||
checkDefaultAddress(address);
|
|
||||||
PagingStore store = server.getPagingManager().getPageStore(address);
|
PagingStore store = server.getPagingManager().getPageStore(address);
|
||||||
|
|
||||||
if (!store.checkMemory(new Runnable() {
|
if (!store.checkMemory(new Runnable() {
|
||||||
|
|
|
@ -96,6 +96,7 @@ public class MultipleProducersTest extends JMSTestBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
|
// t.printStackTrace();
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue