Skip to content

Commit

Permalink
Some more review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
malhotrashivam committed May 14, 2024
1 parent 5fb2586 commit c0f4192
Show file tree
Hide file tree
Showing 4 changed files with 437 additions and 415 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,27 @@
*/
public class CleanupReferenceProcessor {

private static volatile CleanupReferenceProcessor DEFAULT;

@NotNull
public static CleanupReferenceProcessor getDefault() {
if (DEFAULT == null) {
synchronized (CleanupReferenceProcessor.class) {
if (DEFAULT == null) {
DEFAULT = new CleanupReferenceProcessor("default", 1000,
(l, r, e) -> l.warn()
.append(Thread.currentThread().getName())
.append(": Exception thrown from cleanup of ").append(Utils.REFERENT_FORMATTER, r)
.append(": ").append(e)
.endl());
}
}
return Instance.DEFAULT.cleanupReferenceProcessor;
}

private enum Instance {
// @formatter:off
DEFAULT(new CleanupReferenceProcessor("default", 1000,
(l, r, e) -> l.warn()
.append(Thread.currentThread().getName())
.append(": Exception thrown from cleanup of ").append(Utils.REFERENT_FORMATTER, r)
.append(": ").append(e)
.endl())
);
// @formatter:on

private final CleanupReferenceProcessor cleanupReferenceProcessor;

Instance(@NotNull final CleanupReferenceProcessor cleanupReferenceProcessor) {
this.cleanupReferenceProcessor = Require.neqNull(cleanupReferenceProcessor, "cleanupReferenceProcessor");
}
return DEFAULT;
}

private static final Logger log = LoggerFactory.getLogger(CleanupReferenceProcessor.class);
Expand Down
Loading

0 comments on commit c0f4192

Please sign in to comment.