diff -r ea12a3bb4b33 -r 4ce38f21f4cd launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/InvocationContext.java --- a/launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/InvocationContext.java Tue Feb 24 11:12:53 2015 +0100 +++ b/launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/InvocationContext.java Tue Jan 26 04:36:23 2016 +0100 @@ -19,7 +19,6 @@ import java.io.IOException; import java.io.InputStream; -import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; @@ -38,6 +37,7 @@ private Throwable exception; String html; final List resources = new ArrayList<>(); + private int time; InvocationContext(Launcher launcher, Class clazz, String methodName) { this.launcher = launcher; @@ -65,11 +65,27 @@ /** Invokes the associated method. * @return the textual result of the invocation + * @throws java.io.IOException if execution fails */ public String invoke() throws IOException { launcher.runMethod(this); return toString(); } + + /** Invokes the associated method. + * @param time one element array to store the length of the invocation + * - can be null + * @return the textual result of the invocation + * @throws java.io.IOException if execution fails + * @since 0.20 + */ + public String invoke(int[] time) throws IOException { + launcher.runMethod(this); + if (time != null) { + time[0] = this.time; + } + return toString(); + } /** Obtains textual result of the invocation. * @return text representing the exception or result value @@ -90,7 +106,8 @@ wait.await(timeOut, TimeUnit.MILLISECONDS); } - void result(String r, Throwable e) { + void result(String r, int time, Throwable e) { + this.time = time; this.result = r; this.exception = e; wait.countDown();