优化命名
This commit is contained in:
@@ -31,7 +31,7 @@ import org.redkale.mq.*;
|
|||||||
import org.redkale.net.*;
|
import org.redkale.net.*;
|
||||||
import org.redkale.net.http.*;
|
import org.redkale.net.http.*;
|
||||||
import org.redkale.net.sncp.*;
|
import org.redkale.net.sncp.*;
|
||||||
import org.redkale.scheduling.ScheduledFactory;
|
import org.redkale.scheduling.ScheduleFactory;
|
||||||
import org.redkale.service.Service;
|
import org.redkale.service.Service;
|
||||||
import org.redkale.source.*;
|
import org.redkale.source.*;
|
||||||
import org.redkale.util.*;
|
import org.redkale.util.*;
|
||||||
@@ -209,7 +209,7 @@ public final class Application {
|
|||||||
final ResourceFactory resourceFactory = ResourceFactory.create();
|
final ResourceFactory resourceFactory = ResourceFactory.create();
|
||||||
|
|
||||||
//全局ScheduledFactory
|
//全局ScheduledFactory
|
||||||
private final ScheduledFactory scheduledFactory;
|
private final ScheduleFactory scheduledFactory;
|
||||||
|
|
||||||
//服务配置项
|
//服务配置项
|
||||||
final AnyValue config;
|
final AnyValue config;
|
||||||
@@ -626,7 +626,7 @@ public final class Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{ //设置ScheduledFactory
|
{ //设置ScheduledFactory
|
||||||
this.scheduledFactory = ScheduledFactory.create(this::getPropertyValue).disable(isCompileMode());
|
this.scheduledFactory = ScheduleFactory.create(this::getPropertyValue).disable(isCompileMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
{ //加载原生sql解析器
|
{ //加载原生sql解析器
|
||||||
|
|||||||
@@ -11,17 +11,17 @@ import org.redkale.source.CacheSource;
|
|||||||
*
|
*
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
public class CachedFactory {
|
public class CacheFactory {
|
||||||
|
|
||||||
protected CacheSource localSource = new CacheMemorySource("cacheing");
|
protected CacheSource localSource = new CacheMemorySource("caching");
|
||||||
|
|
||||||
protected CacheSource remoteSource;
|
protected CacheSource remoteSource;
|
||||||
|
|
||||||
protected CachedFactory(CacheSource remoteSource) {
|
protected CacheFactory(CacheSource remoteSource) {
|
||||||
this.remoteSource = remoteSource;
|
this.remoteSource = remoteSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CachedFactory create(CacheSource remoteSource) {
|
public static CacheFactory create(CacheSource remoteSource) {
|
||||||
return new CachedFactory(remoteSource);
|
return new CacheFactory(remoteSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ import org.redkale.annotation.Scheduling;
|
|||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*/
|
*/
|
||||||
public class ScheduledFactory {
|
public class ScheduleFactory {
|
||||||
|
|
||||||
protected final Logger logger = Logger.getLogger(this.getClass().getSimpleName());
|
protected final Logger logger = Logger.getLogger(this.getClass().getSimpleName());
|
||||||
|
|
||||||
@@ -55,17 +55,17 @@ public class ScheduledFactory {
|
|||||||
|
|
||||||
private boolean disable;
|
private boolean disable;
|
||||||
|
|
||||||
protected ScheduledFactory(UnaryOperator<String> propertyFunc) {
|
protected ScheduleFactory(UnaryOperator<String> propertyFunc) {
|
||||||
this.propertyFunc = propertyFunc;
|
this.propertyFunc = propertyFunc;
|
||||||
this.scheduler = new ScheduledThreadPoolExecutor(Utility.cpus(), Utility.newThreadFactory("Scheduled-Task-Thread-%s"));
|
this.scheduler = new ScheduledThreadPoolExecutor(Utility.cpus(), Utility.newThreadFactory("Scheduled-Task-Thread-%s"));
|
||||||
this.scheduler.setRemoveOnCancelPolicy(true);
|
this.scheduler.setRemoveOnCancelPolicy(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ScheduledFactory create(UnaryOperator<String> propertyFunc) {
|
public static ScheduleFactory create(UnaryOperator<String> propertyFunc) {
|
||||||
return new ScheduledFactory(propertyFunc);
|
return new ScheduleFactory(propertyFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScheduledFactory disable(boolean val) {
|
public ScheduleFactory disable(boolean val) {
|
||||||
this.disable = val;
|
this.disable = val;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
package org.redkale.test.scheduling;
|
package org.redkale.test.scheduling;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.redkale.scheduling.ScheduledFactory;
|
import org.redkale.scheduling.ScheduleFactory;
|
||||||
import org.redkale.util.Utility;
|
import org.redkale.util.Utility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,7 +20,7 @@ public class ScheduleTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
ScheduledFactory factory = ScheduledFactory.create(null);
|
ScheduleFactory factory = ScheduleFactory.create(null);
|
||||||
ScheduleService service = new ScheduleService();
|
ScheduleService service = new ScheduleService();
|
||||||
factory.schedule(service);
|
factory.schedule(service);
|
||||||
Utility.sleep(3000);
|
Utility.sleep(3000);
|
||||||
|
|||||||
Reference in New Issue
Block a user