Package com.netflix.suro.input.thrift

Examples of com.netflix.suro.input.thrift.ThriftServer


                new MessageRouter(map, sinks, jsonMapper),
                config,
                jsonMapper
        );

        ThriftServer server = new ThriftServer(config, msgProcessor);
        server.start();

        SuroClient client = createSuroClient(server.getPort());

        Thread t = createClientThread(jsonMapper, client, TOPIC_NAME);

        // checking the traffic goes
        for (int i = 0; i < 10; ++i) {
            if (client.getSentMessageCount() > 0) {
                break;
            }
            Thread.sleep(1000);
        }
        assertTrue(client.getSentMessageCount() > 0);

        // shutting down the traffic
        hasEnoughSpace = false;
        int count = 0;
        while (count < 3) {
            if (msgProcessor.getStatus() == ServiceStatus.WARNING) {
                ++count;
            }
        }
        assertEquals(count, 3);

        client.shutdown();
        run.set(false);
        t.join();

        // resuming the traffic
        hasEnoughSpace = true;
        run.set(true);
        SuroClient newClient = createSuroClient(server.getPort());
        t = createClientThread(jsonMapper, newClient, TOPIC_NAME);

        for (int i = 0; i < 10; ++i) {
            if (client.getSentMessageCount() > 0) {
                break;
            }
            Thread.sleep(1000);
        }
        assertTrue(client.getSentMessageCount() > 0);

        run.set(false);
        t.join();
        client.shutdown();

        server.shutdown();

        sink.close();

        assertEquals(sink.getNumOfPendingMessages(), 0);
    }
View Full Code Here

TOP

Related Classes of com.netflix.suro.input.thrift.ThriftServer

Copyright © 2018 www.massapicom. 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.