diff --git a/pom.xml b/pom.xml index 42a69a7f1..7ebe85026 100644 --- a/pom.xml +++ b/pom.xml @@ -572,6 +572,45 @@ + + + antcode-release + + + maven-release + antcode maven release + http://mvn.test.alipay.net/artifactory/content/repositories/maven-release/ + + + maven-release + antcode maven snapshot + http://mvn.test.alipay.net/artifactory/content/repositories/maven-snapshot/ + + + + + + alipay-dev + + + nexus-server@alipay-dev + alipay dev Repository + http://mvn.dev.alipay.net/artifactory/content/repositories/middleware + + + + + + alipay-release + + + nexus-server@alipay-release + alipay release Repository + http://mvn.test.alipay.net/artifactory/content/repositories/middleware + + + + diff --git a/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/lease/AbstractRaftEnabledLeaseManager.java b/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/lease/AbstractRaftEnabledLeaseManager.java index 9b2a2d206..9e5b8d684 100644 --- a/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/lease/AbstractRaftEnabledLeaseManager.java +++ b/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/lease/AbstractRaftEnabledLeaseManager.java @@ -189,7 +189,7 @@ public void refreshEpoch(long newEpoch) { } protected LeaseManager getLeaseManager() { - if(isRaftLeader()) { + if (isRaftLeader()) { return getLocalLeaseManager(); } else { return getRaftLeaseManager(); diff --git a/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/slot/impl/DefaultSlotManager.java b/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/slot/impl/DefaultSlotManager.java index ef41ca4ae..3e21978a0 100644 --- a/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/slot/impl/DefaultSlotManager.java +++ b/server/server/meta/src/main/java/com/alipay/sofa/registry/server/meta/slot/impl/DefaultSlotManager.java @@ -278,7 +278,7 @@ abstract SlotPeriodCheckType action(ArrangeTaskExecutor arrangeTaskExecutor, } private SlotManager getSlotManager() { - if(isRaftLeader()) { + if (isRaftLeader()) { return localSlotManager; } else { return raftSlotManager; diff --git a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/store/AbstractDataManager.java b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/store/AbstractDataManager.java index f2c4455fe..0aaaedb51 100644 --- a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/store/AbstractDataManager.java +++ b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/store/AbstractDataManager.java @@ -113,7 +113,7 @@ public Collection getDatas(String dataInfoId) { @Override public Map> getDatas() { - return StoreHelpers.copyMap((Map)stores); + return StoreHelpers.copyMap((Map) stores); } @Override diff --git a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/store/SessionInterests.java b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/store/SessionInterests.java index 4e9171892..0f3b2b52b 100644 --- a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/store/SessionInterests.java +++ b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/store/SessionInterests.java @@ -197,7 +197,7 @@ public Map> querySubscriberIndex(Stri try { Map> map = resultIndex.get(subscriberResult); if (!MapUtils.isEmpty(map)) { - return StoreHelpers.copyMap((Map)map); + return StoreHelpers.copyMap((Map) map); } else { return Collections.emptyMap(); } @@ -232,7 +232,7 @@ public boolean deleteReSubscriber(Subscriber subscriber) { @Override public Map> getReSubscribers() { - return StoreHelpers.copyMap((Map)stopPushInterests); + return StoreHelpers.copyMap((Map) stopPushInterests); } @Override diff --git a/server/server/session/src/test/java/com/alipay/sofa/registry/server/session/store/DataCacheTest.java b/server/server/session/src/test/java/com/alipay/sofa/registry/server/session/store/DataCacheTest.java index 7adea2f22..fb3933107 100644 --- a/server/server/session/src/test/java/com/alipay/sofa/registry/server/session/store/DataCacheTest.java +++ b/server/server/session/src/test/java/com/alipay/sofa/registry/server/session/store/DataCacheTest.java @@ -474,8 +474,10 @@ public void testSubAndClientOffUnorder() { sessionInterests.deleteByConnectId(ConnectId.parse(subscriber1.getSourceAddress() .getAddressString() + "_" + subscriber1.getTargetAddress().getAddressString())); - Assert.assertEquals(sessionInterests.queryByConnectId(ConnectId - .parse("192.168.1.1:12345_192.168.1.2:9600")).isEmpty(), true); + Assert.assertEquals( + sessionInterests + .queryByConnectId(ConnectId.parse("192.168.1.1:12345_192.168.1.2:9600")).isEmpty(), + true); Assert.assertEquals( sessionInterests .queryByConnectId(ConnectId.parse("192.168.1.1:12346_192.168.1.2:9600")).size(), 1); diff --git a/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/remoting/ServerSideExchanger.java b/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/remoting/ServerSideExchanger.java index 594a4a417..d21e10dea 100644 --- a/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/remoting/ServerSideExchanger.java +++ b/server/server/shared/src/main/java/com/alipay/sofa/registry/server/shared/remoting/ServerSideExchanger.java @@ -46,21 +46,30 @@ public abstract class ServerSideExchanger implements NodeExchanger { @Override public Response request(Request request) throws RequestException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("serverPort={} to client, url:{}, request body:{} ", getServerPort(), request.getRequestUrl(), - request.getRequestBody()); - } final URL url = request.getRequestUrl(); if (url == null) { throw new RequestException("null url", request); } + return request(url, request); + } + + public Response request(URL url, Request request) throws RequestException { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("serverPort={} to client, url:{}, request body:{} ", getServerPort(), request.getRequestUrl(), + request.getRequestBody()); + } final Server server = boltExchange.getServer(getServerPort()); if (server == null) { throw new RequestException("no server for " + getServerPort(), request); } final int timeout = request.getTimeout() != null ? request.getTimeout() : getRpcTimeout(); + Channel channel = null; + if (url == null) { + channel = choseChannel(server); + } else { + channel = server.getChannel(url); + } - Channel channel = server.getChannel(url); if (channel == null || !channel.isConnected()) { throw new RequestException(getServerPort() + ", get channel error! channel with url:" + url + " can not be null or disconnected!", request); @@ -78,13 +87,8 @@ public Response request(Request request) throws RequestException { } } - public Channel choseChannel() { - Server sessionServer = boltExchange.getServer(getServerPort()); - if (sessionServer == null) { - return null; - - } - Collection channels = sessionServer.getChannels(); + private Channel choseChannel(Server server) { + Collection channels = server.getChannels(); Optional channelOptional = CollectionUtils.getRandom(channels); if (channelOptional.isPresent()) { Channel channel = channelOptional.get();