inputGate.setInputChannel(new IntermediateResultPartitionID(), inputChannels[channelIndex]);
@Override public int hashCode() { return partitionId.hashCode() ^ producerId.hashCode(); }
@Override public String toString() { return partitionId.toString() + "@" + producerId.toString(); } }
@Override public void readFrom(ByteBuf buffer) throws IOException { // TODO Directly deserialize fromNetty's buffer int length = buffer.readInt(); ByteBuffer serializedEvent = ByteBuffer.allocate(length); buffer.readBytes(serializedEvent); serializedEvent.flip(); event = (TaskEvent) EventSerializer.fromSerializedEvent(serializedEvent, getClass().getClassLoader()); partitionId = new ResultPartitionID(IntermediateResultPartitionID.fromByteBuf(buffer), ExecutionAttemptID.fromByteBuf(buffer)); receiverId = InputChannelID.fromByteBuf(buffer); } }
@Override ByteBuf write(ByteBufAllocator allocator) throws IOException { ByteBuf result = null; try { result = allocateBuffer(allocator, ID, 16 + 16 + 4 + 16); partitionId.getPartitionId().writeTo(result); partitionId.getProducerId().writeTo(result); result.writeInt(queueIndex); receiverId.writeTo(result); return result; } catch (Throwable t) { if (result != null) { result.release(); } throw new IOException(t); } }
@Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == ResultPartitionID.class) { ResultPartitionID o = (ResultPartitionID) obj; return o.getPartitionId().equals(partitionId) && o.getProducerId().equals(producerId); } return false; }
@Override public void readFrom(ByteBuf buffer) { partitionId = new ResultPartitionID(IntermediateResultPartitionID.fromByteBuf(buffer), ExecutionAttemptID.fromByteBuf(buffer)); queueIndex = buffer.readInt(); receiverId = InputChannelID.fromByteBuf(buffer); }
@Override ByteBuf write(ByteBufAllocator allocator) throws IOException { ByteBuf result = null; try { // TODO Directly serialize to Netty's buffer ByteBuffer serializedEvent = EventSerializer.toSerializedEvent(event); result = allocateBuffer(allocator, ID, 4 + serializedEvent.remaining() + 16 + 16 + 16); result.writeInt(serializedEvent.remaining()); result.writeBytes(serializedEvent); partitionId.getPartitionId().writeTo(result); partitionId.getProducerId().writeTo(result); receiverId.writeTo(result); return result; } catch (Throwable t) { if (result != null) { result.release(); } throw new IOException(t); } }
@Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == ResultPartitionID.class) { ResultPartitionID o = (ResultPartitionID) obj; return o.getPartitionId().equals(partitionId) && o.getProducerId().equals(producerId); } return false; }
public IntermediateResultPartition(IntermediateResult totalResult, ExecutionVertex producer, int partitionNumber) { this.totalResult = totalResult; this.producer = producer; this.partitionNumber = partitionNumber; this.consumers = new ArrayList<List<ExecutionEdge>>(0); this.partitionId = new IntermediateResultPartitionID(); }
static AddCredit readFrom(ByteBuf buffer) { ResultPartitionID partitionId = new ResultPartitionID( IntermediateResultPartitionID.fromByteBuf(buffer), ExecutionAttemptID.fromByteBuf(buffer)); int credit = buffer.readInt(); InputChannelID receiverId = InputChannelID.fromByteBuf(buffer); return new AddCredit(partitionId, credit, receiverId); }
@Override ByteBuf write(ByteBufAllocator allocator) throws IOException { ByteBuf result = null; try { // TODO Directly serialize to Netty's buffer ByteBuffer serializedEvent = EventSerializer.toSerializedEvent(event); result = allocateBuffer(allocator, ID, 4 + serializedEvent.remaining() + 16 + 16 + 16); result.writeInt(serializedEvent.remaining()); result.writeBytes(serializedEvent); partitionId.getPartitionId().writeTo(result); partitionId.getProducerId().writeTo(result); receiverId.writeTo(result); return result; } catch (Throwable t) { if (result != null) { result.release(); } throw new IOException(t); } }
@Override public String toString() { return partitionId.toString() + "@" + producerId.toString(); } }
@Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == ResultPartitionID.class) { ResultPartitionID o = (ResultPartitionID) obj; return o.getPartitionId().equals(partitionId) && o.getProducerId().equals(producerId); } return false; }
@Override public int hashCode() { return partitionId.hashCode() ^ producerId.hashCode(); }
public IntermediateResultPartition(IntermediateResult totalResult, ExecutionVertex producer, int partitionNumber) { this.totalResult = totalResult; this.producer = producer; this.partitionNumber = partitionNumber; this.consumers = new ArrayList<List<ExecutionEdge>>(0); this.partitionId = new IntermediateResultPartitionID(); }
static AddCredit readFrom(ByteBuf buffer) { ResultPartitionID partitionId = new ResultPartitionID( IntermediateResultPartitionID.fromByteBuf(buffer), ExecutionAttemptID.fromByteBuf(buffer)); int credit = buffer.readInt(); InputChannelID receiverId = InputChannelID.fromByteBuf(buffer); return new AddCredit(partitionId, credit, receiverId); }
@Override ByteBuf write(ByteBufAllocator allocator) throws IOException { ByteBuf result = null; try { // TODO Directly serialize to Netty's buffer ByteBuffer serializedEvent = EventSerializer.toSerializedEvent(event); result = allocateBuffer(allocator, ID, 4 + serializedEvent.remaining() + 16 + 16 + 16); result.writeInt(serializedEvent.remaining()); result.writeBytes(serializedEvent); partitionId.getPartitionId().writeTo(result); partitionId.getProducerId().writeTo(result); receiverId.writeTo(result); return result; } catch (Throwable t) { if (result != null) { result.release(); } throw new IOException(t); } }
@Override public String toString() { return partitionId.toString() + "@" + producerId.toString(); } }
@Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == ResultPartitionID.class) { ResultPartitionID o = (ResultPartitionID) obj; return o.getPartitionId().equals(partitionId) && o.getProducerId().equals(producerId); } return false; }