Package org.apache.derby.iapi.error

Examples of org.apache.derby.iapi.error.StandardException


    private void parseTime( String timeStr, boolean isJdbcEscape, LocaleFinder localeFinder, Calendar cal)
        throws StandardException
    {
        boolean validSyntax = true;
        DateTimeParser parser = new DateTimeParser( timeStr);
        StandardException thrownSE = null;
        int hour = 0;
        int minute = 0;
        int second = 0;
        int amPm = -1;
        try
View Full Code Here


        catch( StandardException se )
        {
            return se;
        }

        StandardException se = StandardException.newException( SQLState.LOCK_TIMEOUT_LOG, sb.toString() );
        se.setReport( StandardException.REPORT_ALWAYS );
        return se;
    }
View Full Code Here

    this.db = db;
  }

  public void cleanupOnError(Throwable t) {
    if (!(t instanceof StandardException)) return;
    StandardException se = (StandardException)t;

        // Ensure the context is popped if the session is
        // going away.
        if (se.getSeverity() < ExceptionSeverity.SESSION_SEVERITY)
            return;

        popMe();
       
        if (se.getSeverity() == ExceptionSeverity.DATABASE_SEVERITY) {
        ContextService.getFactory().notifyAllActiveThreads(this);
        Monitor.getMonitor().shutdown(db);
        }
  }
View Full Code Here

        {
            // if the test debug flag is set, throw an
            // exception to simulate error cases.
            if (SanityManager.DEBUG_ON(debugFlag))
            {
               StandardException se = StandardException.newException(
                                      (reEncrypt ? SQLState.DATABASE_REENCRYPTION_FAILED :
                                      SQLState.DATABASE_ENCRYPTION_FAILED),
                                      debugFlag);
               markCorrupt(se);
               throw se;
View Full Code Here

                        waitingLock.clearPotentiallyGranted();

                        willQuitWait =
                            (wakeupReason != Constants.WAITING_LOCK_GRANT);

                        StandardException deadlockException = null;

                        if (((wakeupReason == Constants.WAITING_LOCK_IN_WAIT) &&
                                    deadlockWait) ||
                            (wakeupReason == Constants.WAITING_LOCK_DEADLOCK))
                        {

                            // check for a deadlock, even if we were woken up
                            // because we were selected as a victim we still
                            // check because the situation may have changed.
                            deadlockData =
                                Deadlock.look(
                                    factory, this, control, waitingLock,
                                    wakeupReason);

                            if (deadlockData == null) {
                                // we don't have a deadlock
                                deadlockWait = false;

                                actualTimeout = timeout;
                                startWaitTime = 0;
                                willQuitWait = false;
                            } else {
                                willQuitWait = true;
                            }
                        }

                        nextWaitingLock =
                            control.getNextWaiter(
                                waitingLock, willQuitWait, this);


                        // If we were not woken by another then we have
                        // timed out. Either deadlock out or timeout
                        if (willQuitWait) {

                            // Even if we deadlocked trying to get the lock,
                            // still reget the latch so that client's need not
                            // know latch was released.

                            if (latch != null) {
                                lockObject(
                                    compatabilitySpace, latch.getLockable(),
                                    latch.getQualifier(),
                                    C_LockFactory.WAIT_FOREVER, (Latch) null);
                            }

                            if (SanityManager.DEBUG)
                            {
                                if (SanityManager.DEBUG_ON("DeadlockTrace"))
                                {

                                    SanityManager.showTrace(new Throwable());

                                    // The following dumps the lock table as it
                                    // exists at the time a timeout is about to
                                    // cause a deadlock exception to be thrown.

                                    lockDebug =
                                    DiagnosticUtil.toDiagString(waitingLock)   +
                                    "\nGot deadlock/timeout, here's the table" +
                                    this.toDebugString();
                                }
                            }
                           
                            if (deadlockTrace && (deadlockData == null))
                            {
                                // if ending lock request due to lock timeout
                                // want a copy of the LockTable and the time,
                                // in case of deadlock deadlockData has the
                                // info we need.
                                currentTime = System.currentTimeMillis();
                                timeoutLockTable =
                                    factory.makeVirtualLockTable();
                            }
                        }

                    } // synchronized block

                    // need to do this outside of the synchronized block as the
                    // message text building (timeouts and deadlocks) may
                    // involve getting locks to look up table names from
                    // identifiers.

                    if (willQuitWait)
                    {
                        if (SanityManager.DEBUG)
                        {
                            if (lockDebug != null)
                            {
                                String type =
                                    ((deadlockData != null) ?
                                         "deadlock:" : "timeout:");

                                SanityManager.DEBUG_PRINT(
                                    type,
                                    "wait on lockitem caused " + type +
                                    lockDebug);
                            }

                        }

                        if (deadlockData == null)
                        {
                            // ending wait because of lock timeout.

                            if (deadlockTrace)
                            {  
                                // Turn ON derby.locks.deadlockTrace to build
                                // the lockTable.
                                   
                               
                                throw Timeout.buildException(
                                    waitingLock, timeoutLockTable, currentTime);
                            }
                            else
                            {
                                StandardException se =
                                    StandardException.newException(
                                        SQLState.LOCK_TIMEOUT);

                                throw se;
                            }
View Full Code Here

        startProviderService(actualProvider, serviceName, serviceProperties);
        return true; // we understand the type
      }
    }

    StandardException savedMse = null;

    for (Enumeration e = new ProviderEnumeration( properties); e.hasMoreElements(); ) {

      PersistentService provider = (PersistentService) e.nextElement();
View Full Code Here

  Database getDatabase() {
    return  database;
  }

  StandardException shutdownDatabaseException() {
    StandardException se = StandardException.newException(SQLState.SHUTDOWN_DATABASE, getDBName());
    se.setReport(StandardException.REPORT_NEVER);
    return se;
  }
View Full Code Here

      }

      boolean checkForShutdown = false;
      if (thrownException instanceof StandardException)
      {
        StandardException se = (StandardException) thrownException;
        int severity = se.getSeverity();
        if (severity <= ExceptionSeverity.STATEMENT_SEVERITY)
        {
          /*
          ** If autocommit is on, then do a rollback
          ** to release locks if requested.  We did a stmt
          ** rollback in the cleanupOnError above, but we still
          ** may hold locks from the stmt.
          */
          if (autoCommit && rollbackOnAutoCommit)
          {
            se.setSeverity(ExceptionSeverity.TRANSACTION_SEVERITY);
          }
        } else if (SQLState.CONN_INTERRUPT.equals(se.getMessageId())) {
          // an interrupt closed the connection.
          checkForShutdown = true;
        }
      }
      // if cm is null, we don't have a connection context left,
View Full Code Here

      // server side JDBC can end up with a SQLException in the nested stack
      nextSQLException = (SQLException) thrownException;
    }
    else if (thrownException instanceof StandardException) {

      StandardException se = (StandardException) thrownException;

      nextSQLException = Util.generateCsSQLException(se);

      wrapInSQLException(nextSQLException, se.getNestedException());

    } else {

      nextSQLException = Util.javaException(thrownException);
View Full Code Here

      sb.append('\n');

      attributes.clear();
    }

    StandardException se = StandardException.newException(SQLState.DEADLOCK, sb.toString(), victimXID);
    se.setReport(factory.deadlockMonitor);
    return se;
  }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.error.StandardException

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.