Skip to content

Commit

Permalink
What type of PR is this?
Browse files Browse the repository at this point in the history
 - format
 - add release jar
  • Loading branch information
yuzhi.lyz committed Dec 21, 2020
1 parent 39954fb commit 46f6873
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 19 deletions.
39 changes: 39 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,45 @@
</pluginRepository>
</pluginRepositories>
</profile>
<!-- antcode release jar -->
<profile>
<id>antcode-release</id>
<distributionManagement>
<repository>
<id>maven-release</id>
<name>antcode maven release</name>
<url>http://mvn.test.alipay.net/artifactory/content/repositories/maven-release/</url>
</repository>
<snapshotRepository>
<id>maven-release</id>
<name>antcode maven snapshot</name>
<url>http://mvn.test.alipay.net/artifactory/content/repositories/maven-snapshot/</url>
</snapshotRepository>
</distributionManagement>
</profile>
<!-- 以下内容是配置jar包发布指定的mvn库,与上面配置不冲突 -->
<profile>
<id>alipay-dev</id>
<distributionManagement>
<repository>
<id>nexus-server@alipay-dev</id>
<name>alipay dev Repository</name>
<url>http://mvn.dev.alipay.net/artifactory/content/repositories/middleware</url>
</repository>
</distributionManagement>
</profile>

<profile>
<id>alipay-release</id>
<distributionManagement>
<repository>
<id>nexus-server@alipay-release</id>
<name>alipay release Repository</name>
<url>http://mvn.test.alipay.net/artifactory/content/repositories/middleware</url>
</repository>
</distributionManagement>
</profile>

</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void refreshEpoch(long newEpoch) {
}

protected LeaseManager<T> getLeaseManager() {
if(isRaftLeader()) {
if (isRaftLeader()) {
return getLocalLeaseManager();
} else {
return getRaftLeaseManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ abstract SlotPeriodCheckType action(ArrangeTaskExecutor arrangeTaskExecutor,
}

private SlotManager getSlotManager() {
if(isRaftLeader()) {
if (isRaftLeader()) {
return localSlotManager;
} else {
return raftSlotManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public Collection<T> getDatas(String dataInfoId) {

@Override
public Map<String, Map<String, T>> getDatas() {
return StoreHelpers.copyMap((Map)stores);
return StoreHelpers.copyMap((Map) stores);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public Map<InetSocketAddress, Map<String, Subscriber>> querySubscriberIndex(Stri
try {
Map<InetSocketAddress, Map<String, Subscriber>> map = resultIndex.get(subscriberResult);
if (!MapUtils.isEmpty(map)) {
return StoreHelpers.copyMap((Map)map);
return StoreHelpers.copyMap((Map) map);
} else {
return Collections.emptyMap();
}
Expand Down Expand Up @@ -232,7 +232,7 @@ public boolean deleteReSubscriber(Subscriber subscriber) {

@Override
public Map<String/*dataInfoId*/, Map<String/*registerId*/, Subscriber>> getReSubscribers() {
return StoreHelpers.copyMap((Map)stopPushInterests);
return StoreHelpers.copyMap((Map) stopPushInterests);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<Channel> channels = sessionServer.getChannels();
private Channel choseChannel(Server server) {
Collection<Channel> channels = server.getChannels();
Optional<Channel> channelOptional = CollectionUtils.getRandom(channels);
if (channelOptional.isPresent()) {
Channel channel = channelOptional.get();
Expand Down

0 comments on commit 46f6873

Please sign in to comment.