@@ -128,6 +128,8 @@ public class MemcachedClient extends SpyThread
128
128
129
129
final AuthDescriptor authDescriptor ;
130
130
131
+ private final ConnectionFactory connFactory ;
132
+
131
133
private final AuthThreadMonitor authMonitor = new AuthThreadMonitor ();
132
134
private volatile boolean reconfiguring = false ;
133
135
private ConfigurationProvider configurationProvider ;
@@ -176,6 +178,7 @@ public MemcachedClient(ConnectionFactory cf, List<InetSocketAddress> addrs)
176
178
throw new IllegalArgumentException (
177
179
"Operation timeout must be positive." );
178
180
}
181
+ connFactory = cf ;
179
182
tcService = new TranscodeService (cf .isDaemon ());
180
183
transcoder =cf .getDefaultTranscoder ();
181
184
opFact =cf .getOperationFactory ();
@@ -281,10 +284,10 @@ public MemcachedClient(ConnectionFactory cf, final List<URI> baseList,
281
284
cfb .setAuthDescriptor (ad );
282
285
}
283
286
284
- cf = cfb .build ();
287
+ connFactory = cfb .build ();
285
288
286
289
List <InetSocketAddress > addrs = AddrUtil .getAddresses (bucket .getConfig ().getServers ());
287
- if (cf == null ) {
290
+ if (connFactory == null ) {
288
291
throw new NullPointerException ("Connection factory required" );
289
292
}
290
293
if (addrs == null ) {
@@ -294,23 +297,23 @@ public MemcachedClient(ConnectionFactory cf, final List<URI> baseList,
294
297
throw new IllegalArgumentException (
295
298
"You must have at least one server to connect to" );
296
299
}
297
- if (cf .getOperationTimeout () <= 0 ) {
300
+ if (connFactory .getOperationTimeout () <= 0 ) {
298
301
throw new IllegalArgumentException (
299
302
"Operation timeout must be positive." );
300
303
}
301
- tcService = new TranscodeService (cf .isDaemon ());
302
- transcoder =cf .getDefaultTranscoder ();
303
- opFact =cf .getOperationFactory ();
304
+ tcService = new TranscodeService (connFactory .isDaemon ());
305
+ transcoder =connFactory .getDefaultTranscoder ();
306
+ opFact =connFactory .getOperationFactory ();
304
307
assert opFact != null : "Connection factory failed to make op factory" ;
305
- conn =cf .createConnection (addrs );
308
+ conn =connFactory .createConnection (addrs );
306
309
assert conn != null : "Connection factory failed to make a connection" ;
307
- operationTimeout = cf .getOperationTimeout ();
308
- authDescriptor = cf .getAuthDescriptor ();
310
+ operationTimeout = connFactory .getOperationTimeout ();
311
+ authDescriptor = connFactory .getAuthDescriptor ();
309
312
if (authDescriptor != null ) {
310
313
addObserver (this );
311
314
}
312
315
setName ("Memcached IO over " + conn );
313
- setDaemon (cf .isDaemon ());
316
+ setDaemon (connFactory .isDaemon ());
314
317
this .configurationProvider .subscribe (bucketName , this );
315
318
start ();
316
319
}
@@ -2178,4 +2181,8 @@ public void connectionLost(SocketAddress sa) {
2178
2181
// Don't care.
2179
2182
}
2180
2183
2184
+ @ Override
2185
+ public String toString () {
2186
+ return connFactory .toString ();
2187
+ }
2181
2188
}
0 commit comments