Skip to content
This repository was archived by the owner on May 11, 2018. It is now read-only.

Properly ignore duplicate bridge configuration across HA cluster during startup. #404

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
**/target/**
# Ignore examples .class
**/src/share/java/examples/**/*.class
**/*.iml
.idea
binary
dist
24 changes: 24 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
node('java') {

stage('Provision tools') {
tool 'Maven 3.5.x'
tool 'JDK 8'
tool 'Ant-1.8.2 autoinstall'
}

stage('Checkout') {
checkout scm
}

withAnt(installation: 'Ant-1.8.2 autoinstall', jdk: 'JDK 8') {
withMaven(jdk: 'JDK 8', maven: 'Maven 3.5.x', mavenSettingsConfig: 'd36053eb-3f69-482a-8dcd-d7ea248c53ba') {

stage('Build') {
sh "cd mq; mvn -V -U -e clean package"
archive 'mq/dist/bundles/mq5_1_1.zip'
archive 'mq/dist/bundles/mq5_1_1.tar'
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,14 @@ public synchronized void init(BridgeBaseContext ctx) throws Exception {
}
try {
store.addJMSBridge(name, true, null);
} catch (DupKeyException e) {
_bc.logInfo(_bmr.getKString(_bmr.I_JMSBRIDGE_NOT_OWNER, name), null);
itr.remove();
} catch (Exception e) {
// DupKeyException gets wrapped into a BrokerException
if (e instanceof DupKeyException || e.getCause() != null && e.getCause() instanceof DupKeyException) {
_bc.logInfo(_bmr.getKString(_bmr.I_JMSBRIDGE_NOT_OWNER, name), null);
itr.remove();
} else {
throw e;
}
}
}
jmsbridges = store.getJMSBridges(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

/*
* @(#)HelloHandler.java 1.71 06/28/07
*/
*/

package com.sun.messaging.jmq.jmsserver.common.handlers;

Expand Down Expand Up @@ -73,7 +73,7 @@
import com.sun.messaging.jmq.util.UID;
import com.sun.messaging.jmq.util.GoodbyeReason;


import static com.sun.messaging.jmq.jmsserver.comm.CommGlobals.IMQ;


/**
Expand All @@ -84,7 +84,7 @@
* (e.g. tcp does not need the HELLO message to set up a connection, since
* each socket corresponds to a new connection)
*/
public class HelloHandler extends PacketHandler
public class HelloHandler extends PacketHandler
{
private ConnectionManager connectionList;

Expand Down Expand Up @@ -118,7 +118,7 @@ public class HelloHandler extends PacketHandler
public static void DUMP(String title) {
Globals.getLogger().log(Logger.DEBUG,title);
Globals.getLogger().log(Logger.DEBUG,"------------------------");
Globals.getLogger().log(Logger.DEBUG,"Number of connections is " +
Globals.getLogger().log(Logger.DEBUG,"Number of connections is " +
Globals.getConnectionManager().getNumConnections(null));
List l = Globals.getConnectionManager().getConnectionList(null);
for (int i=0; i < l.size(); i ++ ) {
Expand All @@ -139,9 +139,9 @@ public HelloHandler(ConnectionManager list)
/**
* Method to handle HELLO messages
*/
public boolean handle(IMQConnection con, Packet msg)
throws BrokerException
{
public boolean handle(IMQConnection con, Packet msg)
throws BrokerException
{

if (DEBUG) {
logger.log(Logger.DEBUGHIGH, "HelloHandler: handle() [ Received Hello Message]");
Expand Down Expand Up @@ -407,8 +407,9 @@ public boolean handle(IMQConnection con, Packet msg)
}
}

HAMonitorService hamonitor = Globals.getHAMonitorService();
if (hamonitor != null && hamonitor.inTakeover()) {
HAMonitorService hamonitor = Globals.getHAMonitorService();
if (hamonitor != null && hamonitor.inTakeover()
|| !con.isAdminConnection() && Globals.getConfig().getBooleanProperty(IMQ + ".simulate.takeover") ) {
if (((IMQService)con.getService()).getServiceType() != ServiceType.ADMIN) {
status = Status.TIMEOUT;
if (oldCID != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,10 @@

package com.sun.messaging.jmq.jmsserver.service.imq;

import java.io.IOException;
import java.security.Principal;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;

import javax.jms.JMSException;

import com.sun.messaging.jmq.io.Packet;
import com.sun.messaging.jmq.io.PacketDispatcher;
import com.sun.messaging.jmq.io.PacketType;
import com.sun.messaging.jmq.io.ReadWritePacket;
import com.sun.messaging.jmq.io.PacketDispatcher;
import com.sun.messaging.jmq.jmsserver.Globals;
import com.sun.messaging.jmq.jmsserver.core.Session;
import com.sun.messaging.jmq.jmsserver.data.PacketRouter;
Expand All @@ -71,6 +62,16 @@
import com.sun.messaging.jmq.util.lists.Reason;
import com.sun.messaging.jmq.util.log.Logger;

import javax.jms.JMSException;
import java.io.IOException;
import java.security.Principal;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;

import static com.sun.messaging.jmq.jmsserver.comm.CommGlobals.IMQ;

public class IMQDualThreadConnection extends IMQBasicConnection implements DirectBrokerConnection
{
class DummyQueue<Packet> implements HandOffQueue<Packet>
Expand Down Expand Up @@ -288,6 +289,9 @@ public boolean isDirectBuffers() {

public void sendControlMessage(Packet p)
{
if (!isAdminConnection() && Globals.getConfig().getBooleanProperty(IMQ + ".simulate.noreply")) {
return;
}
if (p.getPacketType() > PacketType.MESSAGE) {
p.setIP(ipAddress);
p.setPort(0);
Expand Down
Loading