Package org.apache.flink.runtime.io.network.channels

Examples of org.apache.flink.runtime.io.network.channels.ChannelID


    final EmbeddedChannel channel = new EmbeddedChannel(new OutboundEnvelopeEncoder());

    int numBuffers = 0;
    for (int i = 0; i < NUM_RANDOM_ENVELOPES; i++) {
      Envelope env = new Envelope(i, new JobID(), new ChannelID());
      int expectedEncodedMsgSize = OutboundEnvelopeEncoder.HEADER_SIZE;

      if (random.nextBoolean()) {
        int eventsSize = random.nextInt(MAX_EVENTS_SIZE + 1);
        expectedEncodedMsgSize += eventsSize;
View Full Code Here


    if (in.readBoolean()) {
      this.remoteTarget = new RemoteReceiver();
      this.remoteTarget.read(in);
    }
    if (in.readBoolean()) {
      this.localTarget = new ChannelID();
      this.localTarget.read(in);
    }
  }
View Full Code Here

  /**
   * Default constructor for serialization/deserialization.
   */
  public ChannelDeploymentDescriptor() {
    this.outputChannelID = new ChannelID();
    this.inputChannelID = new ChannelID();
  }
View Full Code Here

  public ExecutionEdge(IntermediateResultPartition source, ExecutionVertex target, int inputNum) {
    this.source = source;
    this.target = target;
    this.inputNum = inputNum;
   
    this.inputChannelId = new ChannelID();
    this.outputChannelId = new ChannelID();
  }
View Full Code Here

  public ChannelID getOutputChannelId() {
    return outputChannelId;
  }
 
  public void assignNewChannelIDs() {
    inputChannelId = new ChannelID();
    outputChannelId = new ChannelID();
  }
View Full Code Here

              "number in current envelope header.");
        }

        int seqNum = this.headerBuffer.getInt();
        JobID jobId = JobID.fromByteBuffer(this.headerBuffer);
        ChannelID sourceId = ChannelID.fromByteBuffer(this.headerBuffer);

        this.currentEnvelope = new Envelope(seqNum, jobId, sourceId);

        int eventsSize = this.headerBuffer.getInt();
        int bufferSize = this.headerBuffer.getInt();

        this.currentEventsBuffer = eventsSize > 0 ? ByteBuffer.allocate(eventsSize) : null;
        this.currentBufferRequestSize = bufferSize > 0 ? bufferSize : 0;

        this.headerBuffer.clear();
      }
    }

    // --------------------------------------------------------------------
    // (2) events (var length)
    // --------------------------------------------------------------------
    if (this.currentEventsBuffer != null) {
      copy(in, this.currentEventsBuffer);

      if (this.currentEventsBuffer.hasRemaining()) {
        return DecoderState.PENDING;
      }
      else {
        this.currentEventsBuffer.flip();
        this.currentEnvelope.setEventsSerialized(this.currentEventsBuffer);
        this.currentEventsBuffer = null;
      }
    }

    // --------------------------------------------------------------------
    // (3) buffer (var length)
    // --------------------------------------------------------------------
    // (a) request a buffer from OUR pool
    if (this.currentBufferRequestSize > 0) {
      JobID jobId = this.currentEnvelope.getJobID();
      ChannelID sourceId = this.currentEnvelope.getSource();
      Buffer buffer = requestBufferForTarget(jobId, sourceId, this.currentBufferRequestSize);

      if (buffer == null) {
        return DecoderState.NO_BUFFER_AVAILABLE;
      }
View Full Code Here

   * Tests the constructor of the {@link ChannelDeploymentDescriptor} class with valid arguments.
   */
  @Test
  public void testConstructorWithValidArguments() {

    final ChannelID outputChannelID = new ChannelID();
    final ChannelID inputChannelID = new ChannelID();

    final ChannelDeploymentDescriptor cdd = new ChannelDeploymentDescriptor(outputChannelID, inputChannelID);

    assertEquals(outputChannelID, cdd.getOutputChannelID());
    assertEquals(inputChannelID, cdd.getInputChannelID());
View Full Code Here

   * Tests the constructor of the {@link ChannelDeploymentDescriptor} class with invalid arguments.
   */
  @Test
  public void testConstructorWithInvalidArguments() {

    final ChannelID channelID = new ChannelID();

    boolean firstExceptionCaught = false;
    boolean secondExceptionCaught = false;

    try {
View Full Code Here

   * Tests the serialization/deserialization of the {@link ChannelDeploymentDescriptor} class.
   */
  @Test
  public void testSerialization() {

    final ChannelID outputChannelID = new ChannelID();
    final ChannelID inputChannelID = new ChannelID();

    final ChannelDeploymentDescriptor orig = new ChannelDeploymentDescriptor(outputChannelID, inputChannelID);

    ChannelDeploymentDescriptor copy = null;

View Full Code Here

      JobVertexID vid2 = new JobVertexID();
     
      ExecutionAttemptID eid1 = new ExecutionAttemptID();
      ExecutionAttemptID eid2 = new ExecutionAttemptID();
     
      ChannelID senderId = new ChannelID();
      ChannelID receiverId = new ChannelID();
     
      jobManager = getJobManagerMockBase();
      when(jobManager.lookupConnectionInfo(Matchers.any(InstanceConnectionInfo.class), Matchers.eq(jid), Matchers.eq(senderId)))
        .thenReturn(ConnectionInfoLookupResponse.createReceiverFoundAndReady(receiverId));
     
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.io.network.channels.ChannelID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.