类 CabinContainer
- java.lang.Object
-
- io.esastack.cabin.container.CabinContainer
-
public class CabinContainer extends Object
The entrance of starting cabin container, core class; Deploy modules, export shared classes, scan spi implementations, etc. Biz main class will be executed after all bizModule and modules have been loaded.
-
-
构造器概要
构造器 构造器 说明 CabinContainer(String executableURLString, String[] javaAgentURLStrings, String[] args)Same as previous constructor, except this is used while launching the application in fat jar; Create the biz URLs in CabinContainer, so the handler of the URL would bound to a JarFile, this will make the biz class loading faster;CabinContainer(String containerURLString, String[] moduleURLStrings, String[] bizURLStrings, String[] javaAgentURLStrings, String[] args)instanced by bootstrap, launcher, Test runner; start the container services pipeline to deploy modules, start services; Should not pass any Object except primitives and String, because any Object like URL/JarFile would bring SystemClassLoader with it; for example, 'URL' will bring a Handler loaded by SystemClassLoader which would load other classes with SystemClassLoader; so we should not pass these Object, and make sure SystemClassLoader is no longer used.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ClassLoadergetBizModuleClassLoader()Map<String,Class<?>>getExportedClasses()ClassLoadergetLibModuleClassLoader(String moduleName)List<String>getLoadedModules()voidinstallModule(String libJarUrl)booleanisStarted()booleanmoduleLoaded(String moduleName)voidstart()voidstop()voiduninstallModule(String libJarUrl)
-
-
-
构造器详细资料
-
CabinContainer
public CabinContainer(String containerURLString, String[] moduleURLStrings, String[] bizURLStrings, String[] javaAgentURLStrings, String[] args)
instanced by bootstrap, launcher, Test runner; start the container services pipeline to deploy modules, start services; Should not pass any Object except primitives and String, because any Object like URL/JarFile would bring SystemClassLoader with it; for example, 'URL' will bring a Handler loaded by SystemClassLoader which would load other classes with SystemClassLoader; so we should not pass these Object, and make sure SystemClassLoader is no longer used. An example for this is: URL to Handler to openConnection, in this method,JarURLConnection would be loaded by SystemClassloader and JarURLConnection::useFastExceptions would always be false Because Handler:: setUseFastConnectionExceptions would set another JarURLConnection Class loaded by CabinClassLoader.this constructor is used while launching the application in classpath
- 参数:
containerURLString- the cabin core fat jar file pathmoduleURLStrings- the lib module fat jar file pathsbizURLStrings- the biz classpath pathsjavaAgentURLStrings- the setup java agent jar file pathsargs- set up main args
-
CabinContainer
public CabinContainer(String executableURLString, String[] javaAgentURLStrings, String[] args)
Same as previous constructor, except this is used while launching the application in fat jar; Create the biz URLs in CabinContainer, so the handler of the URL would bound to a JarFile, this will make the biz class loading faster;- 参数:
executableURLString- the application executable fat jarjavaAgentURLStrings- the setup java agent jar file pathsargs- set up main args
-
-
方法详细资料
-
start
public void start()
-
stop
public void stop()
-
isStarted
public boolean isStarted()
-
installModule
public void installModule(String libJarUrl)
-
uninstallModule
public void uninstallModule(String libJarUrl)
-
moduleLoaded
public boolean moduleLoaded(String moduleName)
-
getLibModuleClassLoader
public ClassLoader getLibModuleClassLoader(String moduleName)
-
getBizModuleClassLoader
public ClassLoader getBizModuleClassLoader()
-
-