Package ch.ethz.vs.rowa

Examples of ch.ethz.vs.rowa.MiddlewareException


  @Override
  void execute() throws MiddlewareException {
    // TODO Auto-generated method stub
    Connection conn = this.middeware.getConnection(uuid);
    if(conn == null){
      throw new MiddlewareException("THREAD "+Thread.currentThread().getId()+" / EXCEPTION in AbortTransactionJob for UUID="+
          uuid.variant()+" -> There are no connecton available for this " +
              "client-uuid in the Middleware\n");
    }
    else{
      synchronized (conn) {
View Full Code Here


                 
                  stmt.close();
                  connP.close();
                }
              } catch (SQLException e1) {
                throw new MiddlewareException("ROLLBACK PREPARED");
              }
            }

            // 2nd phase: commit on all hosts
            try {

              Statement stat = conn.createStatement();
              stat.execute("COMMIT PREPARED '" + uuid + "'");
              stat.close();
              conn.setAutoCommit(false);
              try {
                conn.close();
              } catch (Exception e) {
                e.printStackTrace();
              }             
              for (int i = 0; i < connPool.size(); i++) {

                try {
                  Connection connP = connPool.get(i);
                  Statement stmt = connP.createStatement();
                  stmt.execute("COMMIT PREPARED '" + uuid + "'");
                  connP.setAutoCommit(true);
                  stmt.close();
                  connP.close();
                } catch (Exception e) {
                  e.printStackTrace();
                }               
               
              }
            } catch (SQLException e) {
              throw new MiddlewareException("COMMIT PREPARED failed", e);
            }

          } else {
            System.out.println("Connection Pool must be provided!");
            throw new RuntimeException("Provide connection pool");
View Full Code Here

  void execute() throws MiddlewareException {
    // TODO Auto-generated method stub
   
    Connection conn = this.middeware.getConnection(uuid);
    if(conn == null) {
      throw new MiddlewareException("THREAD "+Thread.currentThread().getId()+" / EXCEPTION in ExecuteQueryJob for UUID="+
          uuid.variant()+" -> There are no connecton available for this " +
              "client-uuid in the Middleware\n");
    } else {
     
      synchronized(conn) {
       
          // cosa me ne faccio del valore ritornato?????? -> variabile da monitorare
        System.out.println("THREAD "+Thread.currentThread().getId()+" / >>> EXECUTE QUERY -> UUID: "+this.uuid);
        System.out.println("\t--> "+sql);
       
        try{
       
          try {
 
            qf.onResult(Transactions.executeRandomReadQuery(conn));
            qf.done(true);
            this.middeware.addWaitingJob(uuid);
            conn.notify();
 
          } catch (SQLException e) {
            throw new MiddlewareException("QUERY ERROR: " + e.getMessage(), e);
          }
        }
        catch(MiddlewareException me)
        {
          qf.done(false);
View Full Code Here

  @Override
  void execute() throws MiddlewareException {
    Connection conn = this.middeware.getConnection(uuid);
    if(conn == null){
      throw new MiddlewareException("THREAD "+Thread.currentThread().getId()+" / EXCEPTION in UpdateQueryJob for UUID="+
          uuid.variant()+" -> There are no connecton available for this " +
              "client-uuid in the Middleware\n");
    }
    else{
      try {
        conn.setAutoCommit(false);
        conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
      } catch (SQLException e) {
        throw new MiddlewareException("Error in startTransaction", e);
      }
    }
  }
View Full Code Here

    /*
     * TODO: set the running flag to true -> ClientRequests
     */
    Connection conn = this.middeware.getConnection(uuid);
    if(conn == null){
      throw new MiddlewareException("THREAD "+Thread.currentThread().getId()+" / EXCEPTION in UpdateQueryJob for UUID="+
          uuid.variant()+" -> There are no connecton available for this " +
              "client-uuid in the Middleware\n");
    } else {
     
      synchronized (conn) {
       
        Vector<Connection> connPool = this.middeware.getConnectionPool(uuid);
        if(connPool == null){
          /*
           * create a pool of connection to all other DBs
           */
          this.middeware.addNewConnectionPool(uuid);
          connPool = this.middeware.getConnectionPool(uuid);
        } else {
          System.out.println("THREAD "+Thread.currentThread().getId()+" / >> CONNECTIONPOOL exist -> "+uuid);
        }
        synchronized (connPool) {
          try{
            try {
              uf.onResult(Transactions.executeUpdateShoppingCartToAll(conn, connPool));
              uf.done(true);
              connPool.notify();
            } catch (SQLException e) {
             
              throw new MiddlewareException("QUERY ERROR: " + e.getMessage(), e);
            }
          }catch(MiddlewareException me)
          {
            uf.done(false);
          }
View Full Code Here

    /*
     * TODO: set the running flag to true -> ClientRequests
     */
    Connection conn = this.middeware.getConnection(uuid);
    if(conn == null){
      throw new MiddlewareException("THREAD "+Thread.currentThread().getId()+" / EXCEPTION in UpdateQueryJob for UUID="+
          uuid.variant()+" -> There are no connecton available for this " +
              "client-uuid in the Middleware\n");
    }
    else{
      synchronized (conn) {
View Full Code Here

  @Override
  void execute() throws MiddlewareException {
    // TODO Auto-generated method stub
    Connection conn = this.middeware.getConnection(uuid);
    if(conn == null){
      throw new MiddlewareException("THREAD "+Thread.currentThread().getId()+" / EXCEPTION in AbortTransactionJob for UUID="+
          uuid.variant()+" -> There are no connecton available for this " +
              "client-uuid in the Middleware\n");
    }
    else{
      synchronized (conn) {
View Full Code Here

  void execute() throws MiddlewareException {
    // TODO Auto-generated method stub
   
    Connection conn = this.middeware.getConnection(uuid);
    if(conn == null){
      throw new MiddlewareException("THREAD "+Thread.currentThread().getId()+" / EXCEPTION in ExecuteQueryJob for UUID="+
          uuid.variant()+" -> There are no connecton available for this " +
              "client-uuid in the Middleware\n");
    }
   
    else{
View Full Code Here

TOP

Related Classes of ch.ethz.vs.rowa.MiddlewareException

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.