shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.walker.tcp.support;
 
import com.walker.tcp.Connection;
 
/**
 * 简单的单引擎连接管理器实现。
 * @author 时克英
 * @date 2018-08-16
 *
 */
public class SimpleEngineConnectionManager extends AbstractConnectionManager {
 
    public SimpleEngineConnectionManager(){
        // 默认提供一个内存连接缓存实现。2023-09-19
        this.setConnectionCache(new MemoryConnectionCache());
    }
 
    @Override
    protected void onSaveConnection(Connection connection) throws Exception {
        logger.debug("保存了一个连接:" + connection.getName());
    }
 
    @Override
    protected void onDeleteConnection(int engineId, String name) throws Exception {
        logger.debug("删除了一个连接:" + name);
    }
 
    @Override
    protected void onUpdateLastTime(int engineId, String name, long lastTime) throws Exception {
        logger.debug("更新了一个连接:" + name);
    }
 
    @Override
    protected void onUpdateConnection(Connection connection) throws Exception {
        // 单机模式中,未使用该方法。
    }
 
}