Search in sources :

Example 1 with ClasspathLauncher

use of com.alipay.sofa.ark.bootstrap.ClasspathLauncher in project sofa-ark by alipay.

the class EmbedSofaArkBootstrap method launch.

public static void launch(Environment environment) {
    if (started.compareAndSet(false, true)) {
        EntryMethod entryMethod = new EntryMethod(Thread.currentThread());
        getOrSetDefault(Constants.MASTER_BIZ, environment.getProperty(Constants.MASTER_BIZ, environment.getProperty("spring.application.name")));
        getOrSetDefault(Constants.BIZ_CLASS_LOADER_HOOK_DIR, environment.getProperty(Constants.BIZ_CLASS_LOADER_HOOK_DIR));
        getOrSetDefault(Constants.PLUGIN_EXPORT_CLASS_ENABLE, environment.getProperty(Constants.PLUGIN_EXPORT_CLASS_ENABLE, "false"));
        getOrSetDefault(Constants.BIZ_CLASS_LOADER_HOOK_DIR, DelegateToMasterBizClassLoaderHook.class.getName());
        try {
            URL[] urls = getURLClassPath();
            ClasspathLauncher launcher = new ClasspathLauncher(new EmbedClassPathArchive(entryMethod.getDeclaringClassName(), entryMethod.getMethod().getName(), urls));
            launcher.launch(new String[] {}, getClasspath(urls), entryMethod.getMethod());
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }
}
Also used : ClasspathLauncher(com.alipay.sofa.ark.bootstrap.ClasspathLauncher) EmbedClassPathArchive(com.alipay.sofa.ark.loader.EmbedClassPathArchive) DelegateToMasterBizClassLoaderHook(com.alipay.sofa.ark.support.common.DelegateToMasterBizClassLoaderHook) URL(java.net.URL)

Example 2 with ClasspathLauncher

use of com.alipay.sofa.ark.bootstrap.ClasspathLauncher in project sofa-ark by alipay.

the class SofaArkBootstrap method remain.

private static void remain(String[] args) throws Exception {
    // NOPMD
    AssertUtils.assertNotNull(entryMethod, "No Entry Method Found.");
    URL[] urls = getURLClassPath();
    new ClasspathLauncher(new ClassPathArchive(entryMethod.getDeclaringClassName(), entryMethod.getMethodName(), urls)).launch(args, getClasspath(urls), entryMethod.getMethod());
}
Also used : ClasspathLauncher(com.alipay.sofa.ark.bootstrap.ClasspathLauncher) URL(java.net.URL) ClassPathArchive(com.alipay.sofa.ark.bootstrap.ClasspathLauncher.ClassPathArchive)

Aggregations

ClasspathLauncher (com.alipay.sofa.ark.bootstrap.ClasspathLauncher)2 URL (java.net.URL)2 ClassPathArchive (com.alipay.sofa.ark.bootstrap.ClasspathLauncher.ClassPathArchive)1 EmbedClassPathArchive (com.alipay.sofa.ark.loader.EmbedClassPathArchive)1 DelegateToMasterBizClassLoaderHook (com.alipay.sofa.ark.support.common.DelegateToMasterBizClassLoaderHook)1