This commit is contained in:
Redkale
2017-05-30 17:12:51 +08:00
parent b2e73d378c
commit fa5bd95a2b
4 changed files with 8 additions and 5 deletions

View File

@@ -114,6 +114,9 @@ public final class Application {
//临时计数器
CountDownLatch servicecdl; //会出现两次赋值
//是否启动了WATCH协议服务
boolean watching;
//--------------------------------------------------------------------------------------------
//是否用于main方法运行
private final boolean singletonrun;
@@ -544,6 +547,7 @@ public final class Application {
others.add(entry);
}
}
this.watching = !watchs.isEmpty();
//单向SNCP服务不需要对等group
//if (!sncps.isEmpty() && globalNodes.isEmpty()) throw new RuntimeException("found SNCP Server node but not found <group> node info.");

View File

@@ -253,7 +253,7 @@ public final class ClassFilter<T> {
boolean rs = superClass == null || (clazz != superClass && superClass.isAssignableFrom(clazz));
if (rs && this.excludeSuperClasses != null && this.excludeSuperClasses.length > 0) {
for (Class c : this.excludeSuperClasses) {
if (c != null && (clazz == c || clazz.isAssignableFrom(c))) return false;
if (c != null && (clazz == c || c.isAssignableFrom(clazz))) return false;
}
}
return rs;

View File

@@ -8,7 +8,6 @@ package org.redkale.boot;
import java.lang.annotation.Annotation;
import java.lang.reflect.*;
import java.net.InetSocketAddress;
import java.nio.file.WatchService;
import java.util.*;
import java.util.logging.Level;
import javax.annotation.Resource;
@@ -57,7 +56,7 @@ public class NodeHttpServer extends NodeServer {
@Override
protected ClassFilter<Service> createServiceClassFilter() {
return createClassFilter(this.sncpGroup, null, Service.class, new Class[]{WatchService.class}, Annotation.class, "services", "service");
return createClassFilter(this.sncpGroup, null, Service.class, new Class[]{org.redkale.watch.WatchService.class}, Annotation.class, "services", "service");
}
@Override

View File

@@ -9,7 +9,7 @@ import java.io.*;
import java.lang.annotation.Annotation;
import java.lang.reflect.*;
import java.net.*;
import java.nio.file.Path;
import java.nio.file.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
@@ -509,7 +509,7 @@ public abstract class NodeServer {
}
protected ClassFilter<Service> createServiceClassFilter() {
return createClassFilter(this.sncpGroup, null, Service.class, null, Annotation.class, "services", "service");
return createClassFilter(this.sncpGroup, null, Service.class, (!isSNCP() || application.watching) ? null : new Class[]{org.redkale.watch.WatchService.class}, Annotation.class, "services", "service");
}
protected ClassFilter createClassFilter(final String localGroup, Class<? extends Annotation> ref,