- All Implemented Interfaces:
AutoCloseable
Connection
.
The table statistics are execution statistics of the specific connection, and are not global statistics.
This manager retains a reference to underlying FbDatabase
instance and holds a cache
of table names. Closing this manager will remove the reference the database handle (but not close it!) and releases
the cache.
This class is not thread-safe (though its use of the underlying connection is thread-safe).
- Since:
- 5
- Author:
- Mark Rotteveel
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Clears the reference to the connection and clears the cache.Obtains a snapshot of the table statistics of this connection.static FBTableStatisticsManager
of
(Connection connection) Creates a table statistics manager for the current connection.
-
Method Details
-
of
Creates a table statistics manager for the current connection.- Parameters:
connection
- Connection to gather statistics on.- Returns:
- a table statistics manager
- Throws:
SQLException
- ifconnection
is closed
-
getTableStatistics
Obtains a snapshot of the table statistics of this connection.A table is only present in the map if this connection touched it in a way which generated a statistic.
- Returns:
- map from table name to table statistics
- Throws:
InfoTruncatedException
- if a truncated response is received, after retrying 3 times (total: 4 attempts) while increasing the buffer size; it is possible that subsequent calls to this method may recover (as that will increase the buffer size even more)SQLException
- if the connection is closed, or if obtaining the statistics failed due to a database access error
-
close
public void close()Clears the reference to the connection and clears the cache.This method does not close the connection wrapped by this manager.
Closing a table statistics manager is not required. It can be used to clean up early, or to prevent a user of this class from gathering further statistics.
- Specified by:
close
in interfaceAutoCloseable
-