Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#461] Capacity and increase/decrease policies - adding classloading SPI
- Loading branch information
maeste
committed
Mar 15, 2016
1 parent
a8d5ba2
commit a3c6e27
Showing
12 changed files
with
248 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
core/src/main/java/org/ironjacamar/core/classloading/IronJacamarClassLoaderPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* IronJacamar, a Java EE Connector Architecture implementation | ||
* Copyright 2016, Red Hat Inc, 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 Eclipse Public License 1.0 as | ||
* published by the Free Software Foundation. | ||
* | ||
* 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 Eclipse | ||
* Public License for more details. | ||
* | ||
* You should have received a copy of the Eclipse 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.ironjacamar.core.classloading; | ||
|
||
import org.ironjacamar.core.spi.classloading.ClassLoaderPlugin; | ||
|
||
/** The default inplementation of SPI for class loading | ||
* This implementation is just using container classloading, ignoring any module parameters | ||
* | ||
* @author <a href="mailto:stefano.maestri@ironjacamar.org">Stefano Maestri</a> | ||
*/ | ||
|
||
public class IronJacamarClassLoaderPlugin implements ClassLoaderPlugin | ||
{ | ||
@Override | ||
public Class<?> loadClass(String className, String moduleName, String moduleSlot) throws ClassNotFoundException | ||
{ | ||
return SecurityActions.getClassLoader(IronJacamarClassLoaderPlugin.class).loadClass(className); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
core/src/main/java/org/ironjacamar/core/classloading/SecurityActions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* IronJacamar, a Java EE Connector Architecture implementation | ||
* Copyright 2016, Red Hat Inc, 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 Eclipse Public License 1.0 as | ||
* published by the Free Software Foundation. | ||
* | ||
* 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 Eclipse | ||
* Public License for more details. | ||
* | ||
* You should have received a copy of the Eclipse 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.ironjacamar.core.classloading; | ||
|
||
import java.security.AccessController; | ||
import java.security.PrivilegedAction; | ||
|
||
/** | ||
* Privileged Blocks | ||
* @author <a href="mailto:jesper.pedersen@ironjacamar.org">Jesper Pedersen</a> | ||
*/ | ||
class SecurityActions | ||
{ | ||
/** | ||
* Constructor | ||
*/ | ||
private SecurityActions() | ||
{ | ||
} | ||
|
||
/** | ||
* Get the classloader. | ||
* @param c The class | ||
* @return The classloader | ||
*/ | ||
static ClassLoader getClassLoader(final Class<?> c) | ||
{ | ||
if (System.getSecurityManager() == null) | ||
return c.getClassLoader(); | ||
|
||
return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> c.getClassLoader()); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
core/src/main/java/org/ironjacamar/core/classloading/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* IronJacamar, a Java EE Connector Architecture implementation | ||
* Copyright 2016, Red Hat Inc, 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 Eclipse Public License 1.0 as | ||
* published by the Free Software Foundation. | ||
* | ||
* 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 Eclipse | ||
* Public License for more details. | ||
* | ||
* You should have received a copy of the Eclipse 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. | ||
*/ | ||
|
||
/** | ||
* Created by maeste on 3/15/16. | ||
*/ | ||
package org.ironjacamar.core.classloading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
core/src/main/java/org/ironjacamar/core/spi/classloading/ClassLoaderPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* IronJacamar, a Java EE Connector Architecture implementation | ||
* Copyright 2016, Red Hat Inc, 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 Eclipse Public License 1.0 as | ||
* published by the Free Software Foundation. | ||
* | ||
* 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 Eclipse | ||
* Public License for more details. | ||
* | ||
* You should have received a copy of the Eclipse 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.ironjacamar.core.spi.classloading; | ||
|
||
/** The SPI for class loading | ||
* | ||
* @author <a href="mailto:stefano.maestri@ironjacamar.org">Stefano Maestri</a> | ||
*/ | ||
public interface ClassLoaderPlugin | ||
{ | ||
/** | ||
* load class using plugged in ClassLoader | ||
* @param className the class name | ||
* @param moduleName the module name | ||
* @param moduleSlot the module slot | ||
* @return the class | ||
* @@throws ClassNotFoundException | ||
* If the class could not be found | ||
*/ | ||
public Class<?> loadClass(String className, String moduleName, String moduleSlot) throws ClassNotFoundException; | ||
} |
25 changes: 25 additions & 0 deletions
25
core/src/main/java/org/ironjacamar/core/spi/classloading/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* IronJacamar, a Java EE Connector Architecture implementation | ||
* Copyright 2016, Red Hat Inc, 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 Eclipse Public License 1.0 as | ||
* published by the Free Software Foundation. | ||
* | ||
* 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 Eclipse | ||
* Public License for more details. | ||
* | ||
* You should have received a copy of the Eclipse 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. | ||
*/ | ||
|
||
/** | ||
* Created by maeste on 3/14/16. | ||
*/ | ||
package org.ironjacamar.core.spi.classloading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.