Skip to content

Commit

Permalink
https://github.com/mrniko/redisson/pull/244
Browse files Browse the repository at this point in the history
Non-functional; rename config and connection manager class names
  • Loading branch information
scubasau committed Sep 14, 2015
1 parent ad24fed commit 985499b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
34 changes: 17 additions & 17 deletions src/main/java/org/redisson/Config.java
Expand Up @@ -34,7 +34,7 @@ public class Config {

private ClusterServersConfig clusterServersConfig;

private ElasticacheReplicationGroupServersConfig elasticacheReplicationGroupServersConfig;
private ElasticacheServersConfig elasticacheServersConfig;

/**
* Threads amount shared between all redis node clients
Expand Down Expand Up @@ -73,8 +73,8 @@ public Config() {
if (oldConf.getClusterServersConfig() != null ) {
setClusterServersConfig(new ClusterServersConfig(oldConf.getClusterServersConfig()));
}
if (oldConf.getElasticacheReplicationGroupServersConfig() != null) {
setElasticacheReplicationGroupServersConfig(new ElasticacheReplicationGroupServersConfig(oldConf.getElasticacheReplicationGroupServersConfig()));
if (oldConf.getElasticacheServersConfig() != null) {
setElasticacheServersConfig(new ElasticacheServersConfig(oldConf.getElasticacheServersConfig()));
}

}
Expand All @@ -97,7 +97,7 @@ public ClusterServersConfig useClusterServers() {
checkMasterSlaveServersConfig();
checkSentinelServersConfig();
checkSingleServerConfig();
checkElasticacheReplicationGroupServersConfig();
checkElasticacheServersConfig();

if (clusterServersConfig == null) {
clusterServersConfig = new ClusterServersConfig();
Expand All @@ -112,30 +112,30 @@ void setClusterServersConfig(ClusterServersConfig clusterServersConfig) {
this.clusterServersConfig = clusterServersConfig;
}

public ElasticacheReplicationGroupServersConfig useElasticacheReplicationGroupServers() {
public ElasticacheServersConfig useElasticacheServers() {
checkClusterServersConfig();
checkMasterSlaveServersConfig();
checkSentinelServersConfig();
checkSingleServerConfig();

if (elasticacheReplicationGroupServersConfig == null) {
elasticacheReplicationGroupServersConfig = new ElasticacheReplicationGroupServersConfig();
if (elasticacheServersConfig == null) {
elasticacheServersConfig = new ElasticacheServersConfig();
}
return elasticacheReplicationGroupServersConfig;
return elasticacheServersConfig;
}

ElasticacheReplicationGroupServersConfig getElasticacheReplicationGroupServersConfig() {
return elasticacheReplicationGroupServersConfig;
ElasticacheServersConfig getElasticacheServersConfig() {
return elasticacheServersConfig;
}
void setElasticacheReplicationGroupServersConfig(ElasticacheReplicationGroupServersConfig elasticacheReplicationGroupServersConfig) {
this.elasticacheReplicationGroupServersConfig = elasticacheReplicationGroupServersConfig;
void setElasticacheServersConfig(ElasticacheServersConfig elasticacheServersConfig) {
this.elasticacheServersConfig = elasticacheServersConfig;
}

public SingleServerConfig useSingleServer() {
checkClusterServersConfig();
checkMasterSlaveServersConfig();
checkSentinelServersConfig();
checkElasticacheReplicationGroupServersConfig();
checkElasticacheServersConfig();

if (singleServerConfig == null) {
singleServerConfig = new SingleServerConfig();
Expand All @@ -154,7 +154,7 @@ public SentinelServersConfig useSentinelConnection() {
checkClusterServersConfig();
checkSingleServerConfig();
checkMasterSlaveServersConfig();
checkElasticacheReplicationGroupServersConfig();
checkElasticacheServersConfig();

if (sentinelServersConfig == null) {
sentinelServersConfig = new SentinelServersConfig();
Expand All @@ -173,7 +173,7 @@ public MasterSlaveServersConfig useMasterSlaveConnection() {
checkClusterServersConfig();
checkSingleServerConfig();
checkSentinelServersConfig();
checkElasticacheReplicationGroupServersConfig();
checkElasticacheServersConfig();

if (masterSlaveServersConfig == null) {
masterSlaveServersConfig = new MasterSlaveServersConfig();
Expand Down Expand Up @@ -224,8 +224,8 @@ private void checkSingleServerConfig() {
}
}

private void checkElasticacheReplicationGroupServersConfig() {
if (elasticacheReplicationGroupServersConfig != null) {
private void checkElasticacheServersConfig() {
if (elasticacheServersConfig != null) {
throw new IllegalStateException("elasticache replication group servers config already used!");
}
}
Expand Down
Expand Up @@ -27,7 +27,7 @@
*
* @author Steve Ungerer
*/
public class ElasticacheReplicationGroupServersConfig extends BaseMasterSlaveServersConfig<ElasticacheReplicationGroupServersConfig> {
public class ElasticacheServersConfig extends BaseMasterSlaveServersConfig<ElasticacheServersConfig> {

/**
* Replication group node urls list
Expand All @@ -39,10 +39,10 @@ public class ElasticacheReplicationGroupServersConfig extends BaseMasterSlaveSer
*/
private int scanInterval = 1000;

public ElasticacheReplicationGroupServersConfig() {
public ElasticacheServersConfig() {
}

ElasticacheReplicationGroupServersConfig(ElasticacheReplicationGroupServersConfig config) {
ElasticacheServersConfig(ElasticacheServersConfig config) {
super(config);
setNodeAddresses(config.getNodeAddresses());
setScanInterval(config.getScanInterval());
Expand All @@ -54,7 +54,7 @@ public ElasticacheReplicationGroupServersConfig() {
* @param addresses in <code>host:port</code> format
* @return
*/
public ElasticacheReplicationGroupServersConfig addNodeAddress(String ... addresses) {
public ElasticacheServersConfig addNodeAddress(String ... addresses) {
for (String address : addresses) {
nodeAddresses.add(URIBuilder.create(address));
}
Expand All @@ -76,7 +76,7 @@ public int getScanInterval() {
* @param scanInterval in milliseconds
* @return
*/
public ElasticacheReplicationGroupServersConfig setScanInterval(int scanInterval) {
public ElasticacheServersConfig setScanInterval(int scanInterval) {
this.scanInterval = scanInterval;
return this;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/redisson/Redisson.java
Expand Up @@ -25,7 +25,7 @@
import org.redisson.client.protocol.RedisCommands;
import org.redisson.connection.ClusterConnectionManager;
import org.redisson.connection.ConnectionManager;
import org.redisson.connection.ElasticacheReplicationGroupConnectionManager;
import org.redisson.connection.ElasticacheConnectionManager;
import org.redisson.connection.MasterSlaveConnectionManager;
import org.redisson.connection.SentinelConnectionManager;
import org.redisson.connection.SingleConnectionManager;
Expand Down Expand Up @@ -79,8 +79,8 @@ public class Redisson implements RedissonClient {
connectionManager = new SentinelConnectionManager(configCopy.getSentinelServersConfig(), configCopy);
} else if (configCopy.getClusterServersConfig() != null) {
connectionManager = new ClusterConnectionManager(configCopy.getClusterServersConfig(), configCopy);
} else if (configCopy.getElasticacheReplicationGroupServersConfig() != null) {
connectionManager = new ElasticacheReplicationGroupConnectionManager(configCopy.getElasticacheReplicationGroupServersConfig(), configCopy);
} else if (configCopy.getElasticacheServersConfig() != null) {
connectionManager = new ElasticacheConnectionManager(configCopy.getElasticacheServersConfig(), configCopy);
} else {
throw new IllegalArgumentException("server(s) address(es) not defined!");
}
Expand Down
Expand Up @@ -22,7 +22,7 @@
import java.util.concurrent.atomic.AtomicReference;

import org.redisson.Config;
import org.redisson.ElasticacheReplicationGroupServersConfig;
import org.redisson.ElasticacheServersConfig;
import org.redisson.MasterSlaveServersConfig;
import org.redisson.client.RedisClient;
import org.redisson.client.RedisConnection;
Expand All @@ -42,7 +42,7 @@
*
* @author Steve Ungerer
*/
public class ElasticacheReplicationGroupConnectionManager extends MasterSlaveConnectionManager {
public class ElasticacheConnectionManager extends MasterSlaveConnectionManager {

private static final String ROLE_KEY = "role:";

Expand All @@ -59,7 +59,7 @@ private enum Role {
slave
}

public ElasticacheReplicationGroupConnectionManager(ElasticacheReplicationGroupServersConfig cfg, Config config) {
public ElasticacheConnectionManager(ElasticacheServersConfig cfg, Config config) {
init(config);

this.config = create(cfg);
Expand Down Expand Up @@ -88,7 +88,7 @@ public ElasticacheReplicationGroupConnectionManager(ElasticacheReplicationGroupS
monitorRoleChange(cfg);
}

private RedisConnection connect(ElasticacheReplicationGroupServersConfig cfg, URI addr) {
private RedisConnection connect(ElasticacheServersConfig cfg, URI addr) {
RedisConnection connection = nodeConnections.get(addr);
if (connection != null) {
return connection;
Expand All @@ -105,7 +105,7 @@ private RedisConnection connect(ElasticacheReplicationGroupServersConfig cfg, UR
return connection;
}

private void monitorRoleChange(final ElasticacheReplicationGroupServersConfig cfg) {
private void monitorRoleChange(final ElasticacheServersConfig cfg) {
monitorFuture = GlobalEventExecutor.INSTANCE.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -145,7 +145,7 @@ private Role determineRole(String data) {
throw new RedisException("Cannot determine node role from provided 'INFO replication' data");
}

private MasterSlaveServersConfig create(ElasticacheReplicationGroupServersConfig cfg) {
private MasterSlaveServersConfig create(ElasticacheServersConfig cfg) {
MasterSlaveServersConfig c = new MasterSlaveServersConfig();
c.setRetryInterval(cfg.getRetryInterval());
c.setRetryAttempts(cfg.getRetryAttempts());
Expand Down

0 comments on commit 985499b

Please sign in to comment.