提交 c8b0c1f1 编写于 作者: B Baoqi Wu 提交者: qiaozhanwei

make combined server works in new dev-db branch (#1257)

上级 ef86be2d
......@@ -24,11 +24,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@ServletComponentScan
@ComponentScan("org.apache.dolphinscheduler")
@Import({MasterServer.class, WorkerServer.class})
@EnableSwagger2
public class CombinedApplicationServer extends SpringBootServletInitializer {
......@@ -36,10 +38,6 @@ public class CombinedApplicationServer extends SpringBootServletInitializer {
ApiApplicationServer.main(args);
MasterServer.main(args);
WorkerServer.main(args);
LoggerServer server = new LoggerServer();
server.start();
......
logging.config=classpath:combined_logback.xml
# server port
server.port=12345
# session config
server.servlet.session.timeout=7200
server.servlet.context-path=/dolphinscheduler/
# file size limit for upload
spring.servlet.multipart.max-file-size=1024MB
spring.servlet.multipart.max-request-size=1024MB
#post content
server.jetty.max-http-post-size=5000000
spring.messages.encoding=UTF-8
#i18n classpath folder , file prefix messages, if have many files, use "," seperator
spring.messages.basename=i18n/messages
server.is-combined-server=true
......@@ -42,6 +42,7 @@ import org.apache.dolphinscheduler.server.zk.ZKWorkerClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.ComponentScan;
......@@ -114,6 +115,12 @@ public class WorkerServer extends AbstractServer {
*/
private CountDownLatch latch;
/**
* If inside combined server, WorkerServer no need to await on CountDownLatch
*/
@Value("${server.is-combined-server:false}")
private Boolean isCombinedServer;
/**
* master server startup
*
......@@ -196,9 +203,11 @@ public class WorkerServer extends AbstractServer {
//let the main thread await
latch = new CountDownLatch(1);
try {
latch.await();
} catch (InterruptedException ignore) {
if (!isCombinedServer) {
try {
latch.await();
} catch (InterruptedException ignore) {
}
}
}
......
......@@ -54,6 +54,9 @@ elif [ "$command" = "alert-server" ]; then
CLASS=org.apache.dolphinscheduler.alert.AlertServer
elif [ "$command" = "logger-server" ]; then
CLASS=org.apache.dolphinscheduler.server.rpc.LoggerServer
elif [ "$command" = "combined-server" ]; then
LOG_FILE="-Dspring.profiles.active=combined"
CLASS=org.apache.dolphinscheduler.api.CombinedApplicationServer
else
echo "Error: No command named \`$command' was found."
exit 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册