net.minestom.server.thread.AcquirableSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minestom-snapshots Show documentation
Show all versions of minestom-snapshots Show documentation
1.20.4 Lightweight Minecraft server
package net.minestom.server.thread;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.function.Consumer;
/**
* An object that is a source of {@link Acquirable} objects, and can be synchronized within a {@link ThreadDispatcher}.
*
* @param the type of the acquired object
*/
@ApiStatus.Experimental
public interface AcquirableSource {
/**
* Obtains an {@link Acquirable}. To safely perform operations on this object, the user must call
* {@link Acquirable#sync(Consumer)}, {@link Acquirable#async(Consumer)}, or {@link Acquirable#lock()} (followed by
* a subsequent unlock) on the Acquirable instance.
*
* @return an Acquirable which can be used to synchronize access to this object
*/
@NotNull Acquirable extends T> acquirable();
}