-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added JavaDoc for basic JedisCluster constructors #3304
Changes from 5 commits
1f0d1e7
48dbf76
03940f1
85e5b79
49c956d
22d150c
db599ba
257d2d5
a9f2af8
3d1e455
5eeddc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -13,16 +13,37 @@ public class JedisCluster extends UnifiedJedis { | |||||||||||
* Default timeout in milliseconds. | ||||||||||||
*/ | ||||||||||||
public static final int DEFAULT_TIMEOUT = 2000; | ||||||||||||
/** | ||||||||||||
* Default amount of attemps for connecting. | ||||||||||||
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
*/ | ||||||||||||
public static final int DEFAULT_MAX_ATTEMPTS = 5; | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Creates a Jedis-Cluster Instance where only a single Host is being used as a "Cluster".<br> | ||||||||||||
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
* Here, the default Timeout of {@value #DEFAULT_TIMEOUT} ms is being used with {@value #DEFAULT_MAX_ATTEMPTS} maximum attempts. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason you prefer to use a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've history of javadoc plugins having issues with
|
||||||||||||
* @param node Host to connect to. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
*/ | ||||||||||||
public JedisCluster(HostAndPort node) { | ||||||||||||
this(Collections.singleton(node)); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Creates a Jedis-Cluster Instance where only a single Host is being used as a "Cluster".<br> | ||||||||||||
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
* Here, the default of {@value #DEFAULT_MAX_ATTEMPTS} maximum attempts is being used. | ||||||||||||
* @param node Host to connect to. | ||||||||||||
* @param timeout Timeout in milliseconds. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
*/ | ||||||||||||
public JedisCluster(HostAndPort node, int timeout) { | ||||||||||||
this(Collections.singleton(node), timeout); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Creates a Jedis-Cluster Instance where only a single Host is being used as a "Cluster".<br> | ||||||||||||
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
* You can specify the timeout and the maximum attempts. | ||||||||||||
* @param node Host to connect to. | ||||||||||||
* @param timeout Timeout in milliseconds. | ||||||||||||
* @param maxAttempts Maximum Attempts to use. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Capitilization |
||||||||||||
*/ | ||||||||||||
public JedisCluster(HostAndPort node, int timeout, int maxAttempts) { | ||||||||||||
this(Collections.singleton(node), timeout, maxAttempts); | ||||||||||||
} | ||||||||||||
|
@@ -83,14 +104,32 @@ public JedisCluster(HostAndPort node, final JedisClientConfig clientConfig, int | |||||||||||
this(Collections.singleton(node), clientConfig, maxAttempts, poolConfig); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Creates a Jedis-Cluster with multiple Nodes/Instances. | ||||||||||||
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
* Here, the default Timeout of {@value #DEFAULT_TIMEOUT} ms is being used with {@value #DEFAULT_MAX_ATTEMPTS} maximum attempts. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* @param nodes Hosts to connect to. | ||||||||||||
*/ | ||||||||||||
public JedisCluster(Set<HostAndPort> nodes) { | ||||||||||||
this(nodes, DEFAULT_TIMEOUT); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Creates a Jedis-Cluster with multiple Nodes/Instances. | ||||||||||||
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
* Here, the default of {@value #DEFAULT_MAX_ATTEMPTS} maximum attempts is being used. | ||||||||||||
* @param nodes Hosts to connect to. | ||||||||||||
* @param timeout Timeout in milliseconds. | ||||||||||||
*/ | ||||||||||||
public JedisCluster(Set<HostAndPort> nodes, int timeout) { | ||||||||||||
this(nodes, DefaultJedisClientConfig.builder().timeoutMillis(timeout).build()); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Creates a Jedis-Cluster with multiple Nodes/Instances. <br> | ||||||||||||
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
* You can specify the timeout and the maximum attempts. | ||||||||||||
* @param nodes Hosts to connect to. | ||||||||||||
* @param timeout Timeout in milliseconds. | ||||||||||||
* @param maxAttempts Maximum Attempts to use. | ||||||||||||
*/ | ||||||||||||
public JedisCluster(Set<HostAndPort> nodes, int timeout, int maxAttempts) { | ||||||||||||
this(nodes, DefaultJedisClientConfig.builder().timeoutMillis(timeout).build(), maxAttempts); | ||||||||||||
} | ||||||||||||
|
@@ -187,6 +226,18 @@ public JedisCluster(Set<HostAndPort> clusterNodes, JedisClientConfig clientConfi | |||||||||||
super(clusterNodes, clientConfig, maxAttempts); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Creates a Jedis-Cluster with multiple Nodes/Instances. <br> | ||||||||||||
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
* You can specify the timeout and the maximum attempts. <br><br> | ||||||||||||
* | ||||||||||||
* Additionally, you are free to provide a {@link JedisClientConfig} instance. <br> | ||||||||||||
* You can use the {@link DefaultJedisClientConfig#builder()} Builder-Pattern to customize your configuration, includings socketTimeouts, Username & Passwords aswell as SSL and hostnames. | ||||||||||||
sazzad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
* | ||||||||||||
* @param clusterNodes Hosts to connect to. | ||||||||||||
* @param clientConfig Timeout in milliseconds. | ||||||||||||
* @param maxAttempts Maximum Attempts to use. | ||||||||||||
* @param maxTotalRetriesDuration Maximum time used for reconnecting. | ||||||||||||
*/ | ||||||||||||
public JedisCluster(Set<HostAndPort> clusterNodes, JedisClientConfig clientConfig, int maxAttempts, | ||||||||||||
Duration maxTotalRetriesDuration) { | ||||||||||||
super(clusterNodes, clientConfig, maxAttempts, maxTotalRetriesDuration); | ||||||||||||
|
@@ -197,10 +248,22 @@ public JedisCluster(ClusterConnectionProvider provider, int maxAttempts, | |||||||||||
super(provider, maxAttempts, maxTotalRetriesDuration); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Returns all nodes that were configured to connect to in a KEY-VALUE pair (Map). | ||||||||||||
* Key is the HOST:PORT and the value is the connection. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
* @return the map of all connections. | ||||||||||||
*/ | ||||||||||||
public Map<String, ConnectionPool> getClusterNodes() { | ||||||||||||
return ((ClusterConnectionProvider) provider).getNodes(); | ||||||||||||
} | ||||||||||||
|
||||||||||||
/** | ||||||||||||
* Returns the connection for one of the 16,384 slots.<br><br> | ||||||||||||
* If there is no connection for the given slot, either cause the node died or didn't connect, it may not return the correct node. | ||||||||||||
* It will try to resolve connection-based issues using reconnection. | ||||||||||||
thxrben marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
* @param slot the slot to retrieve the connection for. | ||||||||||||
* @return connection of the provided slot. {@code close()} of this connection must be called after use. | ||||||||||||
*/ | ||||||||||||
public Connection getConnectionFromSlot(int slot) { | ||||||||||||
return ((ClusterConnectionProvider) provider).getConnectionFromSlot(slot); | ||||||||||||
} | ||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.