コード例 #1
0
 @Override
 public void writeLine(String line) throws IOException {
   if (outputEnabled) {
     double rate;
     if (maxEventRateChecker.updateAndCheckRate()
         && (rate = maxEventRateChecker.getRate()) > maxLogsRate) {
       outputEnabled = false;
       final String message =
           String.format(
               "[WARNING] Application '%s' has exceeded output rate of %.2f messages / second. Application output has been disabled.",
               project.startsWith("/") ? project.substring(1) : project, rate);
       eventService.publish(
           RunnerEvent.messageLoggedEvent(
               processId,
               workspace,
               project,
               new RunnerEvent.LoggedMessage(message, lineCounter.getAndIncrement())));
       return;
     }
     if (line != null) {
       eventService.publish(
           RunnerEvent.messageLoggedEvent(
               processId,
               workspace,
               project,
               new RunnerEvent.LoggedMessage(line, lineCounter.getAndIncrement())));
     }
   }
   super.writeLine(line);
 }
コード例 #2
0
ファイル: StackDaoTest.java プロジェクト: raphsoft/che
  @Test
  public void shouldPublishStackPersistedEventAfterStackIsPersisted() throws Exception {
    final boolean[] isNotified = new boolean[] {false};
    eventService.subscribe(event -> isNotified[0] = true, StackPersistedEvent.class);

    stackDao.create(createStack("test", "test"));

    assertTrue(isNotified[0], "Event subscriber notified");
  }
コード例 #3
0
 @PreDestroy
 void stop() {
   eventService.unsubscribe(projectCreatedEventSubscriber);
 }
コード例 #4
0
 @PostConstruct
 void start() {
   eventService.subscribe(projectCreatedEventSubscriber);
 }
コード例 #5
0
ファイル: JpaProfileDao.java プロジェクト: sleshchenko/che
 @PreDestroy
 public void unsubscribe() {
   eventService.unsubscribe(this, BeforeUserRemovedEvent.class);
 }
コード例 #6
0
ファイル: JpaProfileDao.java プロジェクト: sleshchenko/che
 @PostConstruct
 public void subscribe() {
   eventService.subscribe(this, BeforeUserRemovedEvent.class);
 }
コード例 #7
0
 @PreRemove
 private void preRemove(RecipeImpl recipe) {
   eventService.publish(new BeforeRecipeRemovedEvent(recipe));
 }