JBoss Remoting SVN: r3805 - remoting2/branches/2.2/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-28 02:32:29 -0400 (Fri, 28 Mar 2008)
New Revision: 3805
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java
Log:
JBREM-944: Eliminated race in connectionLost() and connectionTerminated().
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java 2008-03-28 06:31:04 UTC (rev 3804)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionNotifier.java 2008-03-28 06:32:29 UTC (rev 3805)
@@ -1,5 +1,7 @@
package org.jboss.remoting;
+import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@@ -13,7 +15,7 @@
*/
public class ConnectionNotifier
{
- private List listeners = new ArrayList();
+ private List listeners = Collections.synchronizedList(new ArrayList());
private static final Logger log = Logger.getLogger(ConnectionNotifier.class);
@@ -44,10 +46,14 @@
log.debug("Server connection lost to client (session id = " + clientSessionId);
Client client = new Client(new InvokerLocator(locatorurl), requestPayload);
client.setSessionId(clientSessionId);
- ConnectionListener[] list = (ConnectionListener[])listeners.toArray(new ConnectionListener[listeners.size()]);
- for(int x = 0; x < list.length; x++)
+
+ synchronized (listeners)
{
- list[x].handleConnectionException(null, client);
+ Iterator it = listeners.iterator();
+ while (it.hasNext())
+ {
+ ((ConnectionListener) it.next()).handleConnectionException(null, client);
+ }
}
}
catch(Exception e)
@@ -67,11 +73,14 @@
Client client = new Client(new InvokerLocator(locatorURL), requestPayload);
client.setSessionId(clientSessionId);
ClientDisconnectedException ex = new ClientDisconnectedException();
-
- ConnectionListener[] list = (ConnectionListener[])listeners.toArray(new ConnectionListener[listeners.size()]);
- for(int x = 0; x < list.length; x++)
+
+ synchronized (listeners)
{
- list[x].handleConnectionException(ex, client);
+ Iterator it = listeners.iterator();
+ while (it.hasNext())
+ {
+ ((ConnectionListener) it.next()).handleConnectionException(ex, client);
+ }
}
}
catch(Exception e)
16 years, 9 months
JBoss Remoting SVN: r3804 - remoting2/branches/2.2/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-28 02:31:04 -0400 (Fri, 28 Mar 2008)
New Revision: 3804
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.java
Log:
JBREM-942: Eliminated synchronization on listeners list.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.java 2008-03-27 20:00:54 UTC (rev 3803)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/ConnectionValidator.java 2008-03-28 06:31:04 UTC (rev 3804)
@@ -320,7 +320,7 @@
{
if (listener != null)
{
- synchronized (listeners)
+ synchronized (lock)
{
if (listeners.size() == 0)
{
@@ -336,7 +336,7 @@
boolean isRemoved = false;
if (listener != null)
{
- synchronized (listeners)
+ synchronized (lock)
{
isRemoved = listeners.remove(listener);
if (listeners.size() == 0)
@@ -548,7 +548,7 @@
private void notifyListeners(Throwable thr)
{
final Throwable t = thr;
- synchronized (listeners)
+ synchronized (lock)
{
ListIterator itr = listeners.listIterator();
while (itr.hasNext())
16 years, 9 months
JBoss Remoting SVN: r3803 - remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-27 16:00:54 -0400 (Thu, 27 Mar 2008)
New Revision: 3803
Modified:
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
Log:
Add a better error message if the connection is closed
Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-03-27 09:02:43 UTC (rev 3802)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-03-27 20:00:54 UTC (rev 3803)
@@ -397,6 +397,8 @@
} catch (IllegalStateException e) {
if (state.in(State.FAILED)) {
throw failureReason;
+ } else if (state.in(State.CLOSED)) {
+ throw new IOException("Connection closed");
} else {
throw e;
}
16 years, 9 months
JBoss Remoting SVN: r3802 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/locator.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-27 05:02:43 -0400 (Thu, 27 Mar 2008)
New Revision: 3802
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/locator/InvokerLocatorTestCase.java
Log:
JBREM-936: Fixed testNullHost().
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/locator/InvokerLocatorTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/locator/InvokerLocatorTestCase.java 2008-03-27 07:33:15 UTC (rev 3801)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/locator/InvokerLocatorTestCase.java 2008-03-27 09:02:43 UTC (rev 3802)
@@ -476,17 +476,16 @@
/**
* For JBREM-936.
*/
- public void testNullHost() throws Exception
+ public void testNullHost() throws Exception
{
InvokerLocator locator = new InvokerLocator("socket://:7777");
-
- String bindByHost = System.getProperty(InvokerLocator.BIND_BY_HOST, "True");
boolean byHost = true;
String host = null;
try
- {
- byHost = Boolean.getBoolean(bindByHost);
+ {
+ String s = System.getProperty(InvokerLocator.BIND_BY_HOST, "True");
+ byHost = Boolean.valueOf(s).booleanValue();
}
catch(Exception e)
{
16 years, 9 months
JBoss Remoting SVN: r3801 - remoting2/branches/2.x.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-27 03:33:15 -0400 (Thu, 27 Mar 2008)
New Revision: 3801
Modified:
remoting2/branches/2.x/test.policy
Log:
JBREM-920: Added some more Remoting permissions.
Modified: remoting2/branches/2.x/test.policy
===================================================================
--- remoting2/branches/2.x/test.policy 2008-03-27 07:28:52 UTC (rev 3800)
+++ remoting2/branches/2.x/test.policy 2008-03-27 07:33:15 UTC (rev 3801)
@@ -25,7 +25,7 @@
permission javax.management.MBeanPermission "org.jboss.remoting.network.NetworkRegistry#-[remoting:type=NetworkRegistry]", "queryMBeans, isInstanceOf";
permission javax.management.MBeanPermission "org.jboss.remoting.network.NetworkRegistry#Servers[remoting:type=NetworkRegistry]", "getAttribute";
permission javax.management.MBeanPermission "-#ServerDataDir[jboss.system:type=ServerConfig]", "getAttribute";
-
+
// TODO: Figure out why these aren't covered by the AllPermission entries below
permission javax.management.MBeanPermission "org.jboss.test.remoting.detection.metadata.MetadataTestCase$TestNetworkRegistry#-[remoting:type=NetworkRegistry]", "unregisterMBean, registerMBean, queryMBeans, isInstanceOf";
@@ -58,8 +58,9 @@
permission java.util.PropertyPermission "remoting.stream.transport", "read";
permission java.util.PropertyPermission "remoting.stream.host", "read";
permission java.util.PropertyPermission "remoting.stream.port", "read";
- permission java.util.PropertyPermission "org.jboss.security.ignoreHttpsHost" , "read";
-
+ permission java.util.PropertyPermission "org.jboss.security.ignoreHttpsHost" , "read";
+ permission java.util.PropertyPermission "tomcat.util.buf.StringCache.byte.enabled", "read";
+
// Tomcat native - TODO - this should be in a privileged block in jbossnative
permission java.lang.RuntimePermission "loadLibrary.tcnative-1";
permission java.lang.RuntimePermission "loadLibrary.libtcnative-1";
@@ -69,7 +70,8 @@
permission java.io.FilePermission "${build.home}/output/tests/classes/-", "read";
permission java.io.FilePermission "${build.home}", "read";
permission java.io.FilePermission "${build.home}/jboss.identity", "read";
-
+ permission java.io.FilePermission "-", "read";
+
// Permission for org.jboss.remoting.ident.Identity to create "jboss.identity" file. Could be extended.
permission java.io.FilePermission "${build.home}", "write";
16 years, 9 months
JBoss Remoting SVN: r3800 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-27 03:28:52 -0400 (Thu, 27 Mar 2008)
New Revision: 3800
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
Log:
JBREM-934: Put org.apache.tomcat.util.http.MimeHeaders.names() in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2008-03-27 07:08:13 UTC (rev 3799)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2008-03-27 07:28:52 UTC (rev 3800)
@@ -48,11 +48,14 @@
import org.jboss.logging.Logger;
import javax.net.ServerSocketFactory;
+
+import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
@@ -587,8 +590,17 @@
private void populateRequestMetadata(RequestMap metadata, Request req)
{
- MimeHeaders headers = req.getMimeHeaders();
- Enumeration nameEnum = headers.names();
+ final MimeHeaders headers = req.getMimeHeaders();
+ Enumeration nameEnum
+ = (Enumeration)AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return headers.names();
+ }}
+ );
+
+
while (nameEnum.hasMoreElements())
{
Object nameObj = nameEnum.nextElement();
16 years, 9 months
JBoss Remoting SVN: r3799 - remoting2/branches/2.x.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-27 03:08:13 -0400 (Thu, 27 Mar 2008)
New Revision: 3799
Modified:
remoting2/branches/2.x/test.policy
Log:
JBREM-920: Simplified a couple of test suite permissions.
Modified: remoting2/branches/2.x/test.policy
===================================================================
--- remoting2/branches/2.x/test.policy 2008-03-27 07:03:12 UTC (rev 3798)
+++ remoting2/branches/2.x/test.policy 2008-03-27 07:08:13 UTC (rev 3799)
@@ -25,7 +25,7 @@
permission javax.management.MBeanPermission "org.jboss.remoting.network.NetworkRegistry#-[remoting:type=NetworkRegistry]", "queryMBeans, isInstanceOf";
permission javax.management.MBeanPermission "org.jboss.remoting.network.NetworkRegistry#Servers[remoting:type=NetworkRegistry]", "getAttribute";
permission javax.management.MBeanPermission "-#ServerDataDir[jboss.system:type=ServerConfig]", "getAttribute";
-
+
// TODO: Figure out why these aren't covered by the AllPermission entries below
permission javax.management.MBeanPermission "org.jboss.test.remoting.detection.metadata.MetadataTestCase$TestNetworkRegistry#-[remoting:type=NetworkRegistry]", "unregisterMBean, registerMBean, queryMBeans, isInstanceOf";
@@ -59,7 +59,7 @@
permission java.util.PropertyPermission "remoting.stream.host", "read";
permission java.util.PropertyPermission "remoting.stream.port", "read";
permission java.util.PropertyPermission "org.jboss.security.ignoreHttpsHost" , "read";
-
+
// Tomcat native - TODO - this should be in a privileged block in jbossnative
permission java.lang.RuntimePermission "loadLibrary.tcnative-1";
permission java.lang.RuntimePermission "loadLibrary.libtcnative-1";
@@ -69,7 +69,7 @@
permission java.io.FilePermission "${build.home}/output/tests/classes/-", "read";
permission java.io.FilePermission "${build.home}", "read";
permission java.io.FilePermission "${build.home}/jboss.identity", "read";
-
+
// Permission for org.jboss.remoting.ident.Identity to create "jboss.identity" file. Could be extended.
permission java.io.FilePermission "${build.home}", "write";
@@ -122,14 +122,12 @@
permission javax.management.MBeanServerPermission "createMBeanServer, findMBeanServer";
permission javax.management.MBeanTrustPermission "register";
permission javax.management.MBeanPermission "org.jboss.remoting.ServerInvoker#-[jboss.remoting:service=invoker,*]", "unregisterMBean, registerMBean, queryMBeans, isInstanceOf";
- permission javax.management.MBeanPermission "org.jboss.remoting.transport.Connector#-[jboss.remoting:*,transport=socket,type=Connector]", "registerMBean, unregisterMBean, queryMBeans, isInstanceOf";
- permission javax.management.MBeanPermission "org.jboss.remoting.transport.Connector#-[jboss.remoting:transport=socket,type=Connector]", "registerMBean, unregisterMBean, queryMBeans, isInstanceOf";
+ permission javax.management.MBeanPermission "org.jboss.remoting.transport.Connector#-[jboss.remoting:type=Connector,*]", "registerMBean, unregisterMBean, queryMBeans, isInstanceOf";
permission javax.management.MBeanPermission "org.jboss.remoting.transport.Connector#-[test:type=connector]", "registerMBean";
permission javax.management.MBeanPermission "org.jboss.test.remoting.detection.metadata.MetadataTestCase$TestNetworkRegistry#-[remoting:type=NetworkRegistry]", "registerMBean, unregisterMBean, queryMBeans, isInstanceOf, addNotificationListener";
permission javax.management.MBeanPermission "org.jboss.remoting.network.NetworkRegistry#-[remoting:type=NetworkRegistry]", "registerMBean, unregisterMBean, queryMBeans, isInstanceOf";
permission javax.management.MBeanPermission "org.jboss.remoting.detection.multicast.MulticastDetector#-[remoting:type=JNDIDetector]", "registerMBean, queryMBeans, isInstanceOf";
- permission javax.management.MBeanPermission "org.jboss.remoting.detection.multicast.MulticastDetector#-[remoting:type=MulticastDetector]", "registerMBean, queryMBeans, isInstanceOf";
- permission javax.management.MBeanPermission "org.jboss.remoting.detection.multicast.MulticastDetector#-[remoting:type=MulticastDetector]", "registerMBean, queryMBeans, isInstanceOf";
+ permission javax.management.MBeanPermission "org.jboss.remoting.detection.multicast.MulticastDetector#-[remoting:type=MulticastDetector]", "registerMBean, unregisterMBean, queryMBeans, isInstanceOf";
permission javax.management.MBeanPermission "org.jboss.remoting.security.SSLServerSocketFactoryService#-[jboss:type=serversocketfactory]", "registerMBean, queryMBeans, isInstanceOf";
permission javax.management.MBeanPermission "org.jboss.test.remoting.transport.config.FactoryConfigTestCaseParent$SelfIdentifyingServerSocketFactory#-[jboss:type=serversocketfactory]", "registerMBean, queryMBeans, isInstanceOf";
permission javax.management.MBeanPermission "org.jboss.remoting.security.SSLServerSocketFactoryService#-[jboss:type=serversocketfactory2]", "registerMBean";
16 years, 9 months
JBoss Remoting SVN: r3798 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-27 03:03:12 -0400 (Thu, 27 Mar 2008)
New Revision: 3798
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-934: Put MBeanServer.registerMBean(), MBeanServer.unregisterMBean() in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java 2008-03-27 07:01:10 UTC (rev 3797)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java 2008-03-27 07:03:12 UTC (rev 3798)
@@ -24,7 +24,6 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.ConnectionListener;
-import org.jboss.remoting.Home;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.InvokerRegistry;
import org.jboss.remoting.ServerConfiguration;
@@ -46,7 +45,9 @@
import javax.net.ServerSocketFactory;
import javax.net.SocketFactory;
import java.net.InetAddress;
-import java.util.ArrayList;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -430,10 +431,24 @@
{
try
{
- ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
+ final ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
if (!server.isRegistered(objName))
- {
- server.registerMBean(invoker, objName);
+ {
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ server.registerMBean(invoker, objName);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (Exception) e.getCause();
+ }
}
else
{
@@ -962,8 +977,22 @@
{
try
{
- ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
- server.unregisterMBean(objName);
+ final ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ server.unregisterMBean(objName);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (Exception) e.getCause();
+ }
}
catch (Exception e)
{
16 years, 9 months
JBoss Remoting SVN: r3797 - remoting2/branches/2.x/src/main/org/jboss/remoting/ident.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-27 03:01:10 -0400 (Thu, 27 Mar 2008)
New Revision: 3797
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java
Log:
JBREM-934: Eliminated unnecessary import of ClassByteClassLoader.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java 2008-03-27 06:54:43 UTC (rev 3796)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java 2008-03-27 07:01:10 UTC (rev 3797)
@@ -21,7 +21,6 @@
*/
package org.jboss.remoting.ident;
-import org.jboss.remoting.loading.ClassByteClassLoader;
import org.jboss.remoting.network.NetworkRegistry;
import javax.management.MBeanServer;
@@ -353,6 +352,7 @@
return null;
}
});
+
}
file = new File(dir, "jboss.identity");
}
16 years, 9 months
JBoss Remoting SVN: r3796 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-03-27 02:54:43 -0400 (Thu, 27 Mar 2008)
New Revision: 3796
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/detection/AbstractDetector.java
Log:
JBREM-934: Put NetworkRegistryMBean.getServers() in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/AbstractDetector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/AbstractDetector.java 2008-03-27 05:50:00 UTC (rev 3795)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/AbstractDetector.java 2008-03-27 06:54:43 UTC (rev 3796)
@@ -38,6 +38,9 @@
import javax.management.MBeanServer;
import javax.management.MBeanServerInvocationHandler;
import javax.management.ObjectName;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -420,7 +423,13 @@
forceHeartbeat();
if(networkRegistry != null)
{
- return networkRegistry.getServers();
+ return (NetworkInstance[]) AccessController.doPrivileged( new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return networkRegistry.getServers();
+ }
+ });
}
else
{
16 years, 9 months