示例#1
0
 public static void dispatchPendingRunnables() {
   for (int i = RUNNABLES_PER_FRAME; i > 0; i--) {
     Runnable job = jobs.poll();
     if (job == null) {
       return;
     }
     job.run();
   }
 }
  public void doNonTransactionalWork(java.lang.Runnable runnable) throws NotSupportedException {
    TransactionManager transactionManager = null;
    Transaction transaction = null;

    try {
      transactionManager = getTransactionManager();
      transaction = transactionManager.suspend();
    } catch (Exception e) {
      NotSupportedException nse = new NotSupportedException(e.getMessage());
      nse.initCause(e);
      log.error(nse.getLocalizedMessage(), nse);
      throw nse;
    }

    runnable.run();

    try {
      transactionManager.resume(transaction);
    } catch (Exception e) {
      log.error(e.getLocalizedMessage(), e);
      try {
        transaction.setRollbackOnly();
      } catch (SystemException se2) {
        throw new GeneralException(se2);
      }
      NotSupportedException nse = new NotSupportedException(e.getMessage());
      nse.initCause(e);
      throw nse;
    }
  }
 /**
  * Begin getting employee data from server
  *
  * @param employeeId company employee ID
  */
 public void getData(String employeeID) {
   this.employeeID = employeeID;
   this.stopGettingData = false;
   runnable.run();
 }