Search in sources :

Example 1 with HeronSocketOptions

use of org.apache.heron.common.network.HeronSocketOptions in project heron by twitter.

the class AbstractNetworkTest method runStreamManagerClient.

StreamManagerClient runStreamManagerClient() {
    SystemConfig systemConfig = (SystemConfig) SingletonRegistry.INSTANCE.getSingleton(SystemConfig.HERON_SYSTEM_CONFIG);
    HeronSocketOptions socketOptions = new HeronSocketOptions(systemConfig.getInstanceNetworkWriteBatchSize(), systemConfig.getInstanceNetworkWriteBatchTime(), systemConfig.getInstanceNetworkReadBatchSize(), systemConfig.getInstanceNetworkReadBatchTime(), systemConfig.getInstanceNetworkOptionsSocketSendBufferSize(), systemConfig.getInstanceNetworkOptionsSocketReceivedBufferSize(), systemConfig.getInstanceNetworkOptionsMaximumPacketSize());
    final NIOLooper nioLooper = (NIOLooper) communicatorTester.getTestLooper();
    streamManagerClient = new StreamManagerClient(nioLooper, HOST, serverPort, "topology-name", "topologyId", UnitTestHelper.getInstance("bolt-id"), communicatorTester.getInStreamQueue(), communicatorTester.getOutStreamQueue(), communicatorTester.getInControlQueue(), socketOptions, gatewayMetrics);
    Runnable r = new Runnable() {

        @Override
        public void run() {
            try {
                streamManagerClient.start();
                nioLooper.loop();
            } finally {
                streamManagerClient.stop();
                nioLooper.exitLoop();
            }
        }
    };
    threadPool.execute(r);
    return streamManagerClient;
}
Also used : SystemConfig(org.apache.heron.common.config.SystemConfig) NIOLooper(org.apache.heron.common.basics.NIOLooper) HeronSocketOptions(org.apache.heron.common.network.HeronSocketOptions)

Example 2 with HeronSocketOptions

use of org.apache.heron.common.network.HeronSocketOptions in project heron by twitter.

the class CheckpointManager method init.

public void init(String topologyName, String topologyId, String checkpointMgrId, String serverHost, int serverPort, SystemConfig systemConfig, CheckpointManagerConfig checkpointManagerConfig) throws IOException, CheckpointManagerException {
    LOG.info("Initializing CheckpointManager");
    checkpointManagerServerLoop = new NIOLooper();
    HeronSocketOptions serverSocketOptions = new HeronSocketOptions(checkpointManagerConfig.getWriteBatchSize(), checkpointManagerConfig.getWriteBatchTime(), checkpointManagerConfig.getReadBatchSize(), checkpointManagerConfig.getReadBatchTime(), checkpointManagerConfig.getSocketSendSize(), checkpointManagerConfig.getSocketReceiveSize(), checkpointManagerConfig.getMaximumPacketSize());
    // Setup the IStatefulStorage
    IStatefulStorage statefulStorage = setupStatefulStorage(topologyName, checkpointManagerConfig);
    // Start the server
    this.checkpointManagerServer = new CheckpointManagerServer(topologyName, topologyId, checkpointMgrId, statefulStorage, checkpointManagerServerLoop, serverHost, serverPort, serverSocketOptions);
}
Also used : NIOLooper(org.apache.heron.common.basics.NIOLooper) HeronSocketOptions(org.apache.heron.common.network.HeronSocketOptions) IStatefulStorage(org.apache.heron.spi.statefulstorage.IStatefulStorage)

Aggregations

NIOLooper (org.apache.heron.common.basics.NIOLooper)2 HeronSocketOptions (org.apache.heron.common.network.HeronSocketOptions)2 SystemConfig (org.apache.heron.common.config.SystemConfig)1 IStatefulStorage (org.apache.heron.spi.statefulstorage.IStatefulStorage)1