@@ -340,6 +340,39 @@ protected static ArcusClient getInstance(ConnectionFactory cf,
340
340
return new ArcusClient (cf , name , addrs );
341
341
}
342
342
343
+ /**
344
+ * Create an Arcus client for the given memcached server addresses.
345
+ * Recommend only invoked with proxy arcus server.
346
+ * @param addrs socket addresses for the proxy memcached servers
347
+ * @param cfb connection factory builder to configure connections for this client
348
+ * @return Arcus client instance
349
+ * @throws IOException
350
+ */
351
+ public static ArcusClient createArcusClient (List <InetSocketAddress > addrs ,
352
+ ConnectionFactoryBuilder cfb )
353
+ throws IOException {
354
+ return new ArcusClient (cfb .build (), addrs );
355
+ }
356
+
357
+ /**
358
+ * Create an Arcus client pool for the given memcached server addresses.
359
+ * Recommend only invoked with proxy arcus server.
360
+ * @param addrs socket addresses for the proxy memcached servers
361
+ * @param cfb connection factory builder to configure connections for this client
362
+ * @param size pool size
363
+ * @return Arcus client pool instance
364
+ * @throws IOException
365
+ */
366
+ public static ArcusClientPool createArcusClientPool (List <InetSocketAddress > addrs ,
367
+ ConnectionFactoryBuilder cfb , int size )
368
+ throws IOException {
369
+ ArcusClient [] clients = new ArcusClient [size ];
370
+ for (int i = 0 ; i < size ; i ++) {
371
+ clients [i ] = new ArcusClient (cfb .build (), addrs );
372
+ }
373
+ return new ArcusClientPool (size , clients );
374
+ }
375
+
343
376
/**
344
377
* Create an Arcus client for the given memcached server addresses.
345
378
*
@@ -348,7 +381,7 @@ protected static ArcusClient getInstance(ConnectionFactory cf,
348
381
* @param addrs socket addresses for the memcached servers
349
382
* @throws IOException if connections cannot be established
350
383
*/
351
- public ArcusClient (ConnectionFactory cf , String name , List <InetSocketAddress > addrs )
384
+ protected ArcusClient (ConnectionFactory cf , String name , List <InetSocketAddress > addrs )
352
385
throws IOException {
353
386
super (cf , name , addrs );
354
387
@@ -369,7 +402,7 @@ public ArcusClient(ConnectionFactory cf, String name, List<InetSocketAddress> ad
369
402
* @param addrs socket addresses for the memcached servers
370
403
* @throws IOException if connections cannot be established
371
404
*/
372
- public ArcusClient (ConnectionFactory cf , List <InetSocketAddress > addrs )
405
+ protected ArcusClient (ConnectionFactory cf , List <InetSocketAddress > addrs )
373
406
throws IOException {
374
407
this (cf , DEFAULT_ARCUS_CLIENT_NAME + "-" + CLIENT_ID .getAndIncrement (), addrs );
375
408
}
0 commit comments