Package com.mysql.cj.xdevapi
Class ClientFactory
java.lang.Object
com.mysql.cj.xdevapi.ClientFactory
public class ClientFactory
extends java.lang.Object
ClientFactory is used for creation of
Client
instances.
Client
objects provide the means of creating Session
s that use an internally managed connection pool.
ClientFactory xClientFactory = new ClientFactory();Client
client1 = xClientFactory.getClient("mysqlx://[user1[:pwd1]@]host1[:port1]/db", poolingProps);Client
client2 = xClientFactory.getClient("mysqlx://host2[:port2]/db?user=user2&password=pwd2", poolingProps);
-
Constructor Summary
Constructors Constructor Description ClientFactory()
-
Method Summary
Modifier and Type Method Description Client
getClient(java.lang.String url, java.lang.String clientPropsJson)
Creates aClient
object which provides a Session pooling functionality.Client
getClient(java.lang.String url, java.util.Properties clientProps)
Creates aClient
object that provides a Session pooling functionality.
-
Constructor Details
-
ClientFactory
public ClientFactory()
-
-
Method Details
-
getClient
Creates aClient
object which provides a Session pooling functionality.- Parameters:
url
- the session URL.clientPropsJson
- JSON string representing a document that defines connection properties in a special format. For pooling configuration, it should contain an embedded document after the "pooling" key:pooling : { enabled: true|false, maxSize: integer > 0 maxIdleTime: integer ≥ 0, queueTimeOut: integer ≥ 0 }
- Returns:
- a
Client
instance
-
getClient
Creates aClient
object that provides a Session pooling functionality.- Parameters:
url
- the session URL.clientProps
- theProperties
instance that contains the connection properties. The keys in thisProperties
match with the path of each value in the JSON document fromgetClient(String, String)
(for example,pooling.enabled
orpooling.maxSize
).- Returns:
- a
Client
instance.
-