Interface CallContext


public interface CallContext
One accepted call; retaining this object does not prolong its lifetime.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    java.time.Instant
     
    java.util.concurrent.CompletionStage<CallContext.End>
    Completes once, after the host commits the terminal state; useful for releasing resources.
    boolean
     
    <T> java.util.concurrent.CompletionStage<T>
    onClient(java.util.concurrent.Callable<T> action)
    Schedules a small action on the client thread.
    java.util.concurrent.CompletionStage<byte[]>
    readArtifact(java.lang.String artifactId)
    Reads an imported artifact by its opaque ID from this call's Bridge connection.
    java.lang.String
     
    java.lang.String
    Empty if no task owns this read-only call.
     
  • Method Details

    • requestId

      java.lang.String requestId()
    • world

      WorldContext world()
    • taskId

      java.lang.String taskId()
      Empty if no task owns this read-only call. The host gates task-owned calls on task lifetime.
    • deadline

      java.time.Instant deadline()
    • isActive

      boolean isActive()
    • ended

      java.util.concurrent.CompletionStage<CallContext.End> ended()
      Completes once, after the host commits the terminal state; useful for releasing resources.
    • onClient

      <T> java.util.concurrent.CompletionStage<T> onClient(java.util.concurrent.Callable<T> action)
      Schedules a small action on the client thread. Request, world and task lifetimes are checked again when it executes; a retired task cannot publish a late result through this method. Does not grant access to server-owned objects or permission to change game state.
    • readArtifact

      java.util.concurrent.CompletionStage<byte[]> readArtifact(java.lang.String artifactId)
      Reads an imported artifact by its opaque ID from this call's Bridge connection. The host rechecks admission on the client thread and performs bounded network I/O on a worker. The returned bytes belong to the caller; this method neither publishes nor persists them. Paths and URLs are not accepted. Availability ends with this call, including world exit, cancellation and expiry. Cancelling an observation does not cancel the host's transfer. Declare the ID parameter with format: "agentbridge-artifact" so the host retains it while the call is queued or running. An undeclared ID may already have been reclaimed.

      Completion does not require another game tick. Do not wait for it on the client thread; use onClient(Callable) for subsequent presentation or game access.

      Parameters:
      artifactId - ID returned by the Bridge's artifact import operation
      Returns:
      asynchronous content or a structured diagnostic failure