@Test public void loadTacHandler() throws Exception { TacInst tacMsInst = iMsInstService.getTacMsInst(111L); TacInstanceInfo tacInstanceInfo = tacInstanceLoadService.loadTacHandler(tacMsInst); assertNotNull(tacInstanceInfo); }
public TacInstanceInfo loadTacHandler(TacInst tacInst) throws Exception { LOGGER.info("TacInstanceLoader.loadTacHandler start,tacMs:{}", tacInst); if (tacInst == null) { return null; } TacInstanceInfo tacInstanceInfo = new TacInstanceInfo(); long instId = tacInst.getId(); byte[] bytes = remoteMsInstFileService.getInstanceFile(tacInst.getId()); tacInstanceInfo.setJarVersion(tacInst.getJarVersion()); tacInstanceInfo.setId(instId); LOGGER.info("TacInstanceLoader.loadTacHandler,msCode:{},instId:{},jarVersion:{}", tacInst.getMsCode(), instId, tacInst.getJarVersion()); if (bytes == null || StringUtils.isEmpty(tacInstanceInfo.getJarVersion())) { throw new IllegalStateException("can't get jar file . instId:" + tacInst.getId()); } localMsInstFileService.saveInstanceFile(tacInst, bytes); Class<TacHandler> clazz = codeLoadService.loadHandlerClass(instId, TacHandler.class); if (clazz == null) { LOGGER.error("can't find the calss {} from source. instId:{}", TacHandler.class.getCanonicalName(), instId); throw new IllegalStateException("can't find the TacHandler.calss from source. instId:" + tacInst.getId()); } TacHandler tacHandler = clazz.newInstance(); LOGGER.info( "InitializingHandler init class : " + tacHandler.getClass() + " , isInit :" + InitializingHandler.class .isAssignableFrom(tacHandler.getClass())); if (InitializingHandler.class.isAssignableFrom(tacHandler.getClass())) { InitializingHandler initializingHandler = (InitializingHandler)tacHandler; LOGGER.info("InitializingHandler init : " + initializingHandler.getClass()); initializingHandler.afterPropertiesSet(); } tacInstanceInfo.setTacHandler(tacHandler); LOGGER.info("TacInstanceLoader.loadTacHandler,instId {} end ..", instId); return tacInstanceInfo; }
TacInstanceLoadService { public TacInstanceInfo loadTacHandler(TacInst tacInst) throws Exception { LOGGER.info("TacInstanceLoader.loadTacHandler start,tacMs:{}", tacInst); if (tacInst == null) { return null; } TacInstanceInfo tacInstanceInfo = new TacInstanceInfo(); long instId = tacInst.getId(); byte[] bytes = remoteMsInstFileService.getInstanceFile(tacInst.getId()); tacInstanceInfo.setJarVersion(tacInst.getJarVersion()); tacInstanceInfo.setId(instId); LOGGER.info("TacInstanceLoader.loadTacHandler,msCode:{},instId:{},jarVersion:{}", tacInst.getMsCode(), instId, tacInst.getJarVersion()); if (bytes == null || StringUtils.isEmpty(tacInstanceInfo.getJarVersion())) { throw new IllegalStateException("can't get jar file . instId:" + tacInst.getId()); } localMsInstFileService.saveInstanceFile(tacInst, bytes); Class<TacHandler> clazz = codeLoadService.loadHandlerClass(instId, TacHandler.class); if (clazz == null) { LOGGER.error("can't find the calss {} from source. instId:{}", TacHandler.class.getCanonicalName(), instId); throw new IllegalStateException("can't find the TacHandler.calss from source. instId:" + tacInst.getId()); } TacHandler tacHandler = clazz.newInstance(); LOGGER.info( "InitializingHandler init class : " + tacHandler.getClass() + " , isInit :" + InitializingHandler.class .isAssignableFrom(tacHandler.getClass())); if (InitializingHandler.class.isAssignableFrom(tacHandler.getClass())) { InitializingHandler initializingHandler = (InitializingHandler)tacHandler; LOGGER.info("InitializingHandler init : " + initializingHandler.getClass()); initializingHandler.afterPropertiesSet(); } tacInstanceInfo.setTacHandler(tacHandler); LOGGER.info("TacInstanceLoader.loadTacHandler,instId {} end ..", instId); return tacInstanceInfo; } }
TacInstanceLoadService { public TacInstanceInfo loadTacHandler(TacInst tacInst) throws Exception { LOGGER.info("TacInstanceLoader.loadTacHandler start,tacMs:{}", tacInst); if (tacInst == null) { return null; } TacInstanceInfo tacInstanceInfo = new TacInstanceInfo(); long instId = tacInst.getId(); byte[] bytes = remoteMsInstFileService.getInstanceFile(tacInst.getId()); tacInstanceInfo.setJarVersion(tacInst.getJarVersion()); tacInstanceInfo.setId(instId); LOGGER.info("TacInstanceLoader.loadTacHandler,msCode:{},instId:{},jarVersion:{}", tacInst.getMsCode(), instId, tacInst.getJarVersion()); if (bytes == null || StringUtils.isEmpty(tacInstanceInfo.getJarVersion())) { throw new IllegalStateException("can't get jar file . instId:" + tacInst.getId()); } localMsInstFileService.saveInstanceFile(tacInst, bytes); Class<TacHandler> clazz = codeLoadService.loadHandlerClass(instId, TacHandler.class); if (clazz == null) { LOGGER.error("can't find the calss {} from source. instId:{}", TacHandler.class.getCanonicalName(), instId); throw new IllegalStateException("can't find the TacHandler.calss from source. instId:" + tacInst.getId()); } TacHandler tacHandler = clazz.newInstance(); LOGGER.info( "InitializingHandler init class : " + tacHandler.getClass() + " , isInit :" + InitializingHandler.class .isAssignableFrom(tacHandler.getClass())); if (InitializingHandler.class.isAssignableFrom(tacHandler.getClass())) { InitializingHandler initializingHandler = (InitializingHandler)tacHandler; LOGGER.info("InitializingHandler init : " + initializingHandler.getClass()); initializingHandler.afterPropertiesSet(); } tacInstanceInfo.setTacHandler(tacHandler); LOGGER.info("TacInstanceLoader.loadTacHandler,instId {} end ..", instId); return tacInstanceInfo; }  }
TacInstanceLoadService { public TacInstanceInfo loadTacHandler(TacInst tacInst) throws Exception { LOGGER.info("TacInstanceLoader.loadTacHandler start,tacMs:{}", tacInst); if (tacInst == null) { return null; } TacInstanceInfo tacInstanceInfo = new TacInstanceInfo(); long instId = tacInst.getId(); byte[] bytes = remoteMsInstFileService.getInstanceFile(tacInst.getId()); tacInstanceInfo.setJarVersion(tacInst.getJarVersion()); tacInstanceInfo.setId(instId); LOGGER.info("TacInstanceLoader.loadTacHandler,msCode:{},instId:{},jarVersion:{}", tacInst.getMsCode(), instId, tacInst.getJarVersion()); if (bytes == null || StringUtils.isEmpty(tacInstanceInfo.getJarVersion())) { throw new IllegalStateException("can't get jar file . instId:" + tacInst.getId()); } localMsInstFileService.saveInstanceFile(tacInst, bytes); Class<TacHandler> clazz = codeLoadService.loadHandlerClass(instId, TacHandler.class); if (clazz == null) { LOGGER.error("can't find the calss {} from source. instId:{}", TacHandler.class.getCanonicalName(), instId); throw new IllegalStateException("can't find the TacHandler.calss from source. instId:" + tacInst.getId()); } TacHandler tacHandler = clazz.newInstance(); LOGGER.info( "InitializingHandler init class : " + tacHandler.getClass() + " , isInit :" + InitializingHandler.class .isAssignableFrom(tacHandler.getClass())); if (InitializingHandler.class.isAssignableFrom(tacHandler.getClass())) { InitializingHandler initializingHandler = (InitializingHandler)tacHandler; LOGGER.info("InitializingHandler init : " + initializingHandler.getClass()); initializingHandler.afterPropertiesSet(); } tacInstanceInfo.setTacHandler(tacHandler); LOGGER.info("TacInstanceLoader.loadTacHandler,instId {} end ..", instId); return tacInstanceInfo; }  TacInstanceInfo loadTacHandler(TacInst tacInst); }
TacInstanceLoadService { public TacInstanceInfo loadTacHandler(TacInst tacInst) throws Exception { LOGGER.info("TacInstanceLoader.loadTacHandler start,tacMs:{}", tacInst); if (tacInst == null) { return null; } TacInstanceInfo tacInstanceInfo = new TacInstanceInfo(); long instId = tacInst.getId(); byte[] bytes = remoteMsInstFileService.getInstanceFile(tacInst.getId()); tacInstanceInfo.setJarVersion(tacInst.getJarVersion()); tacInstanceInfo.setId(instId); LOGGER.info("TacInstanceLoader.loadTacHandler,msCode:{},instId:{},jarVersion:{}", tacInst.getMsCode(), instId, tacInst.getJarVersion()); if (bytes == null || StringUtils.isEmpty(tacInstanceInfo.getJarVersion())) { throw new IllegalStateException("can't get jar file . instId:" + tacInst.getId()); } localMsInstFileService.saveInstanceFile(tacInst, bytes); Class<TacHandler> clazz = codeLoadService.loadHandlerClass(instId, TacHandler.class); if (clazz == null) { LOGGER.error("can't find the calss {} from source. instId:{}", TacHandler.class.getCanonicalName(), instId); throw new IllegalStateException("can't find the TacHandler.calss from source. instId:" + tacInst.getId()); } TacHandler tacHandler = clazz.newInstance(); LOGGER.info( "InitializingHandler init class : " + tacHandler.getClass() + " , isInit :" + InitializingHandler.class .isAssignableFrom(tacHandler.getClass())); if (InitializingHandler.class.isAssignableFrom(tacHandler.getClass())) { InitializingHandler initializingHandler = (InitializingHandler)tacHandler; LOGGER.info("InitializingHandler init : " + initializingHandler.getClass()); initializingHandler.afterPropertiesSet(); } tacInstanceInfo.setTacHandler(tacHandler); LOGGER.info("TacInstanceLoader.loadTacHandler,instId {} end ..", instId); return tacInstanceInfo; }  TacInstanceInfo loadTacHandler(TacInst tacInst);  }