Code example for Callable

Methods: call

0
 
  private <RetType> RetType doNamed(Thread currThread, String currName, String newName, Callable<RetType> toRun)
  { 
    try { 
      currThread.setName(newName);
      return toRun.call();
    } 
    catch (Exception e) {
      throw Throwables.propagate(e);
    } 
    finally { 
      currThread.setName(currName);
    } 
  } 
}