Class PanamaWasiPollable
java.lang.Object
ai.tegmentum.wasmtime4j.panama.wasi.io.PanamaWasiPollable
- All Implemented Interfaces:
ai.tegmentum.wasmtime4j.wasi.io.WasiPollable,AutoCloseable
public final class PanamaWasiPollable
extends Object
implements ai.tegmentum.wasmtime4j.wasi.io.WasiPollable, AutoCloseable
Panama FFI implementation of the WasiPollable interface.
This class provides access to WASI Preview 2 pollable operations through Panama Foreign Function API calls to the native Wasmtime library. Pollables are used for event notification and blocking operations on streams.
This implementation ensures defensive programming to prevent native resource leaks and JVM crashes.
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionPanamaWasiPollable(MemorySegment contextHandle, MemorySegment pollableHandle) Creates a new Panama WASI pollable with the given native handles. -
Method Summary
-
Constructor Details
-
PanamaWasiPollable
Creates a new Panama WASI pollable with the given native handles.- Parameters:
contextHandle- the native context handlepollableHandle- the native pollable handle- Throws:
IllegalArgumentException- if either handle is null
-
-
Method Details
-
block
public void block() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
blockin interfaceai.tegmentum.wasmtime4j.wasi.io.WasiPollable- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
ready
public boolean ready() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
readyin interfaceai.tegmentum.wasmtime4j.wasi.io.WasiPollable- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
getId
public long getId() -
getType
-
isOwned
public boolean isOwned() -
isValid
public boolean isValid() -
getAvailableOperations
-
invoke
-
getLastAccessedAt
-
getCreatedAt
-
getNativeHandle
Returns the native pollable handle.- Returns:
- the native memory segment
-
isClosed
public boolean isClosed()Checks if this pollable has been closed.- Returns:
- true if closed
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-