Package com.mongodb.connection
Class ConnectionId
- java.lang.Object
-
- com.mongodb.connection.ConnectionId
-
@Immutable public final class ConnectionId extends Object
An immutable connection identifier of a connection to a MongoDB server.Contains a locally created id and if available the MongoDB server created connection id
- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description ConnectionId(ServerId serverId)
Construct an instance with the given server id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
int
getLocalValue()
Gets the locally created id value for the connectionServerId
getServerId()
Gets the server id.Integer
getServerValue()
Gets the server generated id value for the connection or null if not set.int
hashCode()
String
toString()
ConnectionId
withServerValue(int serverValue)
Creates a new connectionId with the set server value
-
-
-
Constructor Detail
-
ConnectionId
public ConnectionId(ServerId serverId)
Construct an instance with the given server id.- Parameters:
serverId
- the server id- Since:
- 3.8
-
-
Method Detail
-
withServerValue
public ConnectionId withServerValue(int serverValue)
Creates a new connectionId with the set server value- Parameters:
serverValue
- the server value- Returns:
- the new connection id
- Since:
- 3.8
-
getServerId
public ServerId getServerId()
Gets the server id.- Returns:
- the server id
-
getLocalValue
public int getLocalValue()
Gets the locally created id value for the connection- Returns:
- the locally created id value for the connection
-
getServerValue
public Integer getServerValue()
Gets the server generated id value for the connection or null if not set.- Returns:
- the server generated id value for the connection or null if not set.
-
-