Ejemplo n.º 1
0
 @Override
 public void deactivateThrottling() {
   int count = throttleRequestCount.decrementAndGet();
   assert count >= 0 : "invalid post-decrement throttleRequestCount=" + count;
   if (count == 0) {
     throttle.deactivate();
   }
 }
Ejemplo n.º 2
0
 @Override
 public void activateThrottling() {
   int count = throttleRequestCount.incrementAndGet();
   assert count >= 1 : "invalid post-increment throttleRequestCount=" + count;
   if (count == 1) {
     throttle.activate();
   }
 }
Ejemplo n.º 3
0
 @Override
 public boolean index(Index index) {
   final boolean created;
   try (ReleasableLock lock = readLock.acquire()) {
     ensureOpen();
     if (index.origin() == Operation.Origin.RECOVERY) {
       // Don't throttle recovery operations
       created = innerIndex(index);
     } else {
       try (Releasable r = throttle.acquireThrottle()) {
         created = innerIndex(index);
       }
     }
   } catch (OutOfMemoryError | IllegalStateException | IOException t) {
     maybeFailEngine("index", t);
     throw new IndexFailedEngineException(shardId, index.type(), index.id(), t);
   }
   return created;
 }
Ejemplo n.º 4
0
 public long getIndexThrottleTimeInMillis() {
   return throttle.getThrottleTimeInMillis();
 }