final JobTaskVertex t4 = new JobTaskVertex("Task 4", jg);
t4.setTaskClass(ForwardTask1Input2Outputs.class);
t4.setNumberOfSubtasks(8);
t4.setNumberOfSubtasksPerInstance(4);
// output vertex
final JobFileOutputVertex o1 = new JobFileOutputVertex("Output 1", jg);
o1.setFileOutputClass(FileLineWriter.class);
o1.setFilePath(new Path(outputFile1.toURI()));
o1.setNumberOfSubtasks(4);
o1.setNumberOfSubtasksPerInstance(2);
final JobFileOutputVertex o2 = new JobFileOutputVertex("Output 2", jg);
o2.setFileOutputClass(FileLineWriter.class);
o2.setFilePath(new Path(outputFile2.toURI()));
o2.setNumberOfSubtasks(4);
o2.setNumberOfSubtasksPerInstance(2);
o1.setVertexToShareInstancesWith(o2);
// connect vertices
i1.connectTo(t1, ChannelType.IN_MEMORY, DistributionPattern.POINTWISE);
i2.connectTo(t2, ChannelType.IN_MEMORY, DistributionPattern.POINTWISE);