com.netflix.astyanax.retry.RetryPolicy Java Examples

The following examples show how to use com.netflix.astyanax.retry.RetryPolicy. 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: AstyanaxKeyColumnValueStore.java    From titan1withtp3.1 with Apache License 2.0 6 votes vote down vote up
AstyanaxKeyColumnValueStore(String columnFamilyName,
                            Keyspace keyspace,
                            AstyanaxStoreManager storeManager,
                            RetryPolicy retryPolicy) {
    this.keyspace = keyspace;
    this.columnFamilyName = columnFamilyName;
    this.retryPolicy = retryPolicy;
    this.storeManager = storeManager;

    entryGetter = new AstyanaxGetter(storeManager.getMetaDataSchema(columnFamilyName));

    columnFamily = new ColumnFamily<ByteBuffer, ByteBuffer>(
            this.columnFamilyName,
            ByteBufferSerializer.get(),
            ByteBufferSerializer.get());

}
 
Example #2
Source File: AstyanaxStoreManager.java    From titan1withtp3.1 with Apache License 2.0 6 votes vote down vote up
private static RetryPolicy getRetryPolicy(String serializedRetryPolicy) throws BackendException {
    String[] tokens = serializedRetryPolicy.split(",");
    String policyClassName = tokens[0];
    int argCount = tokens.length - 1;
    Integer[] args = new Integer[argCount];
    for (int i = 1; i < tokens.length; i++) {
        args[i - 1] = Integer.valueOf(tokens[i]);
    }

    try {
        RetryPolicy rp = instantiate(policyClassName, args, serializedRetryPolicy);
        log.debug("Instantiated RetryPolicy object {} from config string \"{}\"", rp, serializedRetryPolicy);
        return rp;
    } catch (Exception e) {
        throw new PermanentBackendException("Failed to instantiate Astyanax Retry Policy class", e);
    }
}
 
Example #3
Source File: PinnedConnectionPool.java    From emodb with Apache License 2.0 5 votes vote down vote up
@Override
public <R> OperationResult<R> executeWithFailover(Operation<T, R> operation, RetryPolicy retryPolicy)
        throws ConnectionException, OperationException {
    Operation<T, R> pinnedOperation = new AbstractOperationFilter<T, R>(operation) {
        @Override
        public Host getPinnedHost() {
            return _host;
        }
    };

    return _delegate.executeWithFailover(pinnedOperation, retryPolicy);
}
 
Example #4
Source File: AnnotatedAstyanaxConfiguration.java    From staash with Apache License 2.0 4 votes vote down vote up
@Override
public RetryPolicy getRetryPolicy() {
    return retryPolicy;
}