Package com.flaptor.hounder.searcher

Examples of com.flaptor.hounder.searcher.TrafficLimitingSearcher.search()


            try {Thread.sleep(10);} catch (InterruptedException e) {}
            new Thread() {
                public void run() {
//                  long t0 = System.currentTimeMillis();
                    try {
                        searcher.search(null, 0, 1, null, 1, null, null);
                    } catch (Throwable t) {
                        t.printStackTrace();
                        assertTrue(t.getMessage().contains("lateDrop"));
                        lateDropQueries++;
                    } finally {
View Full Code Here


            try {Thread.sleep(10);} catch (InterruptedException e) {}
            new Thread() {
                public void run() {
//                  long t0 = System.currentTimeMillis();
                    try {
                        searcher.search(null, 0, 1, null, 1, null, null);
                    } catch (Throwable t) {
                        assertTrue(t.getMessage().contains("TrafficLimitingSearcher"));
                    } finally {
                        queriesDone++;
                    }
View Full Code Here

        int slots = 5;
        AlwaysFailSearcher baseSearcher = new AlwaysFailSearcher();
        final TrafficLimitingSearcher searcher = new TrafficLimitingSearcher(baseSearcher,slots,1/*no timeout*/);
        for (int i = 0; i < slots +1 ; i++){
            try {
                searcher.search(null, 0, 1, null, 1, null, null);
                fail(); // should not happen, as AlwaysFailSearcher will throw a SearcherException
            catch (SearcherException se){
                // do nothing ..
            }
        }
View Full Code Here

        // now, try with another query. If the slots were not released, it should fail with TrafficLimitingSearcher Exception.
        // if it failed with "I always fail", it is ok.
        Thread searchThread  = new Thread() {
            public void run() {
                try {
                    searcher.search(null, 0, 1, null, 1, null, null);
                } catch (Throwable t) {
                    assertFalse(t.getMessage().contains("TrafficLimitingSearcher"));
                    assertTrue(t.getMessage().contains("I always fail"));
                    semaphorePassed = true;
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.