You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by nt...@apache.org on 2015/08/11 10:46:38 UTC
[08/50] incubator-ignite git commit: IGNITE-1157 Fix problems found
on review.
IGNITE-1157 Fix problems found on review.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a1543cfe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a1543cfe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a1543cfe
Branch: refs/heads/ignite-1108
Commit: a1543cfe4ce435adcc08e3680d19da8b63a3d945
Parents: 45aa598
Author: sevdokimov <se...@gridgain.com>
Authored: Mon Aug 3 15:22:27 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Mon Aug 3 15:22:27 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/GridLogThrottle.java | 36 ++++++++++++++------
1 file changed, 26 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1543cfe/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
index f37cfea..607b17b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
@@ -18,9 +18,9 @@
package org.apache.ignite.internal.util;
import org.apache.ignite.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
import org.jetbrains.annotations.*;
import org.jsr166.*;
@@ -42,7 +42,7 @@ public class GridLogThrottle {
private static int throttleTimeout = DFLT_THROTTLE_TIMEOUT;
/** Errors. */
- private static final ConcurrentMap<GridTuple3<Class<? extends Throwable>, String, Boolean>, Long> errors =
+ private static final ConcurrentMap<IgniteBiTuple<Class<? extends Throwable>, String>, Long> errors =
new ConcurrentHashMap8<>();
/**
@@ -95,6 +95,7 @@ public class GridLogThrottle {
* @param log Logger.
* @param e Error (optional).
* @param msg Message.
+ * @param quite Print warning anyway.
*/
public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String msg, boolean quite) {
assert !F.isEmpty(msg);
@@ -121,11 +122,22 @@ public class GridLogThrottle {
*
* @param log Logger.
* @param msg Message.
+ * @param quite Print info anyway.
*/
- public static void info(@Nullable IgniteLogger log, String msg) {
+ public static void info(@Nullable IgniteLogger log, String msg, boolean quite) {
assert !F.isEmpty(msg);
- log(log, null, msg, null, LogLevel.INFO, false);
+ log(log, null, msg, null, LogLevel.INFO, quite);
+ }
+
+ /**
+ * Logs info if needed.
+ *
+ * @param log Logger.
+ * @param msg Message.
+ */
+ public static void info(@Nullable IgniteLogger log, String msg) {
+ info(log, msg, false);
}
/**
@@ -149,9 +161,9 @@ public class GridLogThrottle {
LogLevel level, boolean quiet) {
assert !F.isEmpty(longMsg);
- GridTuple3<Class<? extends Throwable>, String, Boolean> tup =
- e != null ? F.<Class<? extends Throwable>, String, Boolean>t(e.getClass(), e.getMessage(), quiet) :
- F.<Class<? extends Throwable>, String, Boolean>t(null, longMsg, quiet);
+ IgniteBiTuple<Class<? extends Throwable>, String> tup =
+ e != null ? F.<Class<? extends Throwable>, String>t(e.getClass(), e.getMessage()) :
+ F.<Class<? extends Throwable>, String>t(null, longMsg);
while (true) {
Long loggedTs = errors.get(tup);
@@ -177,7 +189,7 @@ public class GridLogThrottle {
* @param newStamp New timestamp.
* @return {@code True} if throttle value was replaced.
*/
- private static boolean replace(GridTuple3<Class<? extends Throwable>, String, Boolean> t, @Nullable Long oldStamp,
+ private static boolean replace(IgniteBiTuple<Class<? extends Throwable>, String> t, @Nullable Long oldStamp,
Long newStamp) {
assert newStamp != null;
@@ -222,8 +234,12 @@ public class GridLogThrottle {
/** Info level. */
INFO {
@Override public void doLog(IgniteLogger log, String longMsg, String shortMsg, Throwable e, boolean quiet) {
- if (log.isInfoEnabled())
- log.info(longMsg);
+ if (quiet)
+ U.quietAndInfo(log, longMsg);
+ else {
+ if (log.isInfoEnabled())
+ log.info(longMsg);
+ }
}
};