Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  // This software is released into the Public Domain.  See copying.txt for details.
  package org.openstreetmap.osmosis.replicationhttp.v0_6;
  import java.util.Map;
This task connects to a replication data server to obtain replication data, then sends the replication data to the sink. This requires the change sink to support the replication extensions allowing state persistence and multiple invocations.

Brett Henderson
 public class ReplicationDataClient implements RunnableChangeSource {
 	private String pathPrefix;

Creates a new instance.

serverAddress The server to connect to.
pathPrefix The base path to add to the URL. This is necessary if a data server is sitting behind a proxy server that adds a prefix to the request path.
 	public ReplicationDataClient(InetSocketAddress serverAddressString pathPrefix) {
 		this. = serverAddress;
 		this. = pathPrefix;
 	public void setChangeSink(ChangeSink changeSink) {
 	public void run() {
 		try {
 			// Create a sequence client restart manager so that our sequence
 			// client continues processing in the face of temporary connectivity
 			// issues.
 			// Create the client for receiving replication data.
 							clientRestartManager.getControl(), .getHostName(),
 			SequenceClient client = new SequenceClient(pipelineFactory);
 			// Run the client and perform restarts if it fails. This call will
 			// block.
 		} finally {

This acts as a proxy between the sequence client and the real change sink. The primary purpose is to prevent the release method from being called until all processing has completed.
 	private static class NoReleaseChangeSinkWrapper implements ChangeSinkChangeSource {
 		private ChangeSink changeSink;
 		public void setChangeSink(ChangeSink changeSink) {
 			this. = changeSink;
 		public void initialize(Map<StringObjectmetaData) {
		public void process(ChangeContainer change) {
		public void complete() {
		public void release() {
			// Do nothing.

Called by the main replication data client when all processing is complete. Unlike the release method which does nothing, this calls the change sink release method.
		public void realRelease() {
New to GrepCode? Check out our FAQ X