|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.firebirdsql.management.FBServiceManager
org.firebirdsql.management.FBMaintenanceManager
public class FBMaintenanceManager
The FBMaintenanceManager
class is responsible for replicating
the functionality provided by the gfix
command-line tool.
Among the responsibilities of this class are:
Field Summary |
---|
Fields inherited from class org.firebirdsql.management.FBServiceManager |
---|
BUFFER_SIZE |
Fields inherited from interface org.firebirdsql.management.MaintenanceManager |
---|
ACCESS_MODE_READ_ONLY, ACCESS_MODE_READ_WRITE, PAGE_FILL_FULL, PAGE_FILL_RESERVE, SHUTDOWN_ATTACH, SHUTDOWN_FORCE, SHUTDOWN_TRANSACTIONAL, VALIDATE_FULL, VALIDATE_IGNORE_CHECKSUM, VALIDATE_READ_ONLY |
Constructor Summary | |
---|---|
FBMaintenanceManager()
Create a new instance of FBMaintenanceManager based on
the default GDSType. |
|
FBMaintenanceManager(org.firebirdsql.gds.impl.GDSType gdsType)
Create a new instance of FBMaintenanceManager based on
a given GDSType. |
|
FBMaintenanceManager(java.lang.String gdsType)
Create a new instance of FBMaintenanceManager based on
a given GDSType. |
Method Summary | |
---|---|
void |
activateShadowFile()
Activate a database shadow file to be used as the actual database. |
void |
bringDatabaseOnline()
Bring a shutdown database online. |
void |
commitTransaction(int transactionId)
Commit a limbo transaction based on its ID. |
int[] |
getLimboTransactions()
|
void |
killUnavailableShadows()
Remove references to unavailable shadow files. |
void |
listLimboTransactions()
Retrieve the ID of each limbo transaction. |
void |
markCorruptRecords()
Mark corrupt records in the database as unavailable. |
void |
rollbackTransaction(int transactionId)
Rollback a limbo transaction based on its ID. |
void |
setDatabaseAccessMode(int mode)
Set the database to have read-write or read-only access. |
void |
setDatabaseDialect(int dialect)
Set the database's dialect. |
void |
setDefaultCacheBuffer(int pageCount)
Set the default page-buffer count to be cached in the database. |
void |
setForcedWrites(boolean forced)
Enable or disable forced (synchronous) writes in the database. |
void |
setPageFill(int pageFill)
Set the page fill strategy for when inserting records. |
void |
setSweepThreshold(int transactions)
Set the database automatic sweep interval to a given number of transactions. |
void |
shutdownDatabase(int shutdownMode,
int timeout)
Shutdown the current database. |
void |
sweepDatabase()
Perform an immediate sweep of the database. |
void |
validateDatabase()
Locate and release database pages that are allocated but unassigned to any data structures. |
void |
validateDatabase(int options)
Locate and release database pages that are allocated but unassigned to any data structures. |
Methods inherited from class org.firebirdsql.management.FBServiceManager |
---|
attachServiceManager, createRequestBuffer, detachServiceManager, executeServicesOperation, getDatabase, getGds, getHost, getLogger, getPassword, getPort, getServiceName, getUser, queueService, setDatabase, setHost, setLogger, setPassword, setPort, setUser |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.firebirdsql.management.ServiceManager |
---|
getDatabase, getHost, getLogger, getPassword, getPort, getUser, setDatabase, setHost, setLogger, setPassword, setPort, setUser |
Constructor Detail |
---|
public FBMaintenanceManager()
FBMaintenanceManager
based on
the default GDSType.
public FBMaintenanceManager(java.lang.String gdsType)
FBMaintenanceManager
based on
a given GDSType.
gdsType
- type must be PURE_JAVA, EMBEDDED, or NATIVEpublic FBMaintenanceManager(org.firebirdsql.gds.impl.GDSType gdsType)
FBMaintenanceManager
based on
a given GDSType.
gdsType
- The GDS implementation type to useMethod Detail |
---|
public void setDatabaseAccessMode(int mode) throws java.sql.SQLException
setDatabaseAccessMode
in interface MaintenanceManager
mode
- Must be either ACCESS_MODE_READ_WRITE
or ACCESS_MODE_READ_ONLY
java.sql.SQLException
- if a database access error occurspublic void setDatabaseDialect(int dialect) throws java.sql.SQLException
setDatabaseDialect
in interface MaintenanceManager
dialect
- The database dialect, must be either 1 or 3
java.sql.SQLException
- if a database access error occurspublic void setDefaultCacheBuffer(int pageCount) throws java.sql.SQLException
setDefaultCacheBuffer
in interface MaintenanceManager
pageCount
- The number of pages to be cached, must be positive
java.sql.SQLException
- If the given page count cannot be set, or a
database access error occurspublic void setForcedWrites(boolean forced) throws java.sql.SQLException
setForcedWrites
in interface MaintenanceManager
forced
- If true
, forced writes will be used in the
database, otherwise buffered writes will be used.
java.sql.SQLException
- if a database access error occurspublic void setPageFill(int pageFill) throws java.lang.Exception
pageFill
can be one of:
PAGE_FILL_FULL
Fully fill database pages
PAGE_FILL_RESERVE
Reserve 20% of page space for
later record deltas
setPageFill
in interface MaintenanceManager
pageFill
- The page-filling strategy, either
PAGE_FILL_FULL
or PAGE_FILL_RESERVE
java.sql.SQLException
- if a database access error occurs
java.lang.Exception
public void shutdownDatabase(int shutdownMode, int timeout) throws java.sql.SQLException
SHUTDOWN_ATTACH
- No new non-owner connections
will be allowed to the database during the shutdown, and shutdown
is cancelled if there are still processes connected at the end
of the timeout.
SHUTDOWN_TRANSACTIONAL
- No new transactions can
be started during the timeout period, and shutdown is cancelled
if there are still active transactions at the end of the timeout.
SHUTDOWN_FORCE
- Forcefully shuts down the
database at the end of the timeout.
shutdownDatabase
in interface MaintenanceManager
shutdownMode
- One of SHUTDOWN_ATTACH
,
SHUTDOWN_TRANSACTIONAL
,
or SHUTDOWN_FORCE
.timeout
- The maximum amount of time allocated for the operation,
in seconds
java.sql.SQLException
- if the requested operation cannot be completed
within the given timeout, or a database access error occurspublic void bringDatabaseOnline() throws java.sql.SQLException
bringDatabaseOnline
in interface MaintenanceManager
java.sql.SQLException
- if a database access error occurspublic void markCorruptRecords() throws java.sql.SQLException
gfix -mend
.
markCorruptRecords
in interface MaintenanceManager
java.sql.SQLException
- if a database access error occurspublic void validateDatabase() throws java.sql.SQLException
validateDatabase
in interface MaintenanceManager
java.sql.SQLException
- if a database access error occurspublic void validateDatabase(int options) throws java.sql.SQLException
options
must be one of the
following:
VALIDATE_READ_ONLY
- read-only validation,
no repair
VALIDATE_FULL
- full validation and repair
options
can additionally be combined in
a bitmask with VALIDATE_IGNORE_CHECKSUM
to ignore
checksums while performing validation.
validateDatabase
in interface MaintenanceManager
options
- Either 0, VALIDATE_READ_ONLY
, or
VALIDATE_FULL
java.sql.SQLException
- if a database access error occurspublic void setSweepThreshold(int transactions) throws java.sql.SQLException
transactions
is 0, automatic sweeping is disabled.
setSweepThreshold
in interface MaintenanceManager
transactions
- The interval of transactions between automatic
sweeps of the database. Can be set to 0, which disables
automatic sweeping of the database.
java.sql.SQLException
- if a database access error occurspublic void sweepDatabase() throws java.sql.SQLException
sweepDatabase
in interface MaintenanceManager
java.sql.SQLException
- if a database access error occurspublic void activateShadowFile() throws java.sql.SQLException
gfix -activate
.
activateShadowFile
in interface MaintenanceManager
java.sql.SQLException
- if a database access error occurspublic void killUnavailableShadows() throws java.sql.SQLException
gfix -kill
.
killUnavailableShadows
in interface MaintenanceManager
java.sql.SQLException
- if a database access error occurspublic void listLimboTransactions() throws java.sql.SQLException
listLimboTransactions
in interface MaintenanceManager
java.sql.SQLException
- if a database access error occurspublic int[] getLimboTransactions() throws java.sql.SQLException
java.sql.SQLException
public void commitTransaction(int transactionId) throws java.sql.SQLException
commitTransaction
in interface MaintenanceManager
transactionId
- The ID of the limbo transaction to be committed
java.sql.SQLException
- if a database access error occurs or the
given transaction ID is not validpublic void rollbackTransaction(int transactionId) throws java.sql.SQLException
rollbackTransaction
in interface MaintenanceManager
transactionId
- The ID of the limbo transaction to be rolled back
java.sql.SQLException
- if a database access error occurs or the
given transaction ID is not valid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |