public synchronized boolean setExecutionThread(Thread t) {
    // The setting only fails if a thread tries to pick up a canceled operation.
    if (isCancelled() && t != null) {
      return false;
    } else {
      _executionThread = t;
      return true;
    }
  }
@Test
  public void testSetExecutionThread() {
    OperationFuture future = new OperationFuture("testSetExecutionThread");
    assertTrue(future.setExecutionThread(new Thread()));
    future.cancel(true);
    assertTrue("Should be able to set the execution thread of canceled future to null",
               future.setExecutionThread(null));
    assertFalse("Should failed to set execution thread for the canceled future.",
                future.setExecutionThread(new Thread()));
  }