PacketConsumerUtil


@ExperimentalApi
public static class PacketConsumerUtil


Summary

Public fields

static @NonNull PacketConsumerUtil

Public methods

static final @NonNull ListenableFuture<Void>
<T extends Object> release(
    @NonNull PacketConsumer<@NonNull T> consumer,
    @NonNull ExecutorService executor
)

Releases the PacketConsumer from Java by wrapping the suspend call in a ListenableFuture.

Public fields

INSTANCE

public static @NonNull PacketConsumerUtil INSTANCE

Public methods

release

public static final @NonNull ListenableFuture<Void> <T extends Object> release(
    @NonNull PacketConsumer<@NonNull T> consumer,
    @NonNull ExecutorService executor
)

Releases the PacketConsumer from Java by wrapping the suspend call in a ListenableFuture.

Parameters
@NonNull PacketConsumer<@NonNull T> consumer

The PacketConsumer to release.

@NonNull ExecutorService executor

The ExecutorService to launch the coroutine on.

Returns
@NonNull ListenableFuture<Void>

A ListenableFuture that completes when the consumer has been released.