Partilhar via


ShardLocation Class

  • java.lang.Object
    • Serializable
      • com.microsoft.azure.elasticdb.shard.base.ShardLocation

public class ShardLocation

Represents the location of a shard in terms of its server name and database name. This is used to manage connections to the shard and to support other operations on shards. As opposed to a Shard, a shard location is not registered with the shard map.

Constructor Summary

Constructor Description
ShardLocation()
ShardLocation(String server, String database)

Constructor that allows specification of address and database to identify a shard.

ShardLocation(String server, String database, SqlProtocol protocol)

Constructor that allows specification of address and database to identify a shard.

ShardLocation(String server, String database, SqlProtocol protocol, int port)

Constructor that allows specification of protocol, address, port and database to identify a shard.

Method Summary

Modifier and Type Method and Description
boolean equals(Object obj)

Determines whether the specified object is equal to the current object.

boolean equals(ShardLocation other)

Performs equality comparison with another given ShardLocation.

String getDatabase()
String getDataSource()

DataSource name which can be used to construct connection string Data Source property.

int getPort()
SqlProtocol getProtocol()
String getServer()
int hashCode()

Calculates the hash code for this instance.

String toString()

Converts the shard location to its string representation.

Constructor Details

ShardLocation

public ShardLocation()

ShardLocation

public ShardLocation(String server, String database)

Constructor that allows specification of address and database to identify a shard.

Parameters:

server - Fully qualified hostname of the server for the shard database.
database - Name of the shard database.

ShardLocation

public ShardLocation(String server, String database, SqlProtocol protocol)

Constructor that allows specification of address and database to identify a shard.

Parameters:

server - Fully qualified hostname of the server for the shard database.
database - Name of the shard database.
protocol - Transport protcol used for the connection.

ShardLocation

public ShardLocation(String server, String database, SqlProtocol protocol, int port)

Constructor that allows specification of protocol, address, port and database to identify a shard.

Parameters:

server - Fully qualified hostname of the server for the shard database.
database - Name of the shard database.
protocol - Transport protcol used for the connection.
port - Port number for TCP/IP connections. Specify 0 to use the default port for the specified protocol .

Method Details

equals

public boolean equals(Object obj)

Determines whether the specified object is equal to the current object.

Parameters:

obj - The object to compare with the current object.

Returns:

True if the specified object is equal to the current object; otherwise, false.

equals

public boolean equals(ShardLocation other)

Performs equality comparison with another given ShardLocation.

Parameters:

other - ShardLocation to compare with.

Returns:

True if same locations, false otherwise.

getDatabase

public String getDatabase()

getDataSource

public String getDataSource()

DataSource name which can be used to construct connection string Data Source property.

getPort

public int getPort()

getProtocol

public SqlProtocol getProtocol()

getServer

public String getServer()

hashCode

public int hashCode()

Calculates the hash code for this instance.

Returns:

Hash code for the object.

toString

public String toString()

Converts the shard location to its string representation.

Returns:

String representation of shard location.

Applies to