----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/19236/#review37315 -----------------------------------------------------------
Rather than adding yet another Builder, which could easily confuse people, I think it is better to: 1. Expose and improve the internal Default implementation of the specifications so that user can freely create specification programmatically if needed. 2. Improve the existing builder pattern to make it less verbose. - Terence Yim On March 14, 2014, 9:01 p.m., Jiahua Wang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/19236/ > ----------------------------------------------------------- > > (Updated March 14, 2014, 9:01 p.m.) > > > Review request for Twill. > > > Repository: twill > > > Description > ------- > > Added TwillSpecification.FlexBuilder and ResourceSpecification.FlexBuilder > for more flexible building. > > > Diffs > ----- > > twill-api/src/main/java/org/apache/twill/api/ResourceSpecification.java > 7600041 > twill-api/src/main/java/org/apache/twill/api/TwillSpecification.java > 3931d04 > > Diff: https://reviews.apache.org/r/19236/diff/ > > > Testing > ------- > > public static void main(String[] args) throws URISyntaxException { > TwillSpecification.FlexBuilder builder = new > TwillSpecification.FlexBuilder(); > builder.setName("bob"); > > ResourceSpecification.FlexBuilder rSpecBuilder = new > ResourceSpecification.FlexBuilder(); > rSpecBuilder.setVirtualCores(1); > rSpecBuilder.setInstances(1); > rSpecBuilder.setMemorySize(64); > > List<LocalFile> files = ImmutableList.<LocalFile>builder() > .add(new DefaultLocalFile("SDF", new URI("SDF"), -1, -1, false, null)) > .build(); > > builder.addRunnable("Bob", new Test(), rSpecBuilder.build(), files); > builder.addRunnable("Bob2", new Test(), rSpecBuilder.build(), files); > builder.addRunnable("Bob3", new Test(), rSpecBuilder.build(), files); > > builder.nextOrderWhenStarted("Bob"); > builder.nextOrderWhenCompleted("Bob2", "Bob3"); > > builder.setEventHandler(new TestEventHandler()); > TwillSpecification spec = builder.build(); > } > > > Thanks, > > Jiahua Wang > >
