Java Code Examples for com.google.common.collect.Multimaps#filterKeys()

The following examples show how to use com.google.common.collect.Multimaps#filterKeys() . 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: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
  monitor.enter();
  try {
    if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
      throw new TimeoutException("Timeout waiting for the services to stop. The following "
      + "services have not stopped: " + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
    }
  } finally {
    monitor.leave();
  }
}
 
Example 2
Source File: EventArgScoringAlignment.java    From tac-kbp-eal with MIT License 5 votes vote down vote up
public EventArgScoringAlignment<EquivClassType> copyFiltered(
    final Predicate<EquivClassType> filter) {
  return new EventArgScoringAlignment<EquivClassType>(docID(), argumentOutput, answerKey,
      Iterables.filter(truePositiveECs, filter),
      Iterables.filter(falsePositiveECs, filter),
      Iterables.filter(falseNegativeECs, filter),
      Iterables.filter(unassessed, filter),
      Multimaps.filterKeys(ecsToAnswerKey, filter),
      Multimaps.filterKeys(ecsToSystem, filter));
}
 
Example 3
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
void checkHealthy() {
  if (states.count(RUNNING) != numberOfServices) {
    IllegalStateException exception =
        new IllegalStateException(
            "Expected to be healthy after starting. The following services are not running: "
                + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING))));
    throw exception;
  }
}
 
Example 4
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
  monitor.enter();
  try {
    if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
      throw new TimeoutException(
          "Timeout waiting for the services to stop. The following "
              + "services have not stopped: "
              + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
    }
  } finally {
    monitor.leave();
  }
}
 
Example 5
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
  monitor.enter();
  try {
    if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
      throw new TimeoutException(
          "Timeout waiting for the services to become healthy. The "
              + "following services have not started: "
              + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
    }
    checkHealthy();
  } finally {
    monitor.leave();
  }
}
 
Example 6
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
void checkHealthy() {
  if (states.count(RUNNING) != numberOfServices) {
    IllegalStateException exception = new IllegalStateException("Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING))));
    throw exception;
  }
}
 
Example 7
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
  monitor.enter();
  try {
    if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
      throw new TimeoutException(
        "Timeout waiting for the services to stop. The following "
        + "services have not stopped: " + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
    }
  } finally {
    monitor.leave();
  }
}
 
Example 8
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
  monitor.enter();
  try {
    if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
      throw new TimeoutException(
        "Timeout waiting for the services to become healthy. The "
        + "following services have not started: " + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
    }
    checkHealthy();
  } finally {
    monitor.leave();
  }
}
 
Example 9
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
void checkHealthy() {
  if (states.count(RUNNING) != numberOfServices) {
    IllegalStateException exception = new IllegalStateException("Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING))));
    throw exception;
  }
}
 
Example 10
Source File: TermOffsetPopulator.java    From datawave with Apache License 2.0 5 votes vote down vote up
/**
 * Finds all the content functions and returns a map indexed by function name to the function.
 */
public static Multimap<String,Function> getContentFunctions(JexlNode query) {
    FunctionReferenceVisitor visitor = new FunctionReferenceVisitor();
    query.jjtAccept(visitor, null);
    
    Multimap<String,Function> functionsInNamespace = Multimaps.index(visitor.functions().get(ContentFunctions.CONTENT_FUNCTION_NAMESPACE), Function::name);
    
    return Multimaps.filterKeys(functionsInNamespace, TermOffsetPopulator::isContentFunctionTerm);
}
 
Example 11
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
  monitor.enter();
  try {
    if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
      throw new TimeoutException("Timeout waiting for the services to become healthy. The "
      + "following services have not started: " + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
    }
    checkHealthy();
  } finally {
    monitor.leave();
  }
}
 
Example 12
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
void checkHealthy() {
  if (states.count(RUNNING) != numberOfServices) {
    IllegalStateException exception = new IllegalStateException("Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING))));
    throw exception;
  }
}
 
Example 13
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
      monitor.enter();
      try {
        if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
          throw new TimeoutException(
            "Timeout waiting for the services to stop. The following "
+ "services have not stopped: " + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
        }
      } finally {
        monitor.leave();
      }
    }
 
Example 14
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
      monitor.enter();
      try {
        if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
          throw new TimeoutException(
            "Timeout waiting for the services to become healthy. The "
+ "following services have not started: " + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
        }
        checkHealthy();
      } finally {
        monitor.leave();
      }
    }
 
Example 15
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@GuardedBy("monitor")
void checkHealthy() {
  if (states.count(RUNNING) != numberOfServices) {
    IllegalStateException exception = new IllegalStateException("Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING))));
    throw exception;
  }
}
 
Example 16
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
      monitor.enter();
      try {
        if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
          throw new TimeoutException(
            "Timeout waiting for the services to stop. The following "
+ "services have not stopped: " + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
        }
      } finally {
        monitor.leave();
      }
    }
 
Example 17
Source File: ServiceManager.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
      monitor.enter();
      try {
        if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
          throw new TimeoutException(
            "Timeout waiting for the services to become healthy. The "
+ "following services have not started: " + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
        }
        checkHealthy();
      } finally {
        monitor.leave();
      }
    }
 
Example 18
Source File: RecordingMetricFactory.java    From james-project with Apache License 2.0 4 votes vote down vote up
public Multimap<String, Duration> executionTimesForPrefixName(String prefixName) {
    synchronized (executionTimes) {
        return Multimaps.filterKeys(executionTimes, key -> key.startsWith(prefixName));
    }
}
 
Example 19
Source File: TermFrequencyList.java    From datawave with Apache License 2.0 2 votes vote down vote up
/**
 * Return only offsets for a limited set of fields
 * 
 * @param fields
 * @return
 */
public TreeMultimap<Zone,TermWeightPosition> fetchOffsets(Set<Zone> fields) {
    checkNotNull(fields);
    
    return (TreeMultimap<Zone,TermWeightPosition>) Multimaps.filterKeys(this.offsetsPerField, new FieldFilterPredicate(fields));
}