[jboss-cvs] JBossAS SVN: r63259 - in branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq: il and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 30 14:25:59 EDT 2007
Author: luc.texier at jboss.com
Date: 2007-05-30 14:25:58 -0400 (Wed, 30 May 2007)
New Revision: 63259
Modified:
branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/Connection.java
branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/ServerILJMXService.java
branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/ServerSocketManagerHandler.java
branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILService.java
Log:
JBAS-4260 updated JBossMQ's MSSQL pm and add MSSQL sm
Modified: branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/Connection.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/Connection.java 2007-05-30 18:17:05 UTC (rev 63258)
+++ branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/Connection.java 2007-05-30 18:25:58 UTC (rev 63259)
@@ -338,7 +338,9 @@
*/
public void asynchClose()
{
- // This obviously did something at some point?
+ // If we receive a close and we did not initiate it, then fire the exception listener
+ if (closing.get() == false)
+ asynchFailure("Asynchronous close from server.", new IOException("Close request from the server or transport layer."));
}
/**
Modified: branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/ServerILJMXService.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/ServerILJMXService.java 2007-05-30 18:17:05 UTC (rev 63258)
+++ branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/ServerILJMXService.java 2007-05-30 18:25:58 UTC (rev 63259)
@@ -232,7 +232,7 @@
{
return jmsServer;
}
-
+
/**
* @return Description of the Returned Value
* @exception Exception Description of Exception
@@ -242,7 +242,6 @@
{
return getJMSServer();
}
-
/**
* @return long the period of time in ms to wait between connection pings
* factory should be bound to
Modified: branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/ServerSocketManagerHandler.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/ServerSocketManagerHandler.java 2007-05-30 18:17:05 UTC (rev 63258)
+++ branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/ServerSocketManagerHandler.java 2007-05-30 18:25:58 UTC (rev 63259)
@@ -55,6 +55,7 @@
import org.jboss.mq.il.uil2.msgs.PingMsg;
import org.jboss.mq.il.Invoker;
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
/** This is the SocketManager callback handler for the UIL2 server side
* socket. This handles messages that are requests from clients.
*
@@ -68,13 +69,14 @@
private ConnectionToken connectionToken;
private Invoker server;
private SocketManager socketMgr;
- private boolean closed;
+ private UILServerILService uilServerILService;
+ private SynchronizedBoolean closed = new SynchronizedBoolean(false);
- public ServerSocketManagerHandler(Invoker server, SocketManager socketMgr)
+ public ServerSocketManagerHandler(Invoker server, SocketManager socketMgr, UILServerILService uilServerILService)
{
this.server = server;
this.socketMgr = socketMgr;
- this.closed = false;
+ this.uilServerILService = uilServerILService;
}
/** The callback from the SocketManager
@@ -127,7 +129,7 @@
break;
case m_connectionClosing:
server.connectionClosing(connectionToken);
- closed = true;
+ closed.set(true);
socketMgr.sendReply(msg);
socketMgr.stop();
break;
@@ -257,7 +259,8 @@
{
try
{
- if (closed == false)
+ uilServerILService.removeHandler(this);
+ if (closed.get() == false)
server.connectionClosing(connectionToken);
}
catch (Exception e)
Modified: branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILService.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILService.java 2007-05-30 18:17:05 UTC (rev 63258)
+++ branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/UILServerILService.java 2007-05-30 18:25:58 UTC (rev 63259)
@@ -27,6 +27,7 @@
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
+import java.util.Iterator;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.net.ServerSocketFactory;
@@ -39,6 +40,8 @@
import org.jboss.security.SecurityDomain;
import org.jboss.system.server.ServerConfigUtil;
+import EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArrayList;
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
/** This is the server side MBean for the UIL2 transport layer.
*
* @author Scott.Stark at jboss.org
@@ -64,7 +67,7 @@
*/
private ServerSocket serverSocket;
private UILServerIL serverIL;
- private boolean running;
+ private SynchronizedBoolean running = new SynchronizedBoolean(false);
/** The server jms listening port */
private int serverBindPort = 0;
/** The server jms address the listening socket binds to */
@@ -125,7 +128,10 @@
return connectionProperties;
}
- /**
+ /** The server handlers */
+ private CopyOnWriteArrayList handlers = new CopyOnWriteArrayList();
+
+ /**
* Used to construct the GenericConnectionFactory (bindJNDIReferences()
* builds it)
*
@@ -142,7 +148,7 @@
public void run()
{
boolean trace = log.isTraceEnabled();
- while (running)
+ while (running.get())
{
Socket socket = null;
SocketManager socketMgr = null;
@@ -154,7 +160,8 @@
socket.setSoTimeout(readTimeout);
socket.setTcpNoDelay(enableTcpNoDelay);
socketMgr = new SocketManager(socket);
- ServerSocketManagerHandler handler = new ServerSocketManagerHandler(getJMSServer(), socketMgr);
+ ServerSocketManagerHandler handler = new ServerSocketManagerHandler(getJMSServer(), socketMgr, this);
+ handlers.add(handler);
socketMgr.setHandler(handler);
socketMgr.setBufferSize(bufferSize);
socketMgr.setChunkSize(chunkSize);
@@ -163,12 +170,12 @@
}
catch (IOException e)
{
- if (running)
+ if (running.get())
log.warn("Failed to setup client connection", e);
}
catch(Throwable e)
{
- if (running || trace)
+ if (running.get() || trace)
log.warn("Unexpected error in setup of client connection", e);
}
}
@@ -182,7 +189,7 @@
public void startService() throws Exception
{
super.startService();
- running = true;
+
// Use the default javax.net.ServerSocketFactory if none was set
if (serverSocketFactory == null)
@@ -219,6 +226,7 @@
InetAddress socketAddress = serverSocket.getInetAddress();
log.info("JBossMQ UIL service available at : " + socketAddress + ":" + serverSocket.getLocalPort());
acceptThread = new Thread(getJMSServer().getThreadGroup(), this, "UILServerILService Accept Thread");
+ running.set(true);
acceptThread.start();
/* We need to check the socketAddress against "0.0.0.0/0.0.0.0"
@@ -256,7 +264,7 @@
{
try
{
- running = false;
+ running.set(false);
unbindJNDIReferences();
// unbind Server Socket if needed
@@ -269,8 +277,29 @@
{
log.error("Exception occured when trying to stop UIL Service: ", e);
}
+
+ // Try to close any open sockets that we know about
+ for (Iterator i = handlers.iterator(); i.hasNext();)
+ {
+ ServerSocketManagerHandler handler = (ServerSocketManagerHandler) i.next();
+ if (handler != null)
+ {
+ try
+ {
+ handler.close();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+ }
}
+ protected void removeHandler(ServerSocketManagerHandler handler)
+ {
+ handlers.remove(handler);
+ }
+
/**
* Get the UIL server listening port
*
More information about the jboss-cvs-commits
mailing list