diff --git a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java index 7eecee7d2ca2..16dbae57ef71 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java @@ -1156,7 +1156,7 @@ public class IdeEventQueue extends EventQueue { private final FrequentEventDetector myFrequentEventDetector = new FrequentEventDetector(1009, 100); @Override public void postEvent(@NotNull AWTEvent theEvent) { - myFrequentEventDetector.eventHappened(); + myFrequentEventDetector.eventHappened(theEvent); super.postEvent(theEvent); } diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/LaterInvocator.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/LaterInvocator.java index d61803d47835..0ead5ca41dcf 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/LaterInvocator.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/LaterInvocator.java @@ -47,7 +47,7 @@ import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; -@SuppressWarnings({"SSBasedInspection"}) +@SuppressWarnings("SSBasedInspection") public class LaterInvocator { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.application.impl.LaterInvocator"); private static final boolean DEBUG = LOG.isDebugEnabled(); @@ -83,7 +83,7 @@ public class LaterInvocator { private static final List ourModalEntities = ContainerUtil.createLockFreeCopyOnWriteList(); private static final List ourQueue = new ArrayList(); //protected by LOCK - private static volatile int ourQueueSkipCount = 0; // optimization + private static volatile int ourQueueSkipCount; // optimization private static final FlushQueue ourFlushQueueRunnable = new FlushQueue(); private static final Stack ourEventStack = new Stack(); // guarded by RUN_LOCK @@ -136,7 +136,7 @@ public class LaterInvocator { @NotNull static ActionCallback invokeLater(@NotNull Runnable runnable, @NotNull ModalityState modalityState, @NotNull Condition expired) { - ourFrequentEventDetector.eventHappened(); + ourFrequentEventDetector.eventHappened(runnable); final ActionCallback callback = new ActionCallback(); RunnableInfo runnableInfo = new RunnableInfo(runnable, modalityState, expired, callback); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java index 3e93027c4675..b4e9f64e558f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java @@ -77,7 +77,7 @@ public class RefreshQueueImpl extends RefreshQueue implements Disposable { public void run() { try { myRefreshIndicator.start(); - AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Doing file refresh. " + session.toString()); + AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Doing file refresh. " + session); try { doScan(session); } @@ -96,7 +96,7 @@ public class RefreshQueueImpl extends RefreshQueue implements Disposable { } } }); - myEventCounter.eventHappened(); + myEventCounter.eventHappened(session); } private void doScan(RefreshSessionImpl session) { diff --git a/platform/util/src/com/intellij/openapi/diagnostic/FrequentEventDetector.java b/platform/util/src/com/intellij/openapi/diagnostic/FrequentEventDetector.java index fda9a025efc4..3e790a9b776a 100644 --- a/platform/util/src/com/intellij/openapi/diagnostic/FrequentEventDetector.java +++ b/platform/util/src/com/intellij/openapi/diagnostic/FrequentEventDetector.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ public class FrequentEventDetector { myLevel = level; } - public void eventHappened() { + public void eventHappened(@NotNull Object event) { if (myEventsPosted.incrementAndGet() > myEventCountThreshold) { boolean shouldLog = false; @@ -75,12 +75,14 @@ public class FrequentEventDetector { logTrace = existingTraceId == null; if (logTrace) { myRecentTraces.put(trace, traceId = myLastTraceId.incrementAndGet()); - } else { + } + else { traceId = existingTraceId; } } - String message = "Too many events posted, #" + traceId + (logTrace ? "\n" + trace : ""); + String message = "Too many events posted, #" + traceId + ". Event: "+event + + (logTrace ? "\n" + trace : ""); if (myLevel == Level.INFO) { LOG.info(message); }