JBoss Remoting SVN: r3896 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-04 18:36:36 -0400 (Fri, 04 Apr 2008)
New Revision: 3896
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java
Log:
JBREM-934: Put call to MBeanServerFactory.findMBeanServer() in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java 2008-04-04 22:35:09 UTC (rev 3895)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/web/ServerInvokerServlet.java 2008-04-04 22:36:36 UTC (rev 3896)
@@ -44,6 +44,7 @@
import java.io.IOException;
import java.lang.reflect.Method;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Iterator;
@@ -301,8 +302,16 @@
}
}
- for (Iterator i = MBeanServerFactory.findMBeanServer(null).iterator(); i.hasNext();)
+ Iterator i = (Iterator) AccessController.doPrivileged( new PrivilegedAction()
{
+ public Object run()
+ {
+ return MBeanServerFactory.findMBeanServer(null).iterator();
+ }
+ });
+
+ while(i.hasNext())
+ {
MBeanServer server = (MBeanServer) i.next();
if (server.getDefaultDomain() == null)
18 years, 1 month
JBoss Remoting SVN: r3895 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/local.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-04 18:35:09 -0400 (Fri, 04 Apr 2008)
New Revision: 3895
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/local/LocalClientInvoker.java
Log:
JBREM-934: Put call to JBossSerializationManager.createMarshalledValueForClone() in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/local/LocalClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/local/LocalClientInvoker.java 2008-04-04 22:31:20 UTC (rev 3894)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/local/LocalClientInvoker.java 2008-04-04 22:35:09 UTC (rev 3895)
@@ -31,11 +31,15 @@
import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.serialization.SerializationManager;
import org.jboss.remoting.serialization.SerializationStreamFactory;
import org.jboss.remoting.transport.BidirectionalClientInvoker;
import org.jboss.logging.Logger;
import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Map;
/**
@@ -147,8 +151,33 @@
protected InvocationRequest marshallInvocation(InvocationRequest localInvocation) throws IOException, ClassNotFoundException
{
- Object param = localInvocation.getParameter();
- Object newParam = SerializationStreamFactory.getManagerInstance(getSerializationType()).createMarshalledValueForClone(param).get();
+ final Object param = localInvocation.getParameter();
+ Object newParam = null;
+ String serializationType = getSerializationType();
+ final SerializationManager manager = SerializationStreamFactory.getManagerInstance(serializationType);
+
+ if (serializationType.indexOf("jboss") < 0)
+ {
+ newParam = manager.createMarshalledValueForClone(param).get();
+ }
+ else
+ {
+ try
+ {
+ newParam = AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return manager.createMarshalledValueForClone(param).get();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+ }
+
localInvocation.setParameter(newParam);
return localInvocation;
}
18 years, 1 month
JBoss Remoting SVN: r3894 - 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-04-04 18:31:20 -0400 (Fri, 04 Apr 2008)
New Revision: 3894
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-934: In init(), moved MBeanServer.isRegistered() inside AccessController.doPrivileged() call.
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-04-04 22:27:34 UTC (rev 3893)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java 2008-04-04 22:31:20 UTC (rev 3894)
@@ -434,28 +434,30 @@
try
{
final ObjectName objName = new ObjectName(invoker.getMBeanObjectName());
- if (!server.isRegistered(objName))
- {
- try
+
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
{
- AccessController.doPrivileged( new PrivilegedExceptionAction()
+ public Object run() throws Exception
{
- public Object run() throws Exception
+ if (!server.isRegistered(objName))
{
server.registerMBean(invoker, objName);
- return null;
}
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (Exception) e.getCause();
- }
+ else
+ {
+ log.warn(objName + " is already registered with MBeanServer");
+ }
+ return null;
+ }
+ });
}
- else
+ catch (PrivilegedActionException e)
{
- log.warn(objName + " is already registered with MBeanServer");
+ throw (Exception) e.getCause();
}
+
}
catch (Throwable e)
{
18 years, 1 month
JBoss Remoting SVN: r3893 - 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-04-04 18:27:34 -0400 (Fri, 04 Apr 2008)
New Revision: 3893
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java
Log:
JBREM-934: Uses SystemUtility.mkdirs().
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-04-04 22:25:37 UTC (rev 3892)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java 2008-04-04 22:27:34 UTC (rev 3893)
@@ -296,13 +296,13 @@
try
{
- dir = (File)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return server.getAttribute(obj, "ServerDataDir");
- }
- });
+ dir = (File)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return server.getAttribute(obj, "ServerDataDir");
+ }
+ });
}
catch (PrivilegedActionException e)
{
@@ -313,15 +313,7 @@
{
if(fileExists(dir) == false)
{
- final File finalDir = dir;
- AccessController.doPrivileged( new PrivilegedAction()
- {
- public Object run()
- {
- finalDir.mkdirs();
- return null;
- }
- });
+ SystemUtility.mkdirs(dir);
}
file = new File(dir, "jboss.identity");
}
@@ -351,27 +343,19 @@
final File dir = new File(fl);
if(fileExists(dir) == false)
{
- AccessController.doPrivileged( new PrivilegedAction()
- {
- public Object run()
- {
- dir.mkdirs();
- return null;
- }
- });
-
+ SystemUtility.mkdirs(dir);
}
file = new File(dir, "jboss.identity");
}
final File finalFile = file;
boolean canRead = ((Boolean)AccessController.doPrivileged( new PrivilegedAction()
- {
- public Object run()
- {
- return new Boolean(finalFile.canRead());
- }
- })).booleanValue();
+ {
+ public Object run()
+ {
+ return new Boolean(finalFile.canRead());
+ }
+ })).booleanValue();
if(fileExists(file) && canRead)
18 years, 1 month
JBoss Remoting SVN: r3892 - remoting2/branches/2.x/src/main/org/jboss/remoting/callback.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-04 18:25:37 -0400 (Fri, 04 Apr 2008)
New Revision: 3892
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java
Log:
JBREM-934: Replaced File.mkdirs() with SystemUtility.mkdirs().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java 2008-04-04 22:24:35 UTC (rev 3891)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java 2008-04-04 22:25:37 UTC (rev 3892)
@@ -140,7 +140,7 @@
File storeFile = new File(filePath);
if (!storeFile.exists())
{
- boolean madeDir = storeFile.mkdirs();
+ boolean madeDir = SystemUtility.mkdirs(storeFile);
if (!madeDir)
{
throw new IOException("Can not create directory for store. Path given: " + filePath);
18 years, 1 month
JBoss Remoting SVN: r3891 - remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-04 18:24:35 -0400 (Fri, 04 Apr 2008)
New Revision: 3891
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss/JBossSerializationManager.java
Log:
JBREM-934: Put JBossSerialization operations in AccessController.doPrivileged() calls.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss/JBossSerializationManager.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss/JBossSerializationManager.java 2008-04-04 07:48:19 UTC (rev 3890)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/jboss/JBossSerializationManager.java 2008-04-04 22:24:35 UTC (rev 3891)
@@ -37,6 +37,9 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
/**
* Instantiates the Streamings according to JbossObjectOutputStream and JBossObjectInputStream.
@@ -51,16 +54,44 @@
private static boolean trace = log.isTraceEnabled();
- public ObjectInputStream createInput(InputStream input, ClassLoader loader) throws IOException
+ public ObjectInputStream createInput(final InputStream input, final ClassLoader loader) throws IOException
{
if (trace) { log.trace(this + " creating JBossObjectInputStream"); }
- return new JBossObjectInputStream(input, loader, new StringUtilBuffer(10024, 10024));
+
+ try
+ {
+ return (ObjectInputStream)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return new JBossObjectInputStream(input, loader, new StringUtilBuffer(10024, 10024));
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
}
- public ObjectOutputStream createOutput(OutputStream output) throws IOException
+ public ObjectOutputStream createOutput(final OutputStream output) throws IOException
{
if (trace) { log.trace(this + " creating JBossObjectOutputStream"); }
- return new JBossObjectOutputStream(output, new StringUtilBuffer(10024, 10024));
+
+ try
+ {
+ return (ObjectOutputStream)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return new JBossObjectOutputStream(output, new StringUtilBuffer(10024, 10024));
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
}
/**
@@ -84,10 +115,24 @@
}
- public void sendObject(ObjectOutputStream oos, Object dataObject, int version) throws IOException
+ public void sendObject(final ObjectOutputStream oos, final Object dataObject, int version) throws IOException
{
- oos.writeObject(dataObject);
- oos.flush();
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ oos.writeObject(dataObject);
+ oos.flush();
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
}
public Object receiveObject(InputStream inputStream, ClassLoader customClassLoader, int version)
@@ -121,7 +166,22 @@
}
}
- obj = objInputStream.readObject();
+ try
+ {
+ final ObjectInputStream ois = objInputStream;
+ obj = AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return ois.readObject();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+
return obj;
}
18 years, 1 month
JBoss Remoting SVN: r3890 - remoting2/branches/2.x/src/main/org/jboss/remoting/network.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-04 03:48:19 -0400 (Fri, 04 Apr 2008)
New Revision: 3890
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistry.java
Log:
JBREM-934: Uses SystemUtility.setSystemProperty().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistry.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistry.java 2008-04-04 07:46:57 UTC (rev 3889)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/network/NetworkRegistry.java 2008-04-04 07:48:19 UTC (rev 3890)
@@ -37,6 +37,7 @@
import org.jboss.remoting.InvokerRegistry;
import org.jboss.remoting.detection.ServerInvokerMetadata;
import org.jboss.remoting.ident.Identity;
+import org.jboss.remoting.util.SystemUtility;
/**
* NetworkRegistry is a concrete implemenation of the NetworkRegistryMBean
@@ -268,9 +269,9 @@
Identity identity = Identity.get(this.mBeanServer);
// this is a slight hack, but we have to have some way to know the main
// JBoss MBeanServer data
- System.setProperty("jboss.remoting.jmxid", identity.getJMXId());
- System.setProperty("jboss.remoting.instanceid", identity.getInstanceId());
- System.setProperty("jboss.remoting.domain", identity.getDomain());
+ SystemUtility.setSystemProperty("jboss.remoting.jmxid", identity.getJMXId());
+ SystemUtility.setSystemProperty("jboss.remoting.instanceid", identity.getInstanceId());
+ SystemUtility.setSystemProperty("jboss.remoting.domain", identity.getDomain());
return objectName;
}
@@ -281,7 +282,7 @@
*/
public synchronized void changeDomain(String newDomain)
{
- System.setProperty("jboss.remoting.domain", newDomain);
+ SystemUtility.setSystemProperty("jboss.remoting.domain", newDomain);
NetworkInstance servers[] = getServers();
if(servers == null || servers.length <= 0)
{
18 years, 1 month
JBoss Remoting SVN: r3889 - 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-04-04 03:46:57 -0400 (Fri, 04 Apr 2008)
New Revision: 3889
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java
Log:
JBREM-934: Uses SystemUtility.setSystemProperty().
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-04-04 07:43:59 UTC (rev 3888)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/ident/Identity.java 2008-04-04 07:46:57 UTC (rev 3889)
@@ -113,7 +113,7 @@
}
ident.calcHashCode();
}
- System.setProperty("jboss.identity.domain", domain);
+ SystemUtility.setSystemProperty("jboss.identity.domain", domain);
_domain = domain;
NetworkRegistry.getInstance().changeDomain(domain);
}
@@ -477,21 +477,7 @@
}
}
- try
- {
- final String finalId = id;
- AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- System.setProperty("jboss.identity", finalId);
- return null;
- }
- });
- }
- catch (Exception e)
- {
- }
+ SystemUtility.setSystemProperty("jboss.identity", id);
return id;
}
18 years, 1 month
JBoss Remoting SVN: r3888 - remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-04 03:43:59 -0400 (Fri, 04 Apr 2008)
New Revision: 3888
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util/DetectorUtil.java
Log:
JBREM-934: Uses SystemUtility.setSystemProperty().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util/DetectorUtil.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util/DetectorUtil.java 2008-04-04 07:43:10 UTC (rev 3887)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/detection/util/DetectorUtil.java 2008-04-04 07:43:59 UTC (rev 3888)
@@ -37,6 +37,7 @@
import org.jboss.remoting.network.NetworkInstance;
import org.jboss.remoting.network.NetworkRegistry;
import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.util.SystemUtility;
/**
@@ -103,7 +104,7 @@
org.apache.log4j.Category.getRoot().setLevel(Level.DEBUG);
Logger log = Logger.getLogger(getClass());
- System.setProperty("jboss.identity", String.valueOf(System.currentTimeMillis()));
+ SystemUtility.setSystemProperty("jboss.identity", String.valueOf(System.currentTimeMillis()));
MBeanServer server = null;
try
18 years, 1 month
JBoss Remoting SVN: r3887 - remoting2/branches/2.x/src/main/org/jboss/remoting/callback.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-04-04 03:43:10 -0400 (Fri, 04 Apr 2008)
New Revision: 3887
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java
Log:
JBREM-934: Put JBossSerialization operations in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java 2008-04-04 07:40:51 UTC (rev 3886)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java 2008-04-04 07:43:10 UTC (rev 3887)
@@ -443,7 +443,7 @@
* @param object
* @throws IOException
*/
- public void add(Serializable object) throws IOException
+ public void add(final Serializable object) throws IOException
{
verifyStarted();
@@ -485,10 +485,34 @@
{
throw (IOException) e.getCause();
}
-
- out = SerializationStreamFactory.getManagerInstance(serializationType).createOutput(outFile);
- out.writeObject(object);
- out.flush();
+
+ if (serializationType.indexOf("jboss") > 0)
+ {
+ out = SerializationStreamFactory.getManagerInstance(serializationType).createOutput(outFile);
+ out.writeObject(object);
+ out.flush();
+ }
+ else
+ {
+ try
+ {
+ final FileOutputStream finalOutFile = outFile;
+ out = (ObjectOutputStream) AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws IOException
+ {
+ ObjectOutputStream out = SerializationStreamFactory.getManagerInstance(serializationType).createOutput(finalOutFile);
+ out.writeObject(object);
+ out.flush();
+ return out;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+ }
}
finally
{
18 years, 1 month