Examples of RemoteReceiver


Examples of eu.stratosphere.runtime.io.network.RemoteReceiver

      } else {
        // Receiver runs on a different task manager
        final InstanceConnectionInfo ici = assignedInstance.getInstanceConnectionInfo();
        final InetSocketAddress isa = new InetSocketAddress(ici.address(), ici.dataPort());

        return ConnectionInfoLookupResponse.createReceiverFoundAndReady(new RemoteReceiver(isa, edge.getConnectionID()));
      }
    }
    // else, the request is for an output channel
    // Find vertex of connected input channel
    final ExecutionVertex targetVertex = edge.getInputGate().getVertex();

    // Check execution state
    final ExecutionState executionState = targetVertex.getExecutionState();

    // check whether the task needs to be deployed
    if (executionState != ExecutionState.RUNNING && executionState != ExecutionState.FINISHING && executionState != ExecutionState.FINISHED) {

      if (executionState == ExecutionState.ASSIGNED) {
        final Runnable command = new Runnable() {
          @Override
          public void run() {
            scheduler.deployAssignedVertices(targetVertex);
          }
        };
        eg.executeCommand(command);
      }

      // LOG.info("Created receiverNotReady for " + targetVertex + " in state " + executionState + " 3");
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }

    final AbstractInstance assignedInstance = targetVertex.getAllocatedResource().getInstance();
    if (assignedInstance == null) {
      LOG.error("Cannot resolve lookup: vertex found for channel ID " + edge.getInputChannelID() + " but no instance assigned");
      // LOG.info("Created receiverNotReady for " + targetVertex + " in state " + executionState + " 4");
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }

    if (assignedInstance.getInstanceConnectionInfo().equals(caller)) {
      // Receiver runs on the same task manager
      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(edge.getInputChannelID());
    } else {
      // Receiver runs on a different task manager
      final InstanceConnectionInfo ici = assignedInstance.getInstanceConnectionInfo();
      final InetSocketAddress isa = new InetSocketAddress(ici.address(), ici.dataPort());

      return ConnectionInfoLookupResponse.createReceiverFoundAndReady(new RemoteReceiver(isa, edge.getConnectionID()));
    }
  }
View Full Code Here

Examples of eu.stratosphere.runtime.io.network.RemoteReceiver

    StringBuilder str = new StringBuilder();

    str.append(String.format("==== %d outgoing connections ===\n", this.outConnections.size()));

    for (Map.Entry<RemoteReceiver, Object> entry : this.outConnections.entrySet()) {
      RemoteReceiver receiver = entry.getKey();

      Object value = entry.getValue();
      if (value instanceof OutboundConnectionQueue) {
        OutboundConnectionQueue queue = (OutboundConnectionQueue) value;
        if (queue.getNumQueuedEnvelopes() > 0) {
View Full Code Here

Examples of eu.stratosphere.runtime.io.network.RemoteReceiver

    // start sender threads
    // --------------------------------------------------------------------
    RemoteReceiver[] receivers = new RemoteReceiver[this.numChannels];

    for (int i = 0; i < this.numChannels; i++) {
      receivers[i] = new RemoteReceiver(new InetSocketAddress(localhost, BIND_PORT + 1), i);
    }

    for (int i = 0; i < this.numSubtasks; i++) {
      RemoteReceiver receiver = receivers[random.nextInt(this.numChannels)];
      new Thread(new SubtaskSenderThread(connManagerToTest, receiver)).start();
    }

    latch.await();
View Full Code Here

Examples of org.apache.flink.runtime.io.network.RemoteReceiver

          // Receiver runs on a different task manager
          final InstanceConnectionInfo ici = location.getInstanceConnectionInfo();
          final InetSocketAddress isa = new InetSocketAddress(ici.address(), ici.dataPort());

          int connectionIdx = edge.getSource().getIntermediateResult().getConnectionIndex();
          return ConnectionInfoLookupResponse.createReceiverFoundAndReady(new RemoteReceiver(isa, connectionIdx));
        }
      }
      else if (executionState == ExecutionState.FINISHED) {
        // that should not happen. if there is data pending, the sender cannot yet be done
        // we need to fail the whole affair
        LOG.error("Receiver " + targetVertex + " set to FINISHED even though data is pending");
        fail(new Exception("Channels are not correctly registered"));
        return ConnectionInfoLookupResponse.createReceiverNotFound();
      }
      else if (executionState == ExecutionState.FAILED || executionState == ExecutionState.CANCELED ||
          executionState == ExecutionState.CANCELING)
      {
        return ConnectionInfoLookupResponse.createJobIsAborting();
      }
      else {
        // all other states should not be, because the sender cannot be in CREATED, SCHEDULED, or DEPLOYING
        // state when the receiver is already running
        LOG.error("Channel lookup (backwards) - sender " + targetVertex + " found in inconsistent state " + executionState);
        fail(new Exception("Channels are not correctly registered"));
        return ConnectionInfoLookupResponse.createReceiverNotFound();
      }
    }
   
    //  ----- Request was sent from an output channel (sender side), requesting the input channel (receiver side) ------
    //  -----                                 This is the case for forward data                                   ------
   
    final ExecutionVertex targetVertex = edge.getTarget();
    final ExecutionState executionState = targetVertex.getExecutionState();

    if (executionState == ExecutionState.RUNNING) {
     
      // already online
      Instance location = targetVertex.getCurrentAssignedResource().getInstance();
     
      if (location.getInstanceConnectionInfo().equals(caller)) {
        // Receiver runs on the same task manager
        return ConnectionInfoLookupResponse.createReceiverFoundAndReady(edge.getInputChannelId());
      }
      else {
        // Receiver runs on a different task manager
        final InstanceConnectionInfo ici = location.getInstanceConnectionInfo();
        final InetSocketAddress isa = new InetSocketAddress(ici.address(), ici.dataPort());

        final int connectionIdx = edge.getSource().getIntermediateResult().getConnectionIndex();
        return ConnectionInfoLookupResponse.createReceiverFoundAndReady(new RemoteReceiver(isa, connectionIdx));
      }
    }
    else if (executionState == ExecutionState.DEPLOYING || executionState == ExecutionState.SCHEDULED) {
      return ConnectionInfoLookupResponse.createReceiverNotReady();
    }
View Full Code Here

Examples of org.apache.flink.runtime.io.network.RemoteReceiver

    // start sender threads
    // --------------------------------------------------------------------
    RemoteReceiver[] receivers = new RemoteReceiver[numChannels];

    for (int i = 0; i < numChannels; i++) {
      receivers[i] = new RemoteReceiver(new InetSocketAddress(localhost, BIND_PORT + 1), i);
    }

    for (int i = 0; i < numSubtasks; i++) {
      final RemoteReceiver receiver = receivers[random.nextInt(numChannels)];

      final AtomicInteger seqNum = new AtomicInteger(0);
      final JobID jobId = new JobID();
      final ChannelID channelId = new ChannelID();
View Full Code Here

Examples of org.apache.flink.runtime.io.network.RemoteReceiver

    StringBuilder str = new StringBuilder();

    str.append(String.format("==== %d outgoing connections ===\n", this.outConnections.size()));

    for (Map.Entry<RemoteReceiver, Object> entry : this.outConnections.entrySet()) {
      RemoteReceiver receiver = entry.getKey();

      Object value = entry.getValue();
      if (value instanceof OutboundConnectionQueue) {
        OutboundConnectionQueue queue = (OutboundConnectionQueue) value;
        if (queue.getNumQueuedEnvelopes() > 0) {
View Full Code Here

Examples of org.javatari.atari.network.RemoteReceiver

    plugConsole(serverConsole);
    return serverConsole;
  }
 
  protected ClientConsole buildAndPlugClientConsole() {
    RemoteReceiver remoteReceiver = new RemoteReceiver();
    clientConsole = new ClientConsole(remoteReceiver);
    plugConsole(clientConsole);
    return clientConsole;
 
View Full Code Here

Examples of org.javatari.atari.network.RemoteReceiver

      room.morphToClientMode();
      SwingHelper.edtInvokeLater(new Runnable() { @Override public void run() {
        setupConnectionStatusListeners();
        String serverAddress = "";
        try {
          RemoteReceiver receiver = room.clientCurrentConsole().remoteReceiver();
          serverAddress = clientServerAddressTf.getText().trim();
          receiver.connect(serverAddress);
          closeAction();
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(null, "Connection failed: " + serverAddress + "\n" + ex, "javatari P2 Client", JOptionPane.ERROR_MESSAGE);
          room.morphToStandaloneMode();
        }
        refreshMultiplayer();
        gray(false);
      }});
    } else // Will try to DISCONNECT
      try {
        RemoteReceiver receiver = room.clientCurrentConsole().remoteReceiver();
        receiver.disconnect();
        room.morphToStandaloneMode();
      } catch (Exception ex) {
        JOptionPane.showMessageDialog(null, "Error disconnecting from Server:\n" + ex, "javatari P2 Client", JOptionPane.ERROR_MESSAGE);
      }
      refreshMultiplayer();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.