Is possible to have 2 child threads with different classpath in each one?

后端 未结 2 498
悲哀的现实
悲哀的现实 2021-02-11 05:31

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.

My question is, is it possibl

2条回答
  •  悲哀的现实
    2021-02-11 06:06

    Indeed:

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

提交回复
热议问题