From 78840476a8fdf43536f6701084c77126e1492612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9C=B0=E5=B9=B3=E7=BA=BF?= <22250530@qq.com> Date: Wed, 7 Oct 2015 11:21:08 +0800 Subject: [PATCH] --- src/com/wentch/redkale/boot/NodeServer.java | 2 +- .../wentch/redkale/service/LocalService.java | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/com/wentch/redkale/service/LocalService.java diff --git a/src/com/wentch/redkale/boot/NodeServer.java b/src/com/wentch/redkale/boot/NodeServer.java index 9d8af0b1d..df9d31f63 100644 --- a/src/com/wentch/redkale/boot/NodeServer.java +++ b/src/com/wentch/redkale/boot/NodeServer.java @@ -225,7 +225,7 @@ public abstract class NodeServer { diffGroupAddrs.forEach((k, v) -> diffGroupTransports.add(loadTransport(k, server.getProtocol(), v))); ServiceWrapper wrapper; - if ((sameGroupAddrs.isEmpty() && diffGroupAddrs.isEmpty()) || sameGroupAddrs.contains(this.sncpAddress)) { //本地模式 + if ((sameGroupAddrs.isEmpty() && diffGroupAddrs.isEmpty()) || sameGroupAddrs.contains(this.sncpAddress) || type.getAnnotation(LocalService.class) != null) { //本地模式 sameGroupAddrs.remove(this.sncpAddress); List sameGroupTransports = new ArrayList<>(); for (InetSocketAddress iaddr : sameGroupAddrs) { diff --git a/src/com/wentch/redkale/service/LocalService.java b/src/com/wentch/redkale/service/LocalService.java new file mode 100644 index 000000000..897377129 --- /dev/null +++ b/src/com/wentch/redkale/service/LocalService.java @@ -0,0 +1,22 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.wentch.redkale.service; + +import java.lang.annotation.*; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * + * @author zhangjx + */ +@Inherited +@Documented +@Target({TYPE}) +@Retention(RUNTIME) +public @interface LocalService { + +}