forked from opensearch-project/security
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrey Pleskach <[email protected]>
- Loading branch information
1 parent
5de9686
commit 329f4de
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/net/shibboleth/shared/primitive/CleanerSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package net.shibboleth.shared.primitive; | ||
|
||
import java.lang.ref.Cleaner; | ||
import javax.annotation.Nonnull; | ||
|
||
import org.opensearch.common.util.concurrent.OpenSearchExecutors; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public final class CleanerSupport { | ||
@Nonnull | ||
private static final Logger LOG = LoggerFactory.getLogger(CleanerSupport.class); | ||
|
||
private CleanerSupport() {} | ||
|
||
@Nonnull | ||
public static Cleaner getInstance(@Nonnull final Class<?> requester) { | ||
LOG.debug("Creating new java.lang.ref.Cleaner instance requested by class: {}", requester.getName()); | ||
return Cleaner.create(OpenSearchExecutors.daemonThreadFactory("cleaners")); | ||
} | ||
} |