Skip to content
This repository was archived by the owner on Nov 26, 2023. It is now read-only.

Commit 5497e1e

Browse files
committed
Make singleton
1 parent 1350eac commit 5497e1e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/com/dunctebot/sourcemanagers/extra/YoutubeContextFilterOverride.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,17 @@ public class YoutubeContextFilterOverride extends YoutubeHttpContextFilter imple
4646
t.setDaemon(true);
4747
return t;
4848
});
49+
private static YoutubeContextFilterOverride INSTANCE;
4950

50-
public YoutubeContextFilterOverride(boolean shouldUpdate, HttpInterface httpInterface) {
51+
public synchronized static YoutubeContextFilterOverride getOrCreate(boolean shouldUpdate, HttpInterface httpInterface) {
52+
if (INSTANCE == null) {
53+
INSTANCE = new YoutubeContextFilterOverride(shouldUpdate, httpInterface);
54+
}
55+
56+
return INSTANCE;
57+
}
58+
59+
private YoutubeContextFilterOverride(boolean shouldUpdate, HttpInterface httpInterface) {
5160
this.httpInterface = httpInterface;
5261

5362
if (shouldUpdate) {

0 commit comments

Comments
 (0)