Class WsConnection.TaskHandle
java.lang.Object
com.alibaba.dashscope.transport.ws.WsConnection.TaskHandle
- All Implemented Interfaces:
TaskChannel,AutoCloseable
- Enclosing class:
- WsConnection
One task's channel over this shared connection.
close() detaches the task only; a
binary-lane owner closed before its terminal event tears the connection down.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Idempotent.Next inbound item for this task, blocking up totimeout;nullon timeout.voidsendBinary(ByteBuffer data) Send a raw binary frame (no header; ownership rules apply on shared connections).voidSend a text frame (already-serialized JSON).taskId()
-
Method Details
-
taskId
- Specified by:
taskIdin interfaceTaskChannel
-
sendText
Description copied from interface:TaskChannelSend a text frame (already-serialized JSON). Full upstream queue → SdkException.- Specified by:
sendTextin interfaceTaskChannel
-
sendBinary
Description copied from interface:TaskChannelSend a raw binary frame (no header; ownership rules apply on shared connections).- Specified by:
sendBinaryin interfaceTaskChannel
-
recv
Description copied from interface:TaskChannelNext inbound item for this task, blocking up totimeout;nullon timeout. FAILURE events throw their carried exception.- Specified by:
recvin interfaceTaskChannel
-
close
public void close()Description copied from interface:TaskChannelIdempotent. On a shared connection this detaches the task only; if the task owns a binary lane and has not reached its terminal event, the whole shared connection is torn down instead (binary frames carry no task id, so the lane cannot be handed over safely). A local close is surfaced to a blockedTaskChannel.recv(java.time.Duration)as aLOCAL_CLOSEDevent; a binary-owner teardown is surfaced to every unfinished task, including the closer, as a terminal event instead (a thrown failure — orCLOSEDif the peer closed the connection concurrently).- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTaskChannel
-