Skip to content

Commit

Permalink
declared finalize method in FluentLogger class again on the assumptio…
Browse files Browse the repository at this point in the history
…n that close method is not called
  • Loading branch information
muga committed Oct 27, 2011
1 parent 7ad4035 commit d5efd4d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/org/fluentd/logger/FluentLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@

import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;


public class FluentLogger {

private static Map<String, FluentLogger> loggers = new HashMap<String, FluentLogger>();
private static Map<String, FluentLogger> loggers = new WeakHashMap<String, FluentLogger>();

public static FluentLogger getLogger(String tag) {
return getLogger(tag, "localhost", 24224);
Expand Down Expand Up @@ -75,4 +76,11 @@ private void close0() {
sender = null;
}
}

@Override
public void finalize() {
if (sender != null) {
sender.close();
}
}
}

0 comments on commit d5efd4d

Please sign in to comment.