public ChainedDynamicProperty.IntProperty getChainedIntProperty(String overrideKey, String primaryKey, int defaultValue, Runnable listener) { final String mapKey = overrideKey + primaryKey; ChainedDynamicProperty.IntProperty prop = (ChainedDynamicProperty.IntProperty) fastPropMap.get(mapKey); if (prop != null) return prop; final DynamicIntProperty baseProp = new DynamicIntProperty(primaryKey, defaultValue); prop = new ChainedDynamicProperty.IntProperty(overrideKey, baseProp); fastPropMap.put(mapKey, prop); if(listener != null) { baseProp.addCallback(listener); prop.addCallback(listener); } return prop; }
try { final Map<String, CachedData> metadataMap = evcacheMemcachedClient.asyncGetBulk(firstKeys, chunkingTranscoder, null, "GetChunkMetadataOperation") .getSome(bulkReadTimeout.get(), TimeUnit.MILLISECONDS, false, false); if (metadataMap == null) return null; .getSome(bulkReadTimeout.get(), TimeUnit.MILLISECONDS, false, false);
public IntProperty(String name, DynamicIntProperty sProperty) { this(name, new IntProperty(sProperty)); }
public IntProperty(String name, DynamicIntProperty sProperty) { this(name, new IntProperty(sProperty)); }
public IntProperty(String name, IntProperty next) { super(next); // setup next pointer sProp = DynamicPropertyFactory.getInstance().getIntProperty(name, Integer.MIN_VALUE); callback = new Runnable() { @Override public void run() { logger.info("Property changed: '" + getName() + " = " + getValue() + "'"); checkAndFlip(); } }; sProp.addCallback(callback); checkAndFlip(); }
public IntProperty(String name, IntProperty next) { super(next); // setup next pointer sProp = DynamicPropertyFactory.getInstance().getIntProperty(name, Integer.MIN_VALUE); callback = new Runnable() { @Override public void run() { logger.info("Property changed: '" + getName() + " = " + getValue() + "'"); checkAndFlip(); } }; sProp.addCallback(callback); checkAndFlip(); }
private boolean shouldSkipServer(ServerStats stats) { if ((CIRCUIT_BREAKER_FILTERING.get() && stats.isCircuitBreakerTripped()) || stats.getActiveRequestsCount() >= activeConnectionsLimit.get()) { return true; } return false; }
private void initDynamicProperty(IClientConfig clientConfig) { String id = "default"; if (clientConfig != null) { id = clientConfig.getClientName(); activeConnectionsLimit = new ChainedDynamicProperty.IntProperty(id + "." + clientConfig.getNameSpace() + ".ActiveConnectionsLimit", ACTIVE_CONNECTIONS_LIMIT); } }
@Override public void run() { logger.info("Property changed: '" + getName() + " = " + getValue() + "'"); checkAndFlip(); } };
@Override public void run() { logger.info("Property changed: '" + getName() + " = " + getValue() + "'"); checkAndFlip(); } };
.getSome(bulkReadTimeout.get(), TimeUnit.MILLISECONDS, false, false, scheduler) .flatMap(metadataMap -> { if (metadataMap == null) return null; .getSome(bulkReadTimeout.get(), TimeUnit.MILLISECONDS, false, false, scheduler) .map(dataMap -> { for (Entry<ChunkInfo, Pair<List<String>, byte[]>> entry : responseMap.entrySet()) {
public <T> EVCacheOperationFuture<T> asyncGet(final String key, final Transcoder<T> tc, EVCacheGetOperationListener<T> listener) { final CountDownLatch latch = new CountDownLatch(1); final EVCacheOperationFuture<T> rv = new EVCacheOperationFuture<T>(key, latch, new AtomicReference<T>(null), readTimeout.get().intValue(), executorService, appName, serverGroup); final Stopwatch operationDuration = getTimer(GET_OPERATION_STRING).start(); Operation op = opFact.get(key, new GetOperation.Callback() {
.getSome(readTimeout.get(), TimeUnit.MILLISECONDS, false, false, scheduler) .map(dataMap -> { if (dataMap.size() != ci.getChunks() - 1) {
.getSome(readTimeout.get(), TimeUnit.MILLISECONDS, false, false);
final String hKey = getHashedKey(key); if(ignoreTouch.get()) { final Single<Object> value = _client.asyncGet(hKey, evcacheValueTranscoder, null).get(readTimeout.get(), TimeUnit.MILLISECONDS, _throwException, hasZF, scheduler); return value.flatMap(r -> { final CASValue<Object> rObj = (CASValue<Object>)r; final Single<CASValue<Object>> value = _client.asyncGetAndTouch(hKey, timeToLive, evcacheValueTranscoder).get(readTimeout.get(), TimeUnit.MILLISECONDS, _throwException, hasZF, scheduler); if(value != null ) { return value.flatMap(r -> { .get(readTimeout.get(), TimeUnit.MILLISECONDS, _throwException, hasZF, scheduler) .map(value -> (value == null) ? null : value.getValue());
private CachedData[] createChunks(CachedData cd, String key) { final int cSize = chunkSize.get(); if ((key.length() + 3) > cSize) throw new IllegalArgumentException("The chunksize " + cSize + " is smaller than the key size. Will not be able to proceed. key size = "
final Object obj; if(ignoreTouch.get()) { obj = _client.asyncGet(hKey, evcacheValueTranscoder, null).get(readTimeout.get(), TimeUnit.MILLISECONDS, _throwException, hasZF); } else { final CASValue<Object> value = _client.asyncGetAndTouch(key, timeToLive, evcacheValueTranscoder).get(readTimeout.get(), TimeUnit.MILLISECONDS, _throwException, hasZF); obj = (value == null) ? null : value.getValue(); returnVal = _client.asyncGet(key, tc, null).get(readTimeout.get(), TimeUnit.MILLISECONDS, _throwException, hasZF); } else { final CASValue<T> value = _client.asyncGetAndTouch(key, timeToLive, tc).get(readTimeout.get(), TimeUnit.MILLISECONDS, _throwException, hasZF); returnVal = (value == null) ? null : value.getValue();
this._poolSize = config.getDynamicIntProperty(appName + ".EVCacheClientPool.poolSize", 1); this._poolSize.addCallback(callback); this._readTimeout = new ChainedDynamicProperty.IntProperty(appName + ".EVCacheClientPool.readTimeout", EVCacheClientPoolManager.getDefaultReadTimeout()); this._readTimeout.addCallback(callback); this._bulkReadTimeout = new ChainedDynamicProperty.IntProperty(appName + ".EVCacheClientPool.bulkReadTimeout", _readTimeout); this._bulkReadTimeout.addCallback(callback);
hashKeys.add(hKey); final Single<Map<String, Object>> vals = evcacheMemcachedClient.asyncGetBulk(hashKeys, evcacheValueTranscoder, null, "BulkOperation").getSome(bulkReadTimeout.get(), TimeUnit.MILLISECONDS, _throwException, hasZF, scheduler); if(vals != null ) { return vals.flatMap(r -> { .getSome(bulkReadTimeout.get(), TimeUnit.MILLISECONDS, _throwException, hasZF, scheduler);