} 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()));
}
}