Skip to content

Commit

Permalink
Merge pull request #35 from fanpan26/master
Browse files Browse the repository at this point in the history
修复若干BUG
  • Loading branch information
tywo45 authored Sep 19, 2019
2 parents d65c1b4 + 7e2e3af commit 4bf52dd
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,25 @@ public class TioServerAutoConfiguration {
@Autowired(required = false)
private RedissonTioClusterTopic redissonTioClusterTopic;


private static TioServerBootstrap tioServerBootstrap;
/**
* Tio Server bootstrap
* */
@Bean
public TioServerBootstrap webSocketServerBootstrap() {
return new TioServerBootstrap(
serverProperties,
clusterProperties,
serverSslProperties,
redissonTioClusterTopic,
ipStatListener,
groupListener,
serverAioHandler,
serverAioListener);
if(tioServerBootstrap == null) {
tioServerBootstrap = new TioServerBootstrap(
serverProperties,
clusterProperties,
serverSslProperties,
redissonTioClusterTopic,
ipStatListener,
groupListener,
serverAioHandler,
serverAioListener);
}
return tioServerBootstrap;
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ recommend that a file or class name and description of purpose be included on
public class TioServerMarkerConfiguration {

@Bean
public Marker tioWebSocketServerMarkBean() {
public Marker tioServerMarkBean() {
return new Marker();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ recommend that a file or class name and description of purpose be included on

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
Expand Down Expand Up @@ -262,30 +263,36 @@ public class TioWebSocketServerAutoConfiguration {
@Autowired(required = false)
private TioWebSocketClassScanner tioWebSocketClassScanner;


private static TioWebSocketServerBootstrap tioWebSocketServerBootstrap;
/**
* Tio WebSocket Server bootstrap
* */
@Bean
public TioWebSocketServerBootstrap webSocketServerBootstrap() {
return new TioWebSocketServerBootstrap(serverProperties,
clusterProperties,
serverSslProperties,
redissonTioClusterTopic,
tioWebSocketMsgHandler,
tioWebSocketIpStatListener,
tioWebSocketGroupListener,
tioWebSocketServerAioListener,
tioWebSocketClassScanner);
public TioWebSocketServerBootstrap wsServerBootstrap() {
if (tioWebSocketServerBootstrap == null) {
tioWebSocketServerBootstrap = new TioWebSocketServerBootstrap(serverProperties,
clusterProperties,
serverSslProperties,
redissonTioClusterTopic,
tioWebSocketMsgHandler,
tioWebSocketIpStatListener,
tioWebSocketGroupListener,
tioWebSocketServerAioListener,
tioWebSocketClassScanner);
}
return tioWebSocketServerBootstrap;

}

@Bean
public ServerTioConfig serverTioConfig(TioWebSocketServerBootstrap bootstrap){
public ServerTioConfig wsServerTioConfig(TioWebSocketServerBootstrap bootstrap){
return bootstrap.getServerTioConfig();
}

@Bean(destroyMethod="shutdown")
@ConditionalOnProperty(value = "tio.websocket.cluster.enabled",havingValue = "true",matchIfMissing = true)
public RedisInitializer redisInitializer(ApplicationContext applicationContext) {
public RedisInitializer wsRedisInitializer(ApplicationContext applicationContext) {
return new RedisInitializer(redisConfig, applicationContext);
}

Expand All @@ -295,7 +302,7 @@ public RedisInitializer redisInitializer(ApplicationContext applicationContext)
* */
@Bean
@ConditionalOnBean(RedisInitializer.class)
public RedissonTioClusterTopic redissonTioClusterTopic(RedisInitializer redisInitializer) {
public RedissonTioClusterTopic wsRedissonTioClusterTopic(RedisInitializer redisInitializer) {
return new RedissonTioClusterTopic(CLUSTER_TOPIC_CHANNEL,redisInitializer.getRedissonClient());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ public final class TioWebSocketServerBootstrap {

private static final String GROUP_CONTEXT_NAME = "tio-websocket-spring-boot-starter";

private static final boolean started = false;

private TioWebSocketServerProperties serverProperties;
private TioWebSocketServerClusterProperties clusterProperties;
private TioWebSocketServerSslProperties serverSslProperties;
Expand Down Expand Up @@ -249,9 +251,6 @@ public TioWebSocketServerBootstrap(TioWebSocketServerProperties serverProperties
this.serverSslProperties = serverSslProperties;

logger.debug(serverSslProperties.toString());
if (redissonTioClusterTopic == null) {
logger.info("cluster mod closed");
}
this.redissonTioClusterTopic = redissonTioClusterTopic;

// IWsMsgHandler bean not found
Expand Down

0 comments on commit 4bf52dd

Please sign in to comment.