Esempio n. 1
0
  public MessageInput getRunningInput(String inputId) {
    for (InputState inputState : inputStates) {
      if (inputState.getMessageInput().getId().equals(inputId)) return inputState.getMessageInput();
    }

    return null;
  }
  @Override
  protected void shutDown() throws Exception {
    LOG.debug("Stopping InputSetupService");
    eventBus.unregister(this);

    for (InputState state : inputRegistry.getRunningInputs()) {
      MessageInput input = state.getMessageInput();

      LOG.info(
          "Attempting to close input <{}> [{}].", input.getUniqueReadableId(), input.getName());

      Stopwatch s = Stopwatch.createStarted();
      try {
        input.stop();

        LOG.info(
            "Input <{}> closed. Took [{}ms]",
            input.getUniqueReadableId(),
            s.elapsed(TimeUnit.MILLISECONDS));
      } catch (Exception e) {
        LOG.error(
            "Unable to stop input <{}> [{}]: " + e.getMessage(),
            input.getUniqueReadableId(),
            input.getName());
      } finally {
        s.stop();
      }
    }
    LOG.debug("Stopped InputSetupService");
  }
Esempio n. 3
0
  public boolean hasTypeRunning(Class klazz) {
    for (InputState inputState : inputStates) {
      if (inputState.getMessageInput().getClass().equals(klazz)) {
        return true;
      }
    }

    return false;
  }
Esempio n. 4
0
 public void removeFromRunning(MessageInput input) {
   // Remove from running list.
   InputState thisInputState = null;
   for (InputState inputState : inputStates) {
     if (inputState.getMessageInput().equals(input)) {
       thisInputState = inputState;
     }
   }
   inputStates.remove(thisInputState);
 }