|
@@ -1,10 +1,12 @@
|
|
|
package cn.reghao.oss.store.config;
|
|
package cn.reghao.oss.store.config;
|
|
|
|
|
|
|
|
|
|
+import cn.reghao.jutil.jdk.thread.ThreadPoolWrapper;
|
|
|
import cn.reghao.oss.api.dto.StoreNodeDto;
|
|
import cn.reghao.oss.api.dto.StoreNodeDto;
|
|
|
import cn.reghao.oss.api.dto.disk.DiskVolume;
|
|
import cn.reghao.oss.api.dto.disk.DiskVolume;
|
|
|
import cn.reghao.oss.api.iface.StoreService;
|
|
import cn.reghao.oss.api.iface.StoreService;
|
|
|
import cn.reghao.oss.store.config.props.SpringProperties;
|
|
import cn.reghao.oss.store.config.props.SpringProperties;
|
|
|
import cn.reghao.oss.store.service.ConsoleCache;
|
|
import cn.reghao.oss.store.service.ConsoleCache;
|
|
|
|
|
+import cn.reghao.oss.store.tomcat.TomcatStarter;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.DisposableBean;
|
|
import org.springframework.beans.factory.DisposableBean;
|
|
|
import org.springframework.boot.ApplicationArguments;
|
|
import org.springframework.boot.ApplicationArguments;
|
|
@@ -12,6 +14,7 @@ import org.springframework.boot.ApplicationRunner;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author reghao
|
|
* @author reghao
|
|
@@ -23,15 +26,21 @@ public class SpringLifecycle implements ApplicationRunner, DisposableBean {
|
|
|
private final SpringProperties springProperties;
|
|
private final SpringProperties springProperties;
|
|
|
private final StoreService storeService;
|
|
private final StoreService storeService;
|
|
|
private final ConsoleCache consoleCache;
|
|
private final ConsoleCache consoleCache;
|
|
|
|
|
+ private final ExecutorService threadPool;
|
|
|
|
|
+ private final TomcatStarter tomcatStarter;
|
|
|
|
|
|
|
|
- public SpringLifecycle(SpringProperties springProperties, StoreService storeService, ConsoleCache consoleCache) {
|
|
|
|
|
|
|
+ public SpringLifecycle(SpringProperties springProperties, StoreService storeService,
|
|
|
|
|
+ ConsoleCache consoleCache, TomcatStarter tomcatStarter) {
|
|
|
this.springProperties = springProperties;
|
|
this.springProperties = springProperties;
|
|
|
this.storeService = storeService;
|
|
this.storeService = storeService;
|
|
|
this.consoleCache = consoleCache;
|
|
this.consoleCache = consoleCache;
|
|
|
|
|
+ this.threadPool = ThreadPoolWrapper.threadPool("tomcat");
|
|
|
|
|
+ this.tomcatStarter = tomcatStarter;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void run(ApplicationArguments args) {
|
|
public void run(ApplicationArguments args) {
|
|
|
|
|
+ threadPool.submit(tomcatStarter);
|
|
|
registerStoreNode();
|
|
registerStoreNode();
|
|
|
}
|
|
}
|
|
|
|
|
|