@@ -629,51 +629,6 @@ public static interface Cleanup {
629
629
630
630
}
631
631
632
-
633
- // ========================================================================
634
-
635
- public static void main (String [] args ) {
636
- AsyncHttpClientConfig config = new AsyncHttpClientConfig .Builder ()
637
- .setMaximumConnectionsTotal (-1 )
638
- .setMaximumConnectionsPerHost (4500 )
639
- .setCompressionEnabled (false )
640
- .setAllowPoolingConnection (true /* keep-alive connection */ )
641
- // .setAllowPoolingConnection(false /* no keep-alive connection */)
642
- .setConnectionTimeoutInMs (9000 ).setRequestTimeoutInMs (9000 )
643
- .setIdleConnectionInPoolTimeoutInMs (3000 ).build ();
644
-
645
- AsyncHttpClient client =
646
- new AsyncHttpClient (new GrizzlyAsyncHttpProvider (config ), config );
647
-
648
- final int warmupRequests = 100000 ;
649
- final String testUrl = "http://localhost:8080" ;
650
- List <Future <Response >> futures =
651
- new ArrayList <Future <Response >>(warmupRequests );
652
- for (int i = 0 ; i < warmupRequests ; i ++) {
653
- try {
654
- futures .add (client .prepareGet (testUrl ).addHeader ("Req" , Integer .toString (i )).execute ());
655
- } catch (IOException e ) {
656
- System .err .println ("Failed to execute get at iteration #" + i );
657
- }
658
- }
659
- int counter = 0 ;
660
- for (Future <Response > future : futures ) {
661
- counter ++;
662
- try {
663
- future .get ();
664
- System .out .println (counter + " complete" );
665
- } catch (Exception e ) {
666
- System .err .println ("Failed to execute get at iteration #" + counter );
667
- e .printStackTrace ();
668
- client .close ();
669
- System .exit (1 );
670
- }
671
- }
672
-
673
- System .out .println ("Test complete..." );
674
- client .close ();
675
- }
676
-
677
632
}
678
633
679
634
0 commit comments