Search in sources :

Example 1 with NetworkOutputChannel

use of org.apache.hyracks.comm.channels.NetworkOutputChannel in project asterixdb by apache.

the class PartitionManager method registerPartition.

public synchronized void registerPartition(PartitionId pid, TaskAttemptId taId, IPartition partition, PartitionState state, boolean updateToCC) throws HyracksDataException {
    try {
        /**
             * process pending requests
             */
        NetworkOutputChannel writer = partitionRequests.remove(pid);
        if (writer != null) {
            writer.setFrameSize(partition.getTaskContext().getInitialFrameSize());
            partition.writeTo(writer);
            if (!partition.isReusable()) {
                return;
            }
        }
        /**
             * put a coming available partition into the available partition map
             */
        List<IPartition> pList = availablePartitionMap.get(pid);
        if (pList == null) {
            pList = new ArrayList<>();
            availablePartitionMap.put(pid, pList);
        }
        pList.add(partition);
        /**
             * update to CC only when necessary
             */
        if (updateToCC) {
            updatePartitionState(pid, taId, partition, state);
        }
    } catch (Exception e) {
        throw new HyracksDataException(e);
    }
}
Also used : NetworkOutputChannel(org.apache.hyracks.comm.channels.NetworkOutputChannel) IPartition(org.apache.hyracks.api.partitions.IPartition) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Aggregations

HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)1 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)1 IPartition (org.apache.hyracks.api.partitions.IPartition)1 NetworkOutputChannel (org.apache.hyracks.comm.channels.NetworkOutputChannel)1