Add DataLockAPI.java
This commit is contained in:
parent
19c68e4ead
commit
3c843d4004
31
api/src/main/java/com/alttd/DataLockAPI.java
Normal file
31
api/src/main/java/com/alttd/DataLockAPI.java
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.alttd;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
|
||||||
|
public interface DataLockAPI {
|
||||||
|
|
||||||
|
static DataLockAPI get() {
|
||||||
|
return Provider.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class Provider {
|
||||||
|
private static DataLockAPI instance = null;
|
||||||
|
|
||||||
|
@ApiStatus.Internal
|
||||||
|
static void register(DataLockAPI instance) {
|
||||||
|
if (Provider.instance != null)
|
||||||
|
throw new UnsupportedOperationException("Cannot redefine singleton");
|
||||||
|
|
||||||
|
Provider.instance = instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tryLock(String channel, String data);
|
||||||
|
|
||||||
|
void tryUnlock(String channel, String data);
|
||||||
|
|
||||||
|
void registerChannel(String channel);
|
||||||
|
|
||||||
|
boolean isActiveChannel(String channel);
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user