privatevoiddoStart(String[] args, Map<String, String> envs)throws Throwable { AssertUtils.isTrue(this.bizState == BizState.RESOLVED, "BizState must be RESOLVED", newObject[0]); if (envs != null) { StringmainClassFromEnv= (String)envs.get("sofa.ark.biz.main.class"); if (mainClassFromEnv != null) { this.mainClass = mainClassFromEnv; ArkLoggerFactory.getDefaultLogger().info("Ark biz {} will start with main class {} from envs", this.getIdentity(), mainClassFromEnv); } }
if (this.mainClass == null) { thrownewArkRuntimeException(String.format("biz: %s has no main method", this.getBizName())); } else { ClassLoaderoldClassLoader= ClassLoaderUtils.pushContextClassLoader(this.classLoader); EventAdminServiceeventAdminService= (EventAdminService)ArkServiceContainerHolder.getContainer().getService(EventAdminService.class);
try { eventAdminService.sendEvent(newBeforeBizStartupEvent(this)); this.resetProperties(); if (!this.isMasterBizAndEmbedEnable()) { longstart= System.currentTimeMillis(); ArkLoggerFactory.getDefaultLogger().info("Ark biz {} start.", this.getIdentity()); MainMethodRunnermainMethodRunner=newMainMethodRunner(this.mainClass, args, envs); mainMethodRunner.run(); eventAdminService.sendEvent(newAfterBizStartupEvent(this)); ArkLoggerFactory.getDefaultLogger().info("Ark biz {} started in {} ms", this.getIdentity(), System.currentTimeMillis() - start); } } catch (Throwable var11) { this.setBizState(BizState.BROKEN, StateChangeReason.INSTALL_FAILED, getStackTraceAsString(var11)); eventAdminService.sendEvent(newAfterBizStartupFailedEvent(this, var11)); throw var11; } finally { ClassLoaderUtils.popContextClassLoader(oldClassLoader); }
BizManagerServicebizManagerService= (BizManagerService)ArkServiceContainerHolder.getContainer().getService(BizManagerService.class); if (bizManagerService.getActiveBiz(this.bizName) == null) { this.setBizState(BizState.ACTIVATED, StateChangeReason.STARTED); } else { booleanactivateMultiBizVersion= Boolean.parseBoolean(ArkConfigs.getStringValue("sofa.ark.activate.multi.biz.version.enable", "false")); if (activateMultiBizVersion) { this.setBizState(BizState.ACTIVATED, StateChangeReason.STARTED); } else { if (Boolean.getBoolean("activate.new.module")) { BizcurrentActiveBiz= bizManagerService.getActiveBiz(this.bizName); ((BizModel)currentActiveBiz).setBizState(BizState.DEACTIVATED, StateChangeReason.SWITCHED, String.format("switch to new biz %s", this.getIdentity())); this.setBizState(BizState.ACTIVATED, StateChangeReason.STARTED, String.format("switch from old biz: %s", currentActiveBiz.getIdentity())); } else { this.setBizState(BizState.DEACTIVATED, StateChangeReason.STARTED, "start but is deactivated"); }
} } } }
主要是看这个方法
1 2 3
ArkLoggerFactory.getDefaultLogger().info("Ark biz {} start.", this.getIdentity()); MainMethodRunnermainMethodRunner=newMainMethodRunner(this.mainClass, args, envs); mainMethodRunner.run();
Plugin com.alipay.sofa.koupleless:koupleless-base-build-plugin:1.4.2-SNAPSHOT or one of its dependencies could not be resolved: [ERROR] Could not find artifact com.alipay.sofa.koupleless:koupleless-base-build-plugin:jar:1.4.2-SNAPSHOT in ark-snapshot (https://oss.sonatype.org/content/repositories/snapshots)