Example usage for android.database.sqlite SQLiteConnection dump

List of usage examples for android.database.sqlite SQLiteConnection dump

Introduction

In this page you can find the example usage for android.database.sqlite SQLiteConnection dump.

Prototype

public void dump(Printer printer, boolean verbose) 

Source Link

Document

Dumps debugging information about this connection.

Usage

From source file:io.requery.android.database.sqlite.SQLiteConnectionPool.java

/**
 * Dumps debugging information about this connection pool.
 *
 * @param printer The printer to receive the dump, not null.
 * @param verbose True to dump more verbose information.
 *///from   ww  w . j av a 2 s . co m
public void dump(Printer printer, boolean verbose) {
    synchronized (mLock) {
        printer.println("Connection pool for " + mConfiguration.path + ":");
        printer.println("  Open: " + mIsOpen);
        printer.println("  Max connections: " + mMaxConnectionPoolSize);

        printer.println("  Available primary connection:");
        if (mAvailablePrimaryConnection != null) {
            mAvailablePrimaryConnection.dump(printer, verbose);
        } else {
            printer.println("<none>");
        }

        printer.println("  Available non-primary connections:");
        if (!mAvailableNonPrimaryConnections.isEmpty()) {
            for (SQLiteConnection connection : mAvailableNonPrimaryConnections) {
                connection.dump(printer, verbose);
            }
        } else {
            printer.println("<none>");
        }

        printer.println("  Acquired connections:");
        if (!mAcquiredConnections.isEmpty()) {
            for (Map.Entry<SQLiteConnection, AcquiredConnectionStatus> entry : mAcquiredConnections
                    .entrySet()) {
                final SQLiteConnection connection = entry.getKey();
                connection.dumpUnsafe(printer, verbose);
                printer.println("  Status: " + entry.getValue());
            }
        } else {
            printer.println("<none>");
        }

        printer.println("  Connection waiters:");
        if (mConnectionWaiterQueue != null) {
            int i = 0;
            final long now = SystemClock.uptimeMillis();
            for (ConnectionWaiter waiter = mConnectionWaiterQueue; waiter != null; waiter = waiter.mNext, i++) {
                printer.println(i + ": waited for " + ((now - waiter.mStartTime) * 0.001f) + " ms - thread="
                        + waiter.mThread + ", priority=" + waiter.mPriority + ", sql='" + waiter.mSql + "'");
            }
        } else {
            printer.println("<none>");
        }
    }
}