@Override public BlockingQueue<Operation> createOperationQueue() { return opQueueFactory == null ? super.createOperationQueue() : opQueueFactory.create(); }
@Override public BlockingQueue<Operation> createWriteOperationQueue() { return writeQueueFactory == null ? super.createReadOperationQueue() : writeQueueFactory.create(); }
@Override public Transcoder<Object> getDefaultTranscoder() { return transcoder == null ? super.getDefaultTranscoder() : transcoder; }
@Override public String toString() { return "Failure Mode: " + getFailureMode().name() + ", Hash Algorithm: " + ((DefaultHashAlgorithm)getHashAlg()).name() + " Max Reconnect Delay: " + getMaxReconnectDelay() + ", Max Op Timeout: " + getOperationTimeout() + ", Op Queue Length: " + getOpQueueLen() + ", Op Max Queue Block Time" + getOpQueueMaxBlockTime() + ", Max Timeout Exception Threshold: " + getTimeoutExceptionThreshold() + ", Read Buffer Size: " + getReadBufSize() + ", Transcoder: " + getDefaultTranscoder() + ", Operation Factory: " + getOperationFactory() + " isDaemon: " + isDaemon() + ", Optimized: " + shouldOptimize() + ", Using Nagle: " + useNagleAlgorithm() + ", ConnectionFactory: " + getName(); } }
public MemcachedConnection createConnection(List<InetSocketAddress> addrs) throws IOException { return new MemcachedConnection(getReadBufSize(), this, addrs, getInitialObservers(), getFailureMode(), getOperationFactory()); }
public MemcachedNode createMemcachedNode(SocketAddress sa, SocketChannel c, int bufSize) { OperationFactory of = getOperationFactory(); if (of instanceof AsciiOperationFactory) { return new AsciiMemcachedNodeImpl(sa, c, bufSize, createReadOperationQueue(), createWriteOperationQueue(), createOperationQueue(), getOpQueueMaxBlockTime(), getOperationTimeout()); } else if (of instanceof BinaryOperationFactory) { boolean doAuth = false; if (getAuthDescriptor() != null) { doAuth = true; } return new BinaryMemcachedNodeImpl(sa, c, bufSize, createReadOperationQueue(), createWriteOperationQueue(), createOperationQueue(), getOpQueueMaxBlockTime(), doAuth, getOperationTimeout()); } else { throw new IllegalStateException("Unhandled operation factory type " + of); } }
public MemcachedNode createMemcachedNode(SocketAddress sa, SocketChannel c, int bufSize) { OperationFactory of = getOperationFactory(); if(of instanceof AsciiOperationFactory) { return new AsciiMemcachedNodeImpl(sa, c, bufSize, createReadOperationQueue(), createWriteOperationQueue(), createOperationQueue()); } else if(of instanceof BinaryOperationFactory) { return new BinaryMemcachedNodeImpl(sa, c, bufSize, createReadOperationQueue(), createWriteOperationQueue(), createOperationQueue()); } else { throw new IllegalStateException( "Unhandled operation factory type " + of); } }
private MemcachedClient createMemcachedClient( final String memcachedNodes, final InetSocketAddress address ) throws IOException, InterruptedException { final MemcachedNodesManager nodesManager = MemcachedNodesManager.createFor(memcachedNodes, null, null, _storageClientCallback); final ConnectionFactory cf = nodesManager.isEncodeNodeIdInSessionId() ? new SuffixLocatorConnectionFactory( nodesManager, nodesManager.getSessionIdFormat(), Statistics.create(), 1000, 1000 ) : new DefaultConnectionFactory(); final MemcachedClient result = new MemcachedClient( cf, Arrays.asList( address ) ); // Wait a little bit, so that the memcached client can connect and is ready when test starts Thread.sleep( 100 ); return result; }
@Override public long getOperationTimeout() { return opTimeout == -1 ? super.getOperationTimeout() : opTimeout; }
@Override public HashAlgorithm getHashAlg() { return hashAlg == null ? super.getHashAlg() : hashAlg; }
@Override public long getOpQueueMaxBlockTime() { return opQueueMaxBlockTime > -1 ? opQueueMaxBlockTime : super.getOpQueueMaxBlockTime(); }
@Override public FailureMode getFailureMode() { return failureMode == null ? super.getFailureMode() : failureMode; }
@Override public int getReadBufSize() { return readBufSize == -1 ? super.getReadBufSize() : readBufSize; }
@Override public OperationFactory getOperationFactory() { return opFact == null ? super.getOperationFactory() : opFact; }
@Override public String toString() { return "Failure Mode: " + getFailureMode().name() + ", Hash Algorithm: " + ((DefaultHashAlgorithm)getHashAlg()).name() + " Max Reconnect Delay: " + getMaxReconnectDelay() + ", Max Op Timeout: " + getOperationTimeout() + ", Op Queue Length: " + getOpQueueLen() + ", Op Max Queue Block Time" + getOpQueueMaxBlockTime() + ", Max Timeout Exception Threshold: " + getTimeoutExceptionThreshold() + ", Read Buffer Size: " + getReadBufSize() + ", Transcoder: " + getDefaultTranscoder() + ", Operation Factory: " + getOperationFactory() + " isDaemon: " + isDaemon() + ", Optimized: " + shouldOptimize() + ", Using Nagle: " + useNagleAlgorithm() + ", ConnectionFactory: " + getName(); } }
public MemcachedConnection createConnection(List<InetSocketAddress> addrs) throws IOException { return new MemcachedConnection(getReadBufSize(), this, addrs, getInitialObservers(), getFailureMode(), getOperationFactory()); }
/** * Get a memcache client over the specified memcached locations. * * @param addrs the socket addrs * @throws IOException if connections cannot be established */ public MemcachedClient(List<InetSocketAddress> addrs) throws IOException { this(new DefaultConnectionFactory(), addrs); }
@Override public long getOperationTimeout() { return opTimeout == -1 ? super.getOperationTimeout() : opTimeout; }
@Override public HashAlgorithm getHashAlg() { return hashAlg == null ? super.getHashAlg() : hashAlg; }
@Override public long getOpQueueMaxBlockTime() { return opQueueMaxBlockTime > -1 ? opQueueMaxBlockTime : super.getOpQueueMaxBlockTime(); }