-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hugoDD
committed
Jun 12, 2018
1 parent
ab39d77
commit bb45c88
Showing
5 changed files
with
99 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
rains-redisproxy-net/src/main/java/com/rains/proxy/net/service/InitService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.rains.proxy.net.service; | ||
|
||
/** | ||
* Created by yuliang on 2017/4/12. | ||
*/ | ||
|
||
public interface InitService { | ||
|
||
|
||
/** | ||
* 服务启动 | ||
*/ | ||
void start(); | ||
|
||
/** | ||
* 服务关闭 | ||
*/ | ||
void close(); | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
rains-redisproxy-net/src/main/java/com/rains/proxy/net/service/impl/InitServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.rains.proxy.net.service.impl; | ||
|
||
import com.rains.proxy.core.bean.RedisServerMasterCluster; | ||
import com.rains.proxy.net.model.Server; | ||
import com.rains.proxy.net.server.RedisProxyServer; | ||
import com.rains.proxy.net.service.InitService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Lazy; | ||
import org.springframework.stereotype.Service; | ||
|
||
import javax.annotation.PostConstruct; | ||
import javax.annotation.PreDestroy; | ||
|
||
/** | ||
* create by lorne on 2017/9/20 | ||
*/ | ||
@Service | ||
@Lazy(false) | ||
public class InitServiceImpl implements InitService { | ||
|
||
@Autowired | ||
private RedisServerMasterCluster redisServerMasterCluster; | ||
|
||
// @Autowired | ||
// private NettyServerService nettyServerService; | ||
|
||
private RedisProxyServer ffanRedisServer; | ||
|
||
@Autowired | ||
private Server serverConfig; | ||
|
||
@PostConstruct | ||
public void init(){ | ||
start(); | ||
} | ||
|
||
@PreDestroy | ||
public void destroy(){ | ||
close(); | ||
} | ||
|
||
|
||
@Override | ||
public void start() { | ||
// nettyServerService.start(); | ||
// SocketManager.getInstance().setMaxConnection(serverConfig.getMaxCount()); | ||
|
||
ffanRedisServer=new RedisProxyServer(redisServerMasterCluster); | ||
|
||
ffanRedisServer.start(); | ||
} | ||
|
||
|
||
@Override | ||
public void close() { | ||
ffanRedisServer.destroy(); | ||
// nettyServerService.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters