Package org.fto.jthink.exception

Examples of org.fto.jthink.exception.JThinkRuntimeException


    try{
      Method method = obj.getClass().getDeclaredMethod(methodName, types);
      method.setAccessible(true);
      return method.invoke(obj, args);
    }catch(Exception e){
      throw new JThinkRuntimeException(e);
    }
  }
View Full Code Here


      return TRANSACTION_REPEATABLE_READ;
    }
    if(level.equalsIgnoreCase("TRANSACTION_SERIALIZABLE")){
      return TRANSACTION_SERIALIZABLE;
    }
    throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_DB_SQL_EXCEPTION, "不被支持的事务隔离级别!");
  }
View Full Code Here

    if(!(level==TRANSACTION_NONE ||
        level==TRANSACTION_READ_COMMITTED ||
        level==TRANSACTION_READ_UNCOMMITTED ||
        level==TRANSACTION_REPEATABLE_READ ||
        level==TRANSACTION_SERIALIZABLE)){
      throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_DB_SQL_EXCEPTION, "不被支持的事务隔离级别!");     
    }
    levels.put(connId, new Integer(level));
    Connection conn = (Connection)openedConnsHM.get(connId);
    try{
      if(conn!=null && conn.getMetaData().supportsTransactionIsolationLevel(level)){
         conn.setTransactionIsolation(level);
      }
    } catch (SQLException e) {
      throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_DB_SQL_EXCEPTION, "设置事务隔离级别时发生异常!", e);
    }
  }
View Full Code Here

     
    } catch (JThinkRuntimeException e) {
      throw e;
    } catch (Exception e) {
      logger.error("下载文件时发生异常.",e);
      throw new JThinkRuntimeException(e);
    }finally{
      /* 关闭bufferedoutputstream */
      if (bufferedoutputstream != null){
        try {
          bufferedoutputstream.close();
View Full Code Here

        return null;
      }else{
        return clazz.getResource("/"+name);
      }
    } catch (IOException e) {
      throw new JThinkRuntimeException(e);
    }
  }
View Full Code Here

        resManager.setResource(factoryId, trsctnFactory);
      } catch (Exception e) {
        if (e instanceof JThinkRuntimeException) {
          throw (JThinkRuntimeException)e;
        }
        throw new JThinkRuntimeException("创建事务工厂失败, 检查是否正确配置了事务工厂", e);
      }
    }
    return trsctnFactory;
  }
View Full Code Here

          }
        }else{
          conn.setAutoCommit(false);
        }
        if(openedConnsHM.containsKey(connId)){
          throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_DB_CANNOT_GET_CONNECTION, "在同一事务中此连接被重复创建! Connection id is "+connId);
        }
        openedConnsHM.put(connId, conn);
      }
     
      /* 如果连接无效,抛异常 */
      if(conn.isClosed()){
        throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_DB_CANNOT_GET_CONNECTION, "此连接已经被关闭! Connection id is "+connId);
      }
      return conn;
     
    }catch(JThinkRuntimeException e){ 
      throw e;
    }catch(Exception e){
      throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_DB_CANNOT_GET_CONNECTION, e);
    }
  } 
View Full Code Here

        if(conn.getAutoCommit()==false){
          conn.commit();
        }
      }
    }catch(SQLException e){
      throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_DB_SQL_EXCEPTION, "事务提交时发生异常!", e);
    }
  }
View Full Code Here

        if(conn.getAutoCommit()==false){
          conn.rollback();
        }
      }
    }catch(SQLException e){
      throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_DB_SQL_EXCEPTION, "事务回退时发生异常!", e);
    }
   
  }
View Full Code Here

    recursionFlag--;
    if (recursionFlag > 0) {
      return;
    }
    else if (recursionFlag < 0) {
      throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_SYS_RUNTIME,
                  "事务嵌套标志小于了0. begin()与close()方法不匹配!");
    }
   
    try{
      boolean status = true;
      Iterator keysIT = openedConnsHM.keySet().iterator();
      while(keysIT.hasNext()){
        String connId = (String)keysIT.next();
        Connection conn = (Connection)openedConnsHM.get(connId);
        if(useConnectionPool(connId)){
          ConnectionPool connPool = ConnectionPool.getConnectionPool(connId);
          /* 将活动连接返回到连接池 */
          if(connPool!=null && connPool.contains(conn)){
            connPool.returnConnection(conn);
          }else{
            status = status && closeConnection(conn);
          }
        }else{
          /* 释放连接 */
          status = status && closeConnection(conn);
        }
      }
    }catch(JThinkRuntimeException e){
      throw e;
    }catch(Exception e){
      throw new JThinkRuntimeException(JThinkErrorCode.ERRCODE_DB_SQL_EXCEPTION, "事务关闭时发生异常!", e);
    }finally{   
      openedConnsHM.clear();
    }
  }
View Full Code Here

TOP

Related Classes of org.fto.jthink.exception.JThinkRuntimeException

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.