是否可以在每个子线程中有2个具有不同类路径的子线程? [英] Is possible to have 2 child threads with different classpath in each one?

查看:71
本文介绍了是否可以在每个子线程中有2个具有不同类路径的子线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个核心应用程序,它是处理任务的适配器。每个任务都由核心在适配器负载中实现,以处理任务。

I have a "core" application that is adapter to process task. Each task is implemented in an adapter load by the core to process the task.

我的问题是,是否可以在每个适配器中使用不同的类路径来提升类/ jar适配器之间的冲突。

My question is, is it possible to have different classpath in each adapter to precent class/jar conflict between adapters.

问候,

推荐答案

确实:

URLClassLoader cl = new URLClassLoader(urls);
Thread thread = new MyThread();
thread.setContextClassLoader(cl);
thread.start();

这篇关于是否可以在每个子线程中有2个具有不同类路径的子线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆