Package jodd.jtx

Examples of jodd.jtx.JtxTransactionMode


  }

  @SuppressWarnings( {"unchecked"})
  public AnnotationTxAdviceManager(LeanJtxWorker jtxWorker, String scopePattern, JtxTransactionMode defaultTxMode) {
    this.jtxWorker = jtxWorker;
    this.defaultTransactionMode = defaultTxMode == null ? new JtxTransactionMode().propagationSupports() : defaultTxMode;
    this.scopePattern = scopePattern;
    registerAnnotations(new Class[] {Transaction.class});
  }
View Full Code Here


   * @param methodArgTypes types of arguments, used to find the method
   * @param unique unique method fingerprint that contains return and arguments type information
   */
  public synchronized JtxTransactionMode getTxMode(Class type, String methodName, Class[] methodArgTypes, String unique) {
    String signature = type.getName() + '#' + methodName + '%' + unique;
    JtxTransactionMode txMode = txmap.get(signature);
    if (txMode == null) {
      if (txmap.containsKey(signature) == false) {

        Method m;
        try {
          m = type.getMethod(methodName, methodArgTypes);
        } catch (NoSuchMethodException nsmex) {
          throw new ProxettaException(nsmex);
        }

        TransactionAnnotationData txAnn = getTransactionAnnotation(m);
        if (txAnn != null) {
          txMode = new JtxTransactionMode();
          txMode.setPropagationBehaviour(txAnn.getPropagation());
          txMode.setIsolationLevel(txAnn.getIsolation());
          txMode.setReadOnly(txAnn.isReadOnly());
          txMode.setTransactionTimeout(txAnn.getTimeout());
        } else {
          txMode = defaultTransactionMode;
        }
        txmap.put(signature, txMode);
      }
View Full Code Here

    String methodName = targetMethodName();
    Class[] methodArgsTypes = createArgumentsClassArray();
    String methodDescription = targetMethodDescription();

    // read transaction mode from annotation
    JtxTransactionMode txMode = manager.getTxMode(type, methodName, methodArgsTypes, methodDescription);

    // request transaction
    JtxTransaction tx = null;
    try {
      String scope = manager.resolveScope(type, methodName);
View Full Code Here

  /**
   * Starts new read/write transaction in PROPAGATION_REQUIRED mode.
   */
  public static JtxTransaction startRwTx() {
    return jtxManager.requestTransaction(new JtxTransactionMode().propagationRequired().readOnly(false));
  }
View Full Code Here

  private static final String CTX_2 = "ctx #2";

  // ---------------------------------------------------------------- required

  private JtxTransactionMode required() {
    return new JtxTransactionMode().propagationRequired().readOnly(false);
  }
View Full Code Here


  // ---------------------------------------------------------------- supports

  private JtxTransactionMode supports() {
    return new JtxTransactionMode().propagationSupports().readOnly(false);
  }
View Full Code Here

  }

  // ---------------------------------------------------------------- not supported

  private JtxTransactionMode notSupported() {
    return new JtxTransactionMode().propagationNotSupported().readOnly(false);
  }
View Full Code Here

*/

  // ---------------------------------------------------------------- never

  private JtxTransactionMode never() {
    return new JtxTransactionMode().propagationNever().readOnly(false);
  }
View Full Code Here


  // ---------------------------------------------------------------- requires new

  private JtxTransactionMode requiredNew() {
    return new JtxTransactionMode().propagationRequiresNew().readOnly(false);
  }
View Full Code Here


  // ---------------------------------------------------------------- mandatory

  private JtxTransactionMode mandatory() {
    return new JtxTransactionMode().propagationMandatory().readOnly(false);
  }
View Full Code Here

TOP

Related Classes of jodd.jtx.JtxTransactionMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.