Java Code Examples for org.apache.cassandra.config.DatabaseDescriptor#getNativeTransportMaxConcurrentConnections()

The following examples show how to use org.apache.cassandra.config.DatabaseDescriptor#getNativeTransportMaxConcurrentConnections() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Server.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
protected void initChannel(Channel channel) throws Exception
{
    ChannelPipeline pipeline = channel.pipeline();

    // Add the ConnectionLimitHandler to the pipeline if configured to do so.
    if (DatabaseDescriptor.getNativeTransportMaxConcurrentConnections() > 0
            || DatabaseDescriptor.getNativeTransportMaxConcurrentConnectionsPerIp() > 0)
    {
        // Add as first to the pipeline so the limit is enforced as first action.
        pipeline.addFirst("connectionLimitHandler", connectionLimitHandler);
    }

    //pipeline.addLast("debug", new LoggingHandler());

    pipeline.addLast("frameDecoder", new Frame.Decoder(server.connectionFactory));
    pipeline.addLast("frameEncoder", frameEncoder);

    pipeline.addLast("frameDecompressor", frameDecompressor);
    pipeline.addLast("frameCompressor", frameCompressor);

    pipeline.addLast("messageDecoder", messageDecoder);
    pipeline.addLast("messageEncoder", messageEncoder);

    pipeline.addLast(server.eventExecutorGroup, "executor", dispatcher);
}
 
Example 2
Source File: StorageProxy.java    From stratio-cassandra with Apache License 2.0 votes vote down vote up
public Long getNativeTransportMaxConcurrentConnections() { return DatabaseDescriptor.getNativeTransportMaxConcurrentConnections(); }