public static class Connection.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
Connection |
build() |
Connection.Builder |
clientConfig(JedisClientConfig clientConfig) |
protected Connection |
createConnection()
Construct a fresh, uninitialized
Connection for this builder. |
JedisClientConfig |
getClientConfig() |
JedisSocketFactory |
getSocketFactory() |
Connection.Builder |
socketFactory(JedisSocketFactory socketFactory) |
public Connection.Builder socketFactory(JedisSocketFactory socketFactory)
public Connection.Builder clientConfig(JedisClientConfig clientConfig)
public JedisSocketFactory getSocketFactory()
public JedisClientConfig getClientConfig()
public Connection build()
protected Connection createConnection()
Connection for this builder.
Template-method hook for subclasses to return their concrete Connection subtype
(see CacheConnection.Builder for an example). The
returned instance has its socket factory and client config wired up, but the network
handshake has not run yet.
Two callers drive initialization differently:
build() — the public entry point — invokes
Connection.initializeFromClientConfig() on the returned instance before
handing it back, so external callers receive a ready-to-use connection.buildUninitialized() — the package-private accessor used by pool
factories — returns the uninitialized instance so the factory can interpose
between construction and initialization (e.g. to track an in-flight handshake
so a forced disconnect can interrupt it).
Implementations must be free of side effects: do not open sockets, send commands, or
invoke Connection.initializeFromClientConfig() — running initialization here
would break the buildUninitialized() contract that pool factories rely on.
ConnectionCopyright © 2026. All rights reserved.