[jboss-cvs] JBossAS SVN: r80838 - trunk/connector/src/main/org/jboss/resource/connectionmanager.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 12 00:40:20 EST 2008


Author: anil.saldhana at jboss.com
Date: 2008-11-12 00:40:19 -0500 (Wed, 12 Nov 2008)
New Revision: 80838

Added:
   trunk/connector/src/main/org/jboss/resource/connectionmanager/SecurityActions.java
Modified:
   trunk/connector/src/main/org/jboss/resource/connectionmanager/PoolFiller.java
Log:
JBAS-5988: privileged block

Modified: trunk/connector/src/main/org/jboss/resource/connectionmanager/PoolFiller.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/connectionmanager/PoolFiller.java	2008-11-12 05:35:44 UTC (rev 80837)
+++ trunk/connector/src/main/org/jboss/resource/connectionmanager/PoolFiller.java	2008-11-12 05:40:19 UTC (rev 80838)
@@ -52,8 +52,8 @@
 
    public void run()
    {
-      ClassLoader myClassLoader = getClass().getClassLoader();
-      Thread.currentThread().setContextClassLoader(myClassLoader);
+      final ClassLoader myClassLoader = getClass().getClassLoader();
+      SecurityActions.setTCL(myClassLoader); 
       //keep going unless interrupted
       while (true)
       {

Added: trunk/connector/src/main/org/jboss/resource/connectionmanager/SecurityActions.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/connectionmanager/SecurityActions.java	                        (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/connectionmanager/SecurityActions.java	2008-11-12 05:40:19 UTC (rev 80838)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.resource.connectionmanager;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Privileged Blocks
+ * @author Anil.Saldhana at redhat.com
+ * @since Nov 7, 2008
+ */
+class SecurityActions
+{ 
+   static void setTCL(final ClassLoader cl)
+   {
+      AccessController.doPrivileged(new PrivilegedAction<Object>() 
+      {
+         public Object run()
+         {
+            Thread.currentThread().setContextClassLoader(cl);
+                     
+            return null;
+         }});
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list