You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2016/08/31 17:41:34 UTC

[10/13] logging-log4j2 git commit: [LOG4J2-1553] AbstractManager should implement AutoCloseable.

[LOG4J2-1553] AbstractManager should implement AutoCloseable.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a0d08f3f
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a0d08f3f
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a0d08f3f

Branch: refs/heads/master
Commit: a0d08f3f7380f6cb5a814eb1acaf2ce6464e0434
Parents: e9b9ad9
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Aug 29 12:57:16 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Aug 29 12:57:16 2016 -0700

----------------------------------------------------------------------
 .../apache/logging/log4j/core/appender/AbstractManager.java    | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a0d08f3f/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
index 450d14b..4855a12 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
@@ -29,6 +29,12 @@ import org.apache.logging.log4j.status.StatusLogger;
 
 /**
  * Abstract base class used to register managers.
+ * <p>
+ * This class implements {@link AutoCloseable} mostly to allow unit tests to be written safely and succinctly. While
+ * managers do need to allocate resources (usually on construction) and then free these resources, a manager is longer
+ * lived than other auto-closeable objects like streams. None the less, making a manager AutoCloseable forces readers to
+ * be aware of the the pattern: allocate resources on construction and call {@link #close()} at some point.
+ * </p>
  */
 public abstract class AbstractManager implements AutoCloseable {