Class TransactionConfig
- All Implemented Interfaces:
Cloneable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TransactionConfigDefault configuration used if null is passed to methods that create a transaction. -
Constructor Summary
ConstructorsConstructorDescriptionAn instance created using the default constructor is initialized with the system's default settings. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBulk()Return true if the Bulk attribute is set.booleanDeprecated.booleanDeprecated.This has been replaced bygetReadUncommitted()to conform to ANSI database isolation terminology.booleanReturn if the transaction is configured to not write or synchronously flush the log it when commits.booleanReturn if the transaction is configured to not wait if a lock request cannot be immediately granted.booleanReturn if the transaction is configured for read committed isolation.booleanReturn if read operations performed by the transaction are configured to return modified but not yet committed data.booleanReturn true if the transaction is configured for Snapshot Isolation.booleangetSync()Return if the transaction is configured to write and synchronously flush the log it when commits.booleangetWait()Return if the transaction is configured to wait if a lock request cannot be immediately granted.booleanReturn if the transaction is configured to write but not synchronously flush the log it when commits.voidsetBulk(boolean bulk) Configures the transaction to enable the transactional bulk insert optimization.voidsetDegree2(boolean degree2) Deprecated.This has been replaced bysetReadCommitted(boolean)to conform to ANSI database isolation terminology.voidsetDirtyRead(boolean dirtyRead) Deprecated.This has been replaced bysetReadUncommitted(boolean)to conform to ANSI database isolation terminology.voidsetNoSync(boolean noSync) Configure the transaction to not write or synchronously flush the log it when commits.voidsetNoWait(boolean noWait) Configure the transaction to not wait if a lock request cannot be immediately granted.voidsetReadCommitted(boolean readCommitted) Configure the transaction for read committed isolation.voidsetReadUncommitted(boolean readUncommitted) Configure read operations performed by the transaction to return modified but not yet committed data.voidsetSnapshot(boolean snapshot) This transaction will execute with snapshot isolation.voidsetSync(boolean sync) Configure the transaction to write and synchronously flush the log it when commits.voidsetWait(boolean wait) Configure the transaction to wait if a lock request cannot be immediately granted.voidsetWriteNoSync(boolean writeNoSync) Configure the transaction to write but not synchronously flush the log it when commits.
-
Field Details
-
DEFAULT
Default configuration used if null is passed to methods that create a transaction.
-
-
Constructor Details
-
TransactionConfig
public TransactionConfig()An instance created using the default constructor is initialized with the system's default settings.
-
-
Method Details
-
setReadCommitted
public void setReadCommitted(boolean readCommitted) Configure the transaction for read committed isolation.This ensures the stability of the current data item read by the cursor but permits data read by this transaction to be modified or deleted prior to the commit of the transaction.
- Parameters:
readCommitted- If true, configure the transaction for read committed isolation.
-
getReadCommitted
public boolean getReadCommitted()Return if the transaction is configured for read committed isolation.- Returns:
- If the transaction is configured for read committed isolation.
-
setDegree2
public void setDegree2(boolean degree2) Deprecated.This has been replaced bysetReadCommitted(boolean)to conform to ANSI database isolation terminology.Configure the transaction for read committed isolation.This ensures the stability of the current data item read by the cursor but permits data read by this transaction to be modified or deleted prior to the commit of the transaction.
- Parameters:
degree2- If true, configure the transaction for read committed isolation.
-
getDegree2
public boolean getDegree2()Deprecated.This has been replaced bygetReadCommitted()to conform to ANSI database isolation terminology.Return if the transaction is configured for read committed isolation.- Returns:
- If the transaction is configured for read committed isolation.
-
setReadUncommitted
public void setReadUncommitted(boolean readUncommitted) Configure read operations performed by the transaction to return modified but not yet committed data.- Parameters:
readUncommitted- If true, configure read operations performed by the transaction to return modified but not yet committed data.
-
getReadUncommitted
public boolean getReadUncommitted()Return if read operations performed by the transaction are configured to return modified but not yet committed data.- Returns:
- If read operations performed by the transaction are configured to return modified but not yet committed data.
-
setDirtyRead
public void setDirtyRead(boolean dirtyRead) Deprecated.This has been replaced bysetReadUncommitted(boolean)to conform to ANSI database isolation terminology.Configure read operations performed by the transaction to return modified but not yet committed data.- Parameters:
dirtyRead- If true, configure read operations performed by the transaction to return modified but not yet committed data.
-
getDirtyRead
public boolean getDirtyRead()Deprecated.This has been replaced bygetReadUncommitted()to conform to ANSI database isolation terminology.Return if read operations performed by the transaction are configured to return modified but not yet committed data.- Returns:
- If read operations performed by the transaction are configured to return modified but not yet committed data.
-
setNoSync
public void setNoSync(boolean noSync) Configure the transaction to not write or synchronously flush the log it when commits.This behavior may be set for a database environment using the Environment.setMutableConfig method. Any value specified to this method overrides that setting.
The default is false for this class and the database environment.
- Parameters:
noSync- If true, transactions exhibit the ACI (atomicity, consistency, and isolation) properties, but not D (durability); that is, database integrity will be maintained, but if the application or system fails, it is possible some number of the most recently committed transactions may be undone during recovery. The number of transactions at risk is governed by how many log updates can fit into the log buffer, how often the operating system flushes dirty buffers to disk, and how often the log is checkpointed.
-
getNoSync
public boolean getNoSync()Return if the transaction is configured to not write or synchronously flush the log it when commits.- Returns:
- If the transaction is configured to not write or synchronously flush the log it when commits.
-
setNoWait
public void setNoWait(boolean noWait) Configure the transaction to not wait if a lock request cannot be immediately granted.The default is false for this class and the database environment.
- Parameters:
noWait- If true, transactions will not wait if a lock request cannot be immediately granted, insteadDeadlockExceptionwill be thrown.
-
getNoWait
public boolean getNoWait()Return if the transaction is configured to not wait if a lock request cannot be immediately granted.- Returns:
- If the transaction is configured to not wait if a lock request cannot be immediately granted.
-
setSnapshot
public void setSnapshot(boolean snapshot) This transaction will execute with snapshot isolation. For databases configured withDatabaseConfig.setMultiversion(boolean), data values will be read as they are when the transaction begins, without taking read locks.Updates operations performed in the transaction will cause a
DeadlockExceptionto be thrown if data is modified between reading and writing it. -
getSnapshot
public boolean getSnapshot()Return true if the transaction is configured for Snapshot Isolation.This method may be called at any time during the life of the application.
- Returns:
- True if the transaction is configured for Snapshot Isolation.
-
setSync
public void setSync(boolean sync) Configure the transaction to write and synchronously flush the log it when commits.This behavior may be set for a database environment using the Environment.setMutableConfig method. Any value specified to this method overrides that setting.
The default is false for this class and true for the database environment.
If true is passed to both setSync and setNoSync, setSync will take precedence.
- Parameters:
sync- If true, transactions exhibit all the ACID (atomicity, consistency, isolation, and durability) properties.
-
getSync
public boolean getSync()Return if the transaction is configured to write and synchronously flush the log it when commits.- Returns:
- If the transaction is configured to write and synchronously flush the log it when commits.
-
setWait
public void setWait(boolean wait) Configure the transaction to wait if a lock request cannot be immediately granted.The default is true unless
EnvironmentConfig.setTxnNoWait(boolean)is called.- Parameters:
wait- If true, transactions will wait if a lock request cannot be immediately granted, insteadDeadlockExceptionwill be thrown.
-
getWait
public boolean getWait()Return if the transaction is configured to wait if a lock request cannot be immediately granted.- Returns:
- If the transaction is configured to wait if a lock request cannot be immediately granted.
-
setWriteNoSync
public void setWriteNoSync(boolean writeNoSync) Configure the transaction to write but not synchronously flush the log it when commits.This behavior may be set for a database environment using the Environment.setMutableConfig method. Any value specified to this method overrides that setting.
The default is false for this class and the database environment.
- Parameters:
writeNoSync- If true, transactions exhibit the ACI (atomicity, consistency, and isolation) properties, but not D (durability); that is, database integrity will be maintained, but if the operating system fails, it is possible some number of the most recently committed transactions may be undone during recovery. The number of transactions at risk is governed by how often the operating system flushes dirty buffers to disk, and how often the log is checkpointed.
-
getWriteNoSync
public boolean getWriteNoSync()Return if the transaction is configured to write but not synchronously flush the log it when commits.- Returns:
- If the transaction is configured to not write or synchronously flush the log it when commits.
-
setBulk
public void setBulk(boolean bulk) Configures the transaction to enable the transactional bulk insert optimization. When this attribute is set, the transaction will avoid logging the contents of insertions on newly allocated database pages. In a transaction that inserts a large number of new records, the I/O savings of choosing this option can be significant. Users of this option should be aware of several issues. When the optimization is in effect, page allocations that extend the database file are logged as usual; this allows transaction aborts to work correctly, both online and during recovery. At commit time, the database's pages are flushed to disk, eliminating the need to roll-forward the transaction during normal recovery. However, there are other recovery operations that depend on roll-forward, and care must be taken when Bulk-enabled transactions interact with them. In particular, Bulk is incompatible with replication, and is simply ignored when replication is enabled. Also, hot backup procedures must follow a particular protocol, introduced in 11gr2.5.1, to set a flag in the environment before starting to copy files. It is especially important to note that incremental hot backups can be invalidated by use of the bulk insert optimization. Please see the hot backup description in the Getting Started with Transactions Guide, and the description of the HotbackupInProgress attribute inEnvironmentConfigfor further information.The bulk insert optimization is effective only for top-level transactions.
- Parameters:
bulk- If true, configure the transaction to enable the bulk optimization.
-
getBulk
public boolean getBulk()Return true if the Bulk attribute is set.- Returns:
- The current setting of the Bulk attribute.
-
getReadCommitted()to conform to ANSI database isolation terminology.