public class ShardedConnection extends Object implements AutoCloseable, Serializable
Connection
s and PreparedStatement
s for keys.Modifier and Type | Class and Description |
---|---|
static class |
ShardedConnection.ModHashPartitioner |
static interface |
ShardedConnection.Partitioner |
class |
ShardedConnection.ShardedStatement |
Constructor and Description |
---|
ShardedConnection(List<String> shardUrls,
String user,
String password) |
ShardedConnection(List<String> shardUrls,
String user,
String password,
ShardedConnection.Partitioner partitioner) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Connection[] |
connections() |
Connection |
getFirst() |
Connection |
getForIndex(int index) |
Connection |
getForKey(Object key) |
int |
getNumShards() |
int |
getShardIndex(Object key) |
ShardedConnection.ShardedStatement |
prepareStatement(String sql) |
void |
setTransactionIsolation(int level) |
public ShardedConnection(List<String> shardUrls, String user, String password, ShardedConnection.Partitioner partitioner) throws SQLException
SQLException
public ShardedConnection(List<String> shardUrls, String user, String password) throws SQLException
SQLException
public ShardedConnection.ShardedStatement prepareStatement(String sql) throws SQLException
SQLException
public Connection[] connections()
public Connection getForKey(Object key)
public Connection getForIndex(int index)
public Connection getFirst()
public int getNumShards()
public void close() throws SQLException
close
in interface AutoCloseable
SQLException
public int getShardIndex(Object key)
public void setTransactionIsolation(int level) throws SQLException
SQLException
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.