Codota Logo
org.quartz.ee.jta
Code IndexAdd Codota to your IDE (free)

How to use org.quartz.ee.jta

Best Java code snippets using org.quartz.ee.jta (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: quartz-scheduler/quartz

  private void cleanupUserTransaction() {
    if (ut != null) {
      UserTransactionHelper.returnUserTransaction(ut);
      ut = null;
    }
  }
}
origin: quartz-scheduler/quartz

/**
 * Return a UserTransaction that was retrieved via getUserTransaction().
 * This will make sure that the InitalContext used to lookup/create the 
 * UserTransaction is properly cleaned up.
 */
public static void returnUserTransaction(UserTransaction userTransaction) {
  if ((userTransaction != null) && 
    (userTransaction instanceof UserTransactionWithContext)) {
    UserTransactionWithContext userTransactionWithContext = 
      (UserTransactionWithContext)userTransaction;
    
    userTransactionWithContext.closeContext();
  }
}
origin: quartz-scheduler/quartz

/**
 * Create/Lookup a UserTransaction in the InitialContext via the
 * name set in setUserTxLocation().
 */
public static UserTransaction lookupUserTransaction() throws SchedulerException {
  return new UserTransactionWithContext();
}

origin: quartz-scheduler/quartz

@Override
protected void begin() throws SchedulerException {
  // Don't get a new UserTransaction w/o making sure we cleaned up the old 
  // one.  This is necessary because there are paths through JobRunShell.run()
  // where begin() can be called multiple times w/o complete being called in
  // between.
  cleanupUserTransaction();
  
  boolean beganSuccessfully = false;
  try {
    getLog().debug("Looking up UserTransaction.");
    ut = UserTransactionHelper.lookupUserTransaction();
    if (transactionTimeout != null) {
      ut.setTransactionTimeout(transactionTimeout);
    }
    getLog().debug("Beginning UserTransaction.");
    ut.begin();
    
    beganSuccessfully = true;
  } catch (SchedulerException se) {
    throw se;
  } catch (Exception nse) {
    throw new SchedulerException(
        "JTAJobRunShell could not start UserTransaction.", nse);
  } finally {
    if (beganSuccessfully == false) {
      cleanupUserTransaction();
    }
  }
}
origin: quartz-scheduler/quartz

/**
 * When we are being garbage collected, make sure we were properly
 * returned to the UserTransactionHelper.
 */
@Override
protected void finalize() throws Throwable {
  try {
    if (context != null) {
      getLog().warn("UserTransaction was never returned to the UserTransactionHelper.");
      closeContext();
    }
  } finally {
    super.finalize();
  }
}
origin: quartz-scheduler/quartz

/**
 * <p>
 * Called by the <class>{@link org.quartz.core.QuartzSchedulerThread}
 * </code> to obtain instances of <code>
 * {@link org.quartz.core.JobRunShell}</code>.
 * </p>
 */
public JobRunShell createJobRunShell(TriggerFiredBundle bundle)
    throws SchedulerException {
  return new JTAJobRunShell(scheduler, bundle);
}
origin: quartz-scheduler/quartz

/**
 * Override passivate() to ensure we always cleanup the UserTransaction. 
 */
@Override
public void passivate() {
  cleanupUserTransaction();
  super.passivate();
}

origin: quartz-scheduler/quartz

/**
 * Close the InitialContext that was used to lookup/create the
 * underlying UserTransaction.
 */
public void closeContext() {
  try {
    if (context != null) {
      context.close();
    }
  } catch (Throwable t) {
    getLog().warn("Failed to close InitialContext used to get a UserTransaction.", t);
  }
  context = null;
}
origin: quartz-scheduler/quartz

@Override
protected void begin() throws SchedulerException {
  // Don't get a new UserTransaction w/o making sure we cleaned up the old 
  // one.  This is necessary because there are paths through JobRunShell.run()
  // where begin() can be called multiple times w/o complete being called in
  // between.
  cleanupUserTransaction();
  
  boolean beganSuccessfully = false;
  try {
    getLog().debug("Looking up UserTransaction.");
    ut = UserTransactionHelper.lookupUserTransaction();
    if (transactionTimeout != null) {
      ut.setTransactionTimeout(transactionTimeout);
    }
    getLog().debug("Beginning UserTransaction.");
    ut.begin();
    
    beganSuccessfully = true;
  } catch (SchedulerException se) {
    throw se;
  } catch (Exception nse) {
    throw new SchedulerException(
        "JTAJobRunShell could not start UserTransaction.", nse);
  } finally {
    if (beganSuccessfully == false) {
      cleanupUserTransaction();
    }
  }
}
origin: quartz-scheduler/quartz

/**
 * When we are being garbage collected, make sure we were properly
 * returned to the UserTransactionHelper.
 */
@Override
protected void finalize() throws Throwable {
  try {
    if (context != null) {
      getLog().warn("UserTransaction was never returned to the UserTransactionHelper.");
      closeContext();
    }
  } finally {
    super.finalize();
  }
}
origin: quartz-scheduler/quartz

  private void cleanupUserTransaction() {
    if (ut != null) {
      UserTransactionHelper.returnUserTransaction(ut);
      ut = null;
    }
  }
}
origin: quartz-scheduler/quartz

/**
 * Return a UserTransaction that was retrieved via getUserTransaction().
 * This will make sure that the InitalContext used to lookup/create the 
 * UserTransaction is properly cleaned up.
 */
public static void returnUserTransaction(UserTransaction userTransaction) {
  if ((userTransaction != null) && 
    (userTransaction instanceof UserTransactionWithContext)) {
    UserTransactionWithContext userTransactionWithContext = 
      (UserTransactionWithContext)userTransaction;
    
    userTransactionWithContext.closeContext();
  }
}
origin: quartz-scheduler/quartz

/**
 * Create/Lookup a UserTransaction in the InitialContext via the
 * name set in setUserTxLocation().
 */
public static UserTransaction lookupUserTransaction() throws SchedulerException {
  return new UserTransactionWithContext();
}

origin: quartz-scheduler/quartz

/**
 * <p>
 * Called by the <class>{@link org.quartz.core.QuartzSchedulerThread}
 * </code> to obtain instances of <code>
 * {@link org.quartz.core.JobRunShell}</code>.
 * </p>
 */
public JobRunShell createJobRunShell(TriggerFiredBundle bundle)
    throws SchedulerException {
  return new JTAJobRunShell(scheduler, bundle);
}
origin: quartz-scheduler/quartz

/**
 * Override passivate() to ensure we always cleanup the UserTransaction. 
 */
@Override
public void passivate() {
  cleanupUserTransaction();
  super.passivate();
}

origin: quartz-scheduler/quartz

/**
 * Close the InitialContext that was used to lookup/create the
 * underlying UserTransaction.
 */
public void closeContext() {
  try {
    if (context != null) {
      context.close();
    }
  } catch (Throwable t) {
    getLog().warn("Failed to close InitialContext used to get a UserTransaction.", t);
  }
  context = null;
}
origin: quartz-scheduler/quartz

  /**
   * If the given UserTransaction is not null, it is committed/rolledback,
   * and then returned to the UserTransactionHelper.
   */
  private void resolveUserTransaction(UserTransaction userTransaction) {
    if (userTransaction != null) {
      try {
        if (userTransaction.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
          userTransaction.rollback();
        } else {
          userTransaction.commit();
        } 
      } catch (Throwable t) {
        getLog().error("Failed to resolve UserTransaction for plugin: " + getName(), t);
      } finally {
        UserTransactionHelper.returnUserTransaction(userTransaction);
      }
    }
  }
}
origin: quartz-scheduler/quartz

public UserTransactionWithContext() throws SchedulerException {
  try {
    context = new InitialContext();
  } catch (Throwable t) {
    throw new SchedulerException(
      "UserTransactionHelper failed to create InitialContext to lookup/create UserTransaction.", t);
  }
  
  try {
    userTransaction = (UserTransaction)context.lookup(userTxURL);
  } catch (Throwable t) {
    closeContext();
    throw new SchedulerException(
      "UserTransactionHelper could not lookup/create UserTransaction.",
      t);
  }
  
  if (userTransaction == null) {
    closeContext();
    throw new SchedulerException(
      "UserTransactionHelper could not lookup/create UserTransaction from the InitialContext.");
  }
}
origin: quartz-scheduler/quartz

  /**
   * If the given UserTransaction is not null, it is committed/rolledback,
   * and then returned to the UserTransactionHelper.
   */
  private void resolveUserTransaction(UserTransaction userTransaction) {
    if (userTransaction != null) {
      try {
        if (userTransaction.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
          userTransaction.rollback();
        } else {
          userTransaction.commit();
        } 
      } catch (Throwable t) {
        getLog().error("Failed to resolve UserTransaction for plugin: " + getName(), t);
      } finally {
        UserTransactionHelper.returnUserTransaction(userTransaction);
      }
    }
  }
}
origin: quartz-scheduler/quartz

public UserTransactionWithContext() throws SchedulerException {
  try {
    context = new InitialContext();
  } catch (Throwable t) {
    throw new SchedulerException(
      "UserTransactionHelper failed to create InitialContext to lookup/create UserTransaction.", t);
  }
  
  try {
    userTransaction = (UserTransaction)context.lookup(userTxURL);
  } catch (Throwable t) {
    closeContext();
    throw new SchedulerException(
      "UserTransactionHelper could not lookup/create UserTransaction.",
      t);
  }
  
  if (userTransaction == null) {
    closeContext();
    throw new SchedulerException(
      "UserTransactionHelper could not lookup/create UserTransaction from the InitialContext.");
  }
}
org.quartz.ee.jta

Most used classes

  • UserTransactionHelper
    A helper for obtaining a handle to a UserTransaction... To ensure proper cleanup of the InitalCon
  • JTAJobRunShell
    An extension of org.quartz.core.JobRunShell that begins an XA transaction before executing the Job,
  • JTAJobRunShellFactory
    Responsible for creating the instances of org.quartz.ee.jta.JTAJobRunShell to be used within the or
  • UserTransactionHelper$UserTransactionWithContext
    This class wraps a UserTransaction with the InitialContext that was used to look it up, so that when
  • JTAAnnotationAwareJobRunShellFactory
    Responsible for creating the instances of a JobRunShellto be used within the org.quartz.core.Quart
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now