private void handleVertexStateUpdate(VertexStateUpdate stateUpdate) { Preconditions.checkArgument( stateUpdate.getVertexState() == VertexState.CONFIGURED, "Received incorrect state notification : " + stateUpdate.getVertexState() + " for vertex: " + stateUpdate.getVertexName() + " in vertex: " + getContext().getVertexName()); Preconditions.checkArgument( srcVertexInfo.containsKey(stateUpdate.getVertexName()), "Received incorrect vertex notification : " + stateUpdate.getVertexState() + " for vertex: " + stateUpdate.getVertexName() + " in vertex: " + getContext().getVertexName()); SourceVertexInfo vInfo = srcVertexInfo.get(stateUpdate.getVertexName()); Preconditions.checkState(vInfo.vertexIsConfigured == false); vInfo.vertexIsConfigured = true; LOG.info( "Received configured notification : " + stateUpdate.getVertexState() + " for vertex: " + stateUpdate.getVertexName() + " in vertex: " + getContext().getVertexName()); schedulePendingTasks(); }
@Override public synchronized void onVertexStateUpdated(VertexStateUpdate stateUpdate) { if (stateUpdate.getVertexState() == VertexState.CONFIGURED) { // we will not register for updates until our vertex starts. // derived classes can make other update requests for other states that we should // ignore. However that will not be allowed until the state change notified supports // multiple registers for the same vertex if (onVertexStartedDone.get()) { // normally this if check will always be true because we register after vertex // start. handleVertexStateUpdate(stateUpdate); } else { // normally this code will not trigger since we are the ones who register for // the configured states updates and that will happen after vertex starts. // So this code will only trigger if a derived class also registers for updates // for the same vertices but multiple registers to the same vertex is currently // not supported by the state change notifier code. This is just future proofing // when that is supported // vertex not started yet. So edge info may not have been defined correctly yet. pendingStateUpdates.add(stateUpdate); } } }