Restores the given checkpointed components from a composite checkpoint.

This is the complement of {@link #writeToCheckpoint(OutputStream, List)}.

@param input the stream to read from
@param components the components to restore
515483
public static void restoreFromCheckpoint(CheckpointInputStream input,
      List<? extends Checkpointed> components) throws IOException {
    CompoundCheckpointReader reader = new CompoundCheckpointReader(input);
    Optional<Entry> next;
    while ((next = reader.nextCheckpoint()).isPresent()) {
      Entry nextEntry = next.get();
      boolean found = false;
      for (Checkpointed component : components) {
        if (component.getCheckpointName().equals(nextEntry.getName())) {
          component.restoreFromCheckpoint(nextEntry.getStream());
          found = true;
          break;
        }
      }
      if (!found) {
        throw new RuntimeException(String.format(
            "Unrecognized checkpoint name: %s. Existing components: %s", nextEntry.getName(), Arrays
                .toString(StreamUtils.map(Checkpointed::getCheckpointName, components).toArray())));
      }
    }
  }
1086345
void hoistExterns(ImmutableList<CompilerInput> originalInputs) {
    boolean staleInputs = false;

    for (CompilerInput input : originalInputs) {
      if (hoistIfExtern(input)) {
        staleInputs = true;
      }
    }
    if (staleInputs) {
      repartitionInputs();
    }
  }
875089
public void process(InputStream input) throws IOException, ConverterException {
        while (0 != input.available()) {
            Tag tag = ParserUtils.parseTag(input);
            TagHandler handler = getHandler(tag);
            if (null == handler) {
                skipHandler.handle(tag, input);
            } else {
                handler.handle(tag, input);
            }
        }
    }
1361329
public synchronized void writeToCheckpoint(OutputStream output)
      throws IOException, InterruptedException {
    LOG.info("Creating rocksdb checkpoint at {}", mDbCheckpointPath);
    long startNano = System.nanoTime();

    CheckpointOutputStream out = new CheckpointOutputStream(output, CheckpointType.ROCKS);
    try {
      // createCheckpoint requires that the directory not already exist.
      FileUtils.deletePathRecursively(mDbCheckpointPath);
      mCheckpoint.createCheckpoint(mDbCheckpointPath);
    } catch (RocksDBException e) {
      throw new IOException(e);
    }
    LOG.info("Checkpoint complete, creating tarball");
    TarUtils.writeTarGz(Paths.get(mDbCheckpointPath), out);
    LOG.info("Completed rocksdb checkpoint in {}ms", (System.nanoTime() - startNano) / 1_000_000);
    // Checkpoint is no longer needed, delete to save space.
    FileUtils.deletePathRecursively(mDbCheckpointPath);
  }
369062
@Deprecated
	public void setSecondInputs(List<Operator<IN2>> inputs) {
		this.input2 = Operator.createUnionCascade(inputs);
	}
228477
@Deprecated
	@SuppressWarnings("unchecked")
	public void addInput(List<Operator<IN>> inputs) {
		this.input = Operator.createUnionCascade(this.input, inputs.toArray(new Operator[inputs.size()]));
	}
197563
@Override
	public void execute(Tuple input) {
		// write the tuple to a JMS destination...
		LOG.debug("Tuple received. Sending JMS message.");
		
		try {
			Message msg = this.producer.toMessage(this.session, input);
			if(msg != null){
				if (msg.getJMSDestination() != null) {
					this.messageProducer.send(msg.getJMSDestination(), msg);
				} else {
					this.messageProducer.send(msg);
				}
			}
			if(this.autoAck){
				LOG.debug("ACKing tuple: " + input);
				this.collector.ack(input);
			}		
		} catch (JMSException e) {
			// failed to send the JMS message, fail the tuple fast
			LOG.warn("Failing tuple: " + input);
			LOG.warn("Exception: ", e);
			this.collector.fail(input);
		}
	}
293248
public void resource(InputStream input) {
        checkCommitted();
        finalizeResponse();

        // content type to OCTET_STREAM if it's not set
        if (getContentType() == null) {
            contentType(HttpConstants.ContentType.APPLICATION_OCTET_STREAM);
        }

        try {
            send(input);
        } catch (IOException e) {
            throw new PippoRuntimeException(e);
        }
    }
39172
public void init(UpgradeInputByteBufferUtil input)
    {    
        this._inBuffer = input;
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {  
            Tr.debug(tc, "init upgrade input");         
        } 
    }
434029
private String crc(InputStream input) {
    if (input == null)
      throw new IllegalArgumentException("input cannot be null.");
    CRC32 crc = new CRC32();
    byte[] buffer = new byte[4096];
    try {
      while (true) {
        int length = input.read(buffer);
        if (length == -1) break;
        crc.update(buffer, 0, length);
      }
    } catch (Exception ex) {
      try {
        input.close();
      } catch (Exception ignored) {
      }
    }
    return Long.toString(crc.getValue());
  }
370985
@Override
	public void updateCheckpointData(CheckpointDataKey key, CheckpointData value) {
		logger.entering(CLASSNAME, "updateCheckpointData", new Object[] {key, value});
		CheckpointData data = queryCheckpointData(key.getCommaSeparatedKey());
		if(data != null) {
			updateCheckpointData(key.getCommaSeparatedKey(), value);
		} else {
			createCheckpointData(key, value);
		}
		logger.exiting(CLASSNAME, "updateCheckpointData");
	}
626190
public StepExecution withInputs(java.util.Map<String, String> inputs) {
        setInputs(inputs);
        return this;
    }
353811
@Override
    @Deprecated
    public void resetReadersToCheckpoint(Checkpoint checkpoint) {
        synchronizer.updateState((state, updates) -> {
            ReaderGroupConfig config = state.getConfig();
            Map<Segment, Long> positions = new HashMap<>();
            for (StreamCut cut : checkpoint.asImpl().getPositions().values()) {
                positions.putAll(cut.asImpl().getPositions());
            }
            updates.add(new ReaderGroupStateInit(config, positions, getEndSegmentsForStreams(config)));
        });
    }
1221349
private void updateComponents(Collection<ComponentContext<?>> components, final CountingCompletionHandler<Void> complete) {
    for (final ComponentContext<?> component : components) {
      final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(component.instances().size());
      counter.setHandler(new Handler<AsyncResult<Void>>() {
        @Override
        public void handle(AsyncResult<Void> result) {
          if (result.failed()) {
            complete.fail(result.cause());
          } else {
            complete.succeed();
          }
        }
      });
      updateInstances(component.instances(), counter);
    }
  }
1143250
public static <T extends Savepoint> void storeCheckpointMetadata(
			T checkpointMetadata,
			OutputStream out) throws IOException {

		DataOutputStream dos = new DataOutputStream(out);
		storeCheckpointMetadata(checkpointMetadata, dos);
	}
435605
@Override
	public void setInput( Input input ) {
		super.setInput(input);
		orientation.reshape(input.width,input.height);
		magnitude.reshape(input.width,input.height);

		computePixelFeatures();
	}
628665
protected void process(T input) {
        try {
            Optional.ofNullable(this.transformFunction.apply(input))
                    .ifPresent(this.outputPublisher::submit);
        } catch (Exception e) {
            JMExceptionManager.handleException(log, e, "process", input);
        }
    }