This repository has been archived by the owner on May 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Ref T10114 Test Plan: N/A Reviewers: sunweijie, cailiuyang, laiyingchun Reviewed By: laiyingchun Subscribers: #pegasus Maniphest Tasks: T10114 Differential Revision: https://phabricator.d.xiaomi.net/D88948
- Loading branch information
Showing
3 changed files
with
14 additions
and
2 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
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 |
---|---|---|
|
@@ -25,6 +25,8 @@ | |
* Created by [email protected] on 16-11-11. | ||
*/ | ||
public class ClusterManager extends Cluster { | ||
private static final Logger logger = org.slf4j.LoggerFactory.getLogger(ClusterManager.class); | ||
|
||
private int operationTimeout; | ||
private int retryDelay; | ||
private boolean enableCounter; | ||
|
@@ -33,13 +35,12 @@ public class ClusterManager extends Cluster { | |
private EventLoopGroup metaGroup; // group used for handle meta logic | ||
private EventLoopGroup replicaGroup; // group used for handle io with replica servers | ||
private EventLoopGroup tableGroup; // group used for handle table logic | ||
private String[] metaList; | ||
private MetaSession metaSession; | ||
|
||
private static final Logger logger; | ||
private static final String osName; | ||
private static final String Linux = "Linux"; | ||
static { | ||
logger = org.slf4j.LoggerFactory.getLogger(ClusterManager.class); | ||
Properties p = System.getProperties(); | ||
osName = p.getProperty("os.name"); | ||
logger.info("operating system name: {}", osName); | ||
|
@@ -63,6 +64,7 @@ public ClusterManager( | |
metaGroup = getEventLoopGroupInstance(1); | ||
tableGroup = getEventLoopGroupInstance(1); | ||
|
||
metaList = address_list; | ||
// the constructor of meta session is depend on the replicaSessions, | ||
// so the replicaSessions should be initialized earlier | ||
metaSession = new MetaSession(this, address_list, timeout, 10, metaGroup); | ||
|
@@ -125,6 +127,9 @@ public static Class getSocketChannelClass() { | |
return NioSocketChannel.class; | ||
} | ||
|
||
@Override | ||
public String[] getMetaList() { return metaList; } | ||
|
||
@Override | ||
public TableHandler openTable(String name, KeyHasher h) throws ReplicationException { | ||
return new TableHandler(this, name, h); | ||
|
@@ -165,5 +170,7 @@ public void close() { | |
} catch (Exception ex) { | ||
logger.warn("close table group failed: ", ex); | ||
} | ||
|
||
logger.info("cluster manager has closed"); | ||
} | ||
} |