Executing slave pipelines

From CCIL
Jump to: navigation, search

Inline

The following code is taken from the DBEnumResultSetStage class.

	@Override
	public void run() throws ExecutionException {
		ResultSet rs = getStageInput(ResultSet.class);
		int limit = confInt(StageConfig.Keys.Limit);
		String process = confStr(StageConfig.Keys.Process);

		long c = 0L;
		try {
			while (rs.next()) {
				c = c + 1L;

				// run nested pipeline
				SlavePipelineApp processApp = new SlavePipelineApp(
						LocalServer.getSubsystem(IPlatformServer.class), env,
						process);

				processApp.runContext(env.getContext(), rs, null);
				if (limit > 0 && c >= limit) {
					if (log.isInfoEnabled()) {
						log.info(String
								.format("the limit of %d has been reached, exiting store iteration..",
										limit));
					}
					break;
				}
			}

		} catch (SQLException e) {
			throw new ExecutionException("rs.next failed", e);
		}
	}