Java pattern for normal/threaded pipelines