Package net.sf.hajdbc.invocation

Examples of net.sf.hajdbc.invocation.LockingInvocationStrategy


   
    if (executeMethodSet.contains(method))
    {
      List<Lock> locks = this.getProxyFactory().extractLocks((String) parameters[0]);
     
      return this.getProxyFactory().getTransactionContext().start(new LockingInvocationStrategy(InvocationStrategies.TRANSACTION_INVOKE_ON_ALL, locks), this.getProxyFactory().getParentProxy());
    }
   
    if (method.equals(executeQueryMethod))
    {
      String sql = (String) parameters[0];
     
      List<Lock> locks = this.getProxyFactory().extractLocks(sql);
      int concurrency = statement.getResultSetConcurrency();
      boolean selectForUpdate = this.getProxyFactory().isSelectForUpdate(sql);
     
      if (locks.isEmpty() && (concurrency == ResultSet.CONCUR_READ_ONLY) && !selectForUpdate)
      {
        boolean repeatableReadSelect = (statement.getConnection().getTransactionIsolation() >= Connection.TRANSACTION_REPEATABLE_READ);
       
        return repeatableReadSelect ? InvocationStrategies.INVOKE_ON_PRIMARY : InvocationStrategies.INVOKE_ON_NEXT;
      }
     
      InvocationStrategy strategy = InvocationStrategies.TRANSACTION_INVOKE_ON_ALL;
      if (!locks.isEmpty())
      {
        strategy = new LockingInvocationStrategy(strategy, locks);
      }
     
      return selectForUpdate ? this.getProxyFactory().getTransactionContext().start(strategy, this.getProxyFactory().getParentProxy()) : strategy;
    }
   
    if (method.equals(executeBatchMethod))
    {
      return this.getProxyFactory().getTransactionContext().start(new LockingInvocationStrategy(InvocationStrategies.TRANSACTION_INVOKE_ON_ALL, this.getProxyFactory().getBatchLocks()), this.getProxyFactory().getParentProxy());
    }
   
    if (method.equals(getMoreResultsMethod))
    {
      if (parameters[0].equals(Statement.KEEP_CURRENT_RESULT))
View Full Code Here


      return InvocationStrategies.INVOKE_ON_EXISTING;
    }
   
    if (method.equals(executeMethod) || method.equals(executeUpdateMethod))
    {
      return this.getProxyFactory().getTransactionContext().start(new LockingInvocationStrategy(InvocationStrategies.TRANSACTION_INVOKE_ON_ALL, this.getProxyFactory().getLocks()), this.getProxyFactory().getParentProxy());
    }
   
    if (method.equals(executeQueryMethod))
    {
      List<Lock> locks = this.getProxyFactory().getLocks();
      int concurrency = statement.getResultSetConcurrency();
      boolean selectForUpdate = this.getProxyFactory().isSelectForUpdate();
     
      if (locks.isEmpty() && (concurrency == ResultSet.CONCUR_READ_ONLY) && !selectForUpdate)
      {
        boolean repeatableReadSelect = (statement.getConnection().getTransactionIsolation() >= Connection.TRANSACTION_REPEATABLE_READ);
       
        return repeatableReadSelect ? InvocationStrategies.INVOKE_ON_PRIMARY : InvocationStrategies.INVOKE_ON_NEXT;
      }
     
      InvocationStrategy strategy = InvocationStrategies.TRANSACTION_INVOKE_ON_ALL;
      if (!locks.isEmpty())
      {
        strategy = new LockingInvocationStrategy(strategy, locks);
      }
     
      return selectForUpdate ? this.getProxyFactory().getTransactionContext().start(strategy, this.getProxyFactory().getParentProxy()) : strategy;
    }
   
View Full Code Here

TOP

Related Classes of net.sf.hajdbc.invocation.LockingInvocationStrategy

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.