Search in sources :

Example 1 with HeronSocketOptions

use of com.twitter.heron.common.network.HeronSocketOptions in project heron by twitter.

the class HandleWriteTest method runStreamManagerClient.

void runStreamManagerClient() {
    Runnable r = new Runnable() {

        @Override
        public void run() {
            try {
                SystemConfig systemConfig = (SystemConfig) SingletonRegistry.INSTANCE.getSingleton(SystemConfig.HERON_SYSTEM_CONFIG);
                HeronSocketOptions socketOptions = new HeronSocketOptions(systemConfig.getInstanceNetworkWriteBatchSizeBytes(), systemConfig.getInstanceNetworkWriteBatchTimeMs(), systemConfig.getInstanceNetworkReadBatchSizeBytes(), systemConfig.getInstanceNetworkReadBatchTimeMs(), systemConfig.getInstanceNetworkOptionsSocketSendBufferSizeBytes(), systemConfig.getInstanceNetworkOptionsSocketReceivedBufferSizeBytes());
                streamManagerClient = new StreamManagerClient(nioLooper, HOST, serverPort, "topology-name", "topologyId", UnitTestHelper.getInstance("bolt-id"), inStreamQueue, outStreamQueue, inControlQueue, socketOptions, gatewayMetrics);
                streamManagerClient.start();
                nioLooper.loop();
            } finally {
                streamManagerClient.stop();
                nioLooper.exitLoop();
            }
        }
    };
    threadsPool.execute(r);
}
Also used : SystemConfig(com.twitter.heron.common.config.SystemConfig) HeronSocketOptions(com.twitter.heron.common.network.HeronSocketOptions)

Example 2 with HeronSocketOptions

use of com.twitter.heron.common.network.HeronSocketOptions in project heron by twitter.

the class HandleTMasterLocationTest method before.

@Before
public void before() throws Exception {
    // Get an available port
    serverPort = SysUtils.getFreePort();
    threadsPool = Executors.newFixedThreadPool(2);
    HeronSocketOptions serverSocketOptions = new HeronSocketOptions(100 * 1024 * 1024, 100, 100 * 1024 * 1024, 100, 5 * 1024 * 1024, 5 * 1024 * 1024);
    serverLooper = new NIOLooper();
    // Spy it for unit test
    metricsManagerServer = Mockito.spy(new MetricsManagerServer(serverLooper, SERVER_HOST, serverPort, serverSocketOptions, new MultiCountMetric()));
}
Also used : NIOLooper(com.twitter.heron.common.basics.NIOLooper) HeronSocketOptions(com.twitter.heron.common.network.HeronSocketOptions) MultiCountMetric(com.twitter.heron.api.metric.MultiCountMetric) Before(org.junit.Before)

Example 3 with HeronSocketOptions

use of com.twitter.heron.common.network.HeronSocketOptions in project heron by twitter.

the class MetricsManagerServerTest method before.

@Before
public void before() throws Exception {
    // Get an available port
    serverPort = SysUtils.getFreePort();
    threadsPool = Executors.newFixedThreadPool(2);
    HeronSocketOptions serverSocketOptions = new HeronSocketOptions(100 * 1024 * 1024, 100, 100 * 1024 * 1024, 100, 5 * 1024 * 1024, 5 * 1024 * 1024);
    serverLooper = new NIOLooper();
    metricsManagerServer = new MetricsManagerServer(serverLooper, SERVER_HOST, serverPort, serverSocketOptions, new MultiCountMetric());
}
Also used : NIOLooper(com.twitter.heron.common.basics.NIOLooper) HeronSocketOptions(com.twitter.heron.common.network.HeronSocketOptions) MultiCountMetric(com.twitter.heron.api.metric.MultiCountMetric) Before(org.junit.Before)

Example 4 with HeronSocketOptions

use of com.twitter.heron.common.network.HeronSocketOptions in project heron by twitter.

the class HandleReadTest method runStreamManagerClient.

void runStreamManagerClient() {
    Runnable r = new Runnable() {

        @Override
        public void run() {
            try {
                SystemConfig systemConfig = (SystemConfig) SingletonRegistry.INSTANCE.getSingleton(SystemConfig.HERON_SYSTEM_CONFIG);
                HeronSocketOptions socketOptions = new HeronSocketOptions(systemConfig.getInstanceNetworkWriteBatchSizeBytes(), systemConfig.getInstanceNetworkWriteBatchTimeMs(), systemConfig.getInstanceNetworkReadBatchSizeBytes(), systemConfig.getInstanceNetworkReadBatchTimeMs(), systemConfig.getInstanceNetworkOptionsSocketSendBufferSizeBytes(), systemConfig.getInstanceNetworkOptionsSocketReceivedBufferSizeBytes());
                streamManagerClient = new StreamManagerClient(nioLooper, HOST, serverPort, "topology-name", "topologyId", UnitTestHelper.getInstance("bolt-id"), inStreamQueue, outStreamQueue, inControlQueue, socketOptions, gatewayMetrics);
                streamManagerClient.start();
                nioLooper.loop();
            } finally {
                streamManagerClient.stop();
                nioLooper.exitLoop();
            }
        }
    };
    threadsPool.execute(r);
}
Also used : SystemConfig(com.twitter.heron.common.config.SystemConfig) HeronSocketOptions(com.twitter.heron.common.network.HeronSocketOptions)

Example 5 with HeronSocketOptions

use of com.twitter.heron.common.network.HeronSocketOptions in project heron by twitter.

the class ConnectTest method runStreamManagerClient.

void runStreamManagerClient() {
    Runnable r = new Runnable() {

        @Override
        public void run() {
            try {
                SystemConfig systemConfig = (SystemConfig) SingletonRegistry.INSTANCE.getSingleton(SystemConfig.HERON_SYSTEM_CONFIG);
                HeronSocketOptions socketOptions = new HeronSocketOptions(systemConfig.getInstanceNetworkWriteBatchSizeBytes(), systemConfig.getInstanceNetworkWriteBatchTimeMs(), systemConfig.getInstanceNetworkReadBatchSizeBytes(), systemConfig.getInstanceNetworkReadBatchTimeMs(), systemConfig.getInstanceNetworkOptionsSocketSendBufferSizeBytes(), systemConfig.getInstanceNetworkOptionsSocketReceivedBufferSizeBytes());
                streamManagerClient = new StreamManagerClient(nioLooper, HOST, serverPort, "topology-name", "topologyId", UnitTestHelper.getInstance("bolt-id"), inStreamQueue, outStreamQueue, inControlQueue, socketOptions, gatewayMetrics);
                streamManagerClient.start();
                nioLooper.loop();
            } finally {
                streamManagerClient.stop();
                nioLooper.exitLoop();
            }
        }
    };
    threadsPool.execute(r);
}
Also used : SystemConfig(com.twitter.heron.common.config.SystemConfig) HeronSocketOptions(com.twitter.heron.common.network.HeronSocketOptions)

Aggregations

HeronSocketOptions (com.twitter.heron.common.network.HeronSocketOptions)5 SystemConfig (com.twitter.heron.common.config.SystemConfig)3 MultiCountMetric (com.twitter.heron.api.metric.MultiCountMetric)2 NIOLooper (com.twitter.heron.common.basics.NIOLooper)2 Before (org.junit.Before)2