| | |
| | | package com.iailab.module.model.mpk.common.utils; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.iailab.module.model.mpk.common.MdkConstant; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | String jarFilePath = bakPath + File.separator + projectId + MdkConstant.SPLIT + historyId + ".jar"; |
| | | String dllFilePath = bakPath + File.separator + projectId + MdkConstant.SPLIT + historyId + ".dll"; |
| | | |
| | | if (FileUtil.exist(jarFilePath) && FileUtil.exist(dllFilePath)) { |
| | | URLClassLoader urlClassLoader = null; |
| | | try { |
| | | // 加载新的jar |
| | | urlClassLoader = DllUtils.loadJar(jarFilePath); |
| | | urlClassLoader = loadJar(jarFilePath); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("加载jar异常",e); |
| | | } |
| | | |
| | | try { |
| | | // 加载新的dll |
| | | DllUtils.loadDll(urlClassLoader.loadClass("iail.mdk.model.common.Environment"),dllFilePath); |
| | | loadDll(urlClassLoader.loadClass("iail.mdk.model.common.Environment"),dllFilePath); |
| | | } catch (Exception e) { |
| | | DllUtils.unloadJar(urlClassLoader); |
| | | unloadJar(urlClassLoader); |
| | | throw new RuntimeException("加载dll异常",e); |
| | | } |
| | | // 都加载成功后加入缓存 |
| | | DllUtils.addClassLoaderCache(projectId,urlClassLoader); |
| | | addClassLoaderCache(projectId,urlClassLoader); |
| | | } |
| | | } |
| | | } |
| | | } |