this.function = function; this.millis = millis;
FutureResult result = new FutureResult(); Thread thread = getThreadFactory().newThread(result.setter(function)); thread.start(); try { startingTime = System.currentTimeMillis(); Object obj = result.timedGet(millis); endingTime = System.currentTimeMillis(); return obj; } catch (InterruptedException ex) { endingTime = System.currentTimeMillis(); function.cleanup(); thread.interrupt(); throw ex; }
return endingTime;
return startingTime;