feat: suit PowerJobAutoConfiguration for new properties

This commit is contained in:
tjq 2023-01-20 17:15:49 +08:00
parent 3892c38785
commit 5a14b300f9
3 changed files with 8 additions and 2 deletions

View File

@ -58,6 +58,7 @@ public class PowerJobAutoConfiguration {
*/ */
config.setAppName(worker.getAppName()); config.setAppName(worker.getAppName());
config.setServerAddress(serverAddress); config.setServerAddress(serverAddress);
config.setProtocol(worker.getProtocol());
/* /*
* For non-Map/MapReduce tasks, {@code memory} is recommended for speeding up calculation. * For non-Map/MapReduce tasks, {@code memory} is recommended for speeding up calculation.
* Map/MapReduce tasks may produce batches of subtasks, which could lead to OutOfMemory * Map/MapReduce tasks may produce batches of subtasks, which could lead to OutOfMemory
@ -82,7 +83,7 @@ public class PowerJobAutoConfiguration {
config.setHealthReportInterval(worker.getHealthReportInterval()); config.setHealthReportInterval(worker.getHealthReportInterval());
/* /*
* Create OhMyWorker object and set properties. * Create PowerJobSpringWorker object and set properties.
*/ */
return new PowerJobSpringWorker(config); return new PowerJobSpringWorker(config);
} }

View File

@ -1,6 +1,7 @@
package tech.powerjob.worker.autoconfigure; package tech.powerjob.worker.autoconfigure;
import tech.powerjob.common.RemoteConstant; import tech.powerjob.common.RemoteConstant;
import tech.powerjob.common.enums.Protocol;
import tech.powerjob.worker.common.constants.StoreStrategy; import tech.powerjob.worker.common.constants.StoreStrategy;
import tech.powerjob.worker.core.processor.ProcessResult; import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.WorkflowContext; import tech.powerjob.worker.core.processor.WorkflowContext;
@ -125,6 +126,10 @@ public class PowerJobProperties {
* </p> * </p>
*/ */
private String serverAddress; private String serverAddress;
/**
* Protocol for communication between WORKER and server
*/
private Protocol protocol = Protocol.AKKA;
/** /**
* Local store strategy for H2 database. {@code disk} or {@code memory}. * Local store strategy for H2 database. {@code disk} or {@code memory}.
*/ */

View File

@ -38,7 +38,7 @@ public class OmsJarContainer implements OmsContainer {
private OhMyClassLoader containerClassLoader; private OhMyClassLoader containerClassLoader;
private ClassPathXmlApplicationContext container; private ClassPathXmlApplicationContext container;
private Map<String, BasicProcessor> processorCache = Maps.newConcurrentMap(); private final Map<String, BasicProcessor> processorCache = Maps.newConcurrentMap();
public OmsJarContainer(Long containerId, String name, String version, File localJarFile) { public OmsJarContainer(Long containerId, String name, String version, File localJarFile) {
this.containerId = containerId; this.containerId = containerId;