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

The following examples show how to use org.apache.cassandra.config.DatabaseDescriptor#getCounterWriteRpcTimeout() . 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: AbstractWriteResponseHandler.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public void get() throws WriteTimeoutException
{
    long requestTimeout = writeType == WriteType.COUNTER
                        ? DatabaseDescriptor.getCounterWriteRpcTimeout()
                        : DatabaseDescriptor.getWriteRpcTimeout();

    long timeout = TimeUnit.MILLISECONDS.toNanos(requestTimeout) - (System.nanoTime() - start);

    boolean success;
    try
    {
        success = condition.await(timeout, TimeUnit.NANOSECONDS);
    }
    catch (InterruptedException ex)
    {
        throw new AssertionError(ex);
    }

    if (!success)
    {
        int acks = ackCount();
        int blockedFor = totalBlockFor();
        // It's pretty unlikely, but we can race between exiting await above and here, so
        // that we could now have enough acks. In that case, we "lie" on the acks count to
        // avoid sending confusing info to the user (see CASSANDRA-6491).
        if (acks >= blockedFor)
            acks = blockedFor - 1;
        throw new WriteTimeoutException(writeType, consistencyLevel, acks, blockedFor);
    }
}
 
Example 2
Source File: CounterMutation.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
public long getTimeout()
{
    return DatabaseDescriptor.getCounterWriteRpcTimeout();
}
 
Example 3
Source File: StorageProxy.java    From stratio-cassandra with Apache License 2.0 votes vote down vote up
public Long getCounterWriteRpcTimeout() { return DatabaseDescriptor.getCounterWriteRpcTimeout(); }