Class LocalOutputContext
- java.lang.Object
-
- org.apache.nemo.runtime.executor.transfer.LocalTransferContext
-
- org.apache.nemo.runtime.executor.transfer.LocalOutputContext
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,OutputContext
public final class LocalOutputContext extends LocalTransferContext implements OutputContext
This class provides a data transfer interface to the sender side when both the sender and the receiver are in the same executor. Since data serialization is unnecessary, the sender sends data without serializing them. A single local output context represents a data transfer between two tasks.
-
-
Constructor Summary
Constructors Constructor Description LocalOutputContext(java.lang.String executorId, java.lang.String edgeId, int srcTaskIndex, int dstTaskIndex)
Creates a new local output context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this local output context.java.util.concurrent.LinkedBlockingQueue
getQueue()
Accessor method for the queue in this local output context.boolean
isClosed()
Checks whether the context has been closed.TransferOutputStream
newOutputStream()
Creates a new output stream to which the sender sends its data.-
Methods inherited from class org.apache.nemo.runtime.executor.transfer.LocalTransferContext
getDstTaskIndex, getEdgeId, getExecutorId, getSrcTaskIndex
-
-
-
-
Constructor Detail
-
LocalOutputContext
public LocalOutputContext(java.lang.String executorId, java.lang.String edgeId, int srcTaskIndex, int dstTaskIndex)
Creates a new local output context.- Parameters:
executorId
- id of the executor to which this context belongedgeId
- id of the DAG edgesrcTaskIndex
- source task indexdstTaskIndex
- destination task index
-
-
Method Detail
-
close
public void close()
Closes this local output context.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceOutputContext
-
getQueue
public java.util.concurrent.LinkedBlockingQueue getQueue() throws java.lang.RuntimeException
Accessor method for the queue in this local output context.- Returns:
- queue to which the sender writes its data.
- Throws:
java.lang.RuntimeException
- if the context has already been closed.
-
isClosed
public boolean isClosed()
Checks whether the context has been closed. It is for testing purpose.- Returns:
- true if the context has been closed.
-
newOutputStream
public TransferOutputStream newOutputStream()
Creates a new output stream to which the sender sends its data.- Specified by:
newOutputStream
in interfaceOutputContext
- Returns:
- output stream of this local output context
-
-