@@ -246,42 +246,8 @@ public static void test23() {
246246 log .error ( "+ store/retrieve serialized object test passed" );
247247 }
248248
249- /**
250- * This runs through some simple tests of the MemCacheClient.
251- *
252- * Command line args:
253- * args[0] = number of threads to spawn
254- * args[1] = number of runs per thread
255- * args[2] = size of object to store
256- *
257- * @param args the command line arguments
258- */
259- public static void main (String [] args ) {
260-
261- BasicConfigurator .configure ();
262- org .apache .log4j .Logger .getRootLogger ().setLevel ( Level .WARN );
263-
264- if ( !UnitTests .class .desiredAssertionStatus () ) {
265- System .err .println ( "WARNING: assertions are disabled!" );
266- try { Thread .sleep ( 3000 ); } catch ( InterruptedException e ) {}
267- }
268-
269- String [] serverlist = { "192.168.1.1:1624" };
270- if ( args .length > 0 )
271- serverlist = args ;
272-
273- // initialize the pool for memcache servers
274- SockIOPool pool = SockIOPool .getInstance ( "test" );
275- pool .setServers ( serverlist );
276- pool .setMaxConn ( 250 );
277- pool .setNagle ( false );
278- pool .setMaintSleep ( 1000 );
279- pool .initialize ();
280-
281- mc = new MemCachedClient ( "test" );
282-
249+ public static void runAlTests ( MemCachedClient mc ) {
283250 test14 ();
284-
285251 for ( int t = 0 ; t < 2 ; t ++ ) {
286252 mc .setCompressEnable ( ( t &1 ) == 1 );
287253
@@ -328,6 +294,59 @@ public static void main(String[] args) {
328294 test20 ( 900 *1024 , 32 *1024 , 0 );
329295 test20 ( 900 *1024 , 32 *1024 , 1 );
330296 }
297+
298+ }
299+
300+ /**
301+ * This runs through some simple tests of the MemCacheClient.
302+ *
303+ * Command line args:
304+ * args[0] = number of threads to spawn
305+ * args[1] = number of runs per thread
306+ * args[2] = size of object to store
307+ *
308+ * @param args the command line arguments
309+ */
310+ public static void main (String [] args ) {
311+
312+ BasicConfigurator .configure ();
313+ org .apache .log4j .Logger .getRootLogger ().setLevel ( Level .WARN );
314+
315+ if ( !UnitTests .class .desiredAssertionStatus () ) {
316+ System .err .println ( "WARNING: assertions are disabled!" );
317+ try { Thread .sleep ( 3000 ); } catch ( InterruptedException e ) {}
318+ }
319+
320+ String [] serverlist = {
321+ "192.168.1.50:1620" ,
322+ "192.168.1.50:1621" ,
323+ "192.168.1.50:1622" ,
324+ "192.168.1.50:1623" ,
325+ "192.168.1.50:1624" ,
326+ "192.168.1.50:1625" ,
327+ "192.168.1.50:1626" ,
328+ "192.168.1.50:1627" ,
329+ "192.168.1.50:1628" ,
330+ "192.168.1.50:1629"
331+ };
332+
333+ Integer [] weights = { 1 , 1 , 1 , 1 , 10 , 5 , 1 , 1 , 1 , 3 };
334+
335+ if ( args .length > 0 )
336+ serverlist = args ;
337+
338+ // initialize the pool for memcache servers
339+ SockIOPool pool = SockIOPool .getInstance ( "test" );
340+ pool .setServers ( serverlist );
341+ pool .setWeights ( weights );
342+ pool .setMaxConn ( 250 );
343+ pool .setNagle ( false );
344+ pool .setMaintSleep ( 1000 );
345+ pool .setHashingAlg ( SockIOPool .CONSISTENT_HASH );
346+ pool .initialize ();
347+
348+ mc = new MemCachedClient ( "test" );
349+ runAlTests ( mc );
331350 }
332351
333352 /**
0 commit comments