Package com.ibm.di.store
Class DeltaStore
- java.lang.Object
-
- com.ibm.di.store.DeltaStore
-
public class DeltaStore extends java.lang.Object
This class implements the functionality for creating and maintaining a single Delta Store table.Note: For internal use only!
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TABLE_PREFIX
-
Constructor Summary
Constructors Constructor Description DeltaStore(java.lang.String identifier, boolean isRestarting)
DeltaStore(java.lang.String identifier, boolean isRestarting, Log logger, boolean removeDeleted)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeDelta()
void
closeReusedStatements()
void
commit()
Commit the last transactions.void
commitOnEndIter()
Commit if in commit mode "On end of AL cycle".void
deleteEntry(java.lang.String key)
Entry
findEntry(java.lang.String key)
byte[]
findEntryBytesVerify(java.lang.String key)
Entry
findEntryVerify(java.lang.String key)
Entry
getNextDeletedEntry(boolean deleteEntry)
Returns the next deleted Entry.Entry
getNextDeletedEntry(boolean deleteEntry, java.util.Set<java.lang.String> keys)
Returns the next deleted Entry, given a Set of keys for unchanged Entries.Entry
getStatistics()
java.lang.String
getStatisticsString()
void
insertEntry(java.lang.String key, Entry entry)
void
rollback()
Rollback the last transactions.void
selectDeletedEntries()
Selects the deleted entries from the Delta Store table.void
setAllowDuplicateDeltaKeys(boolean allowDuplicateDeltaKeys)
Indicates whether the duplicate delta keys are allowed.boolean
setCommitMode(java.lang.String mode)
Set the commit behavior of Delta.void
setRowLocking(int level)
This method sets the transaction isolation level used when working with the Delta Store.void
updateEntry(java.lang.String key, Entry entry)
void
updateEntryBytes(java.lang.String key, byte[] entryBytes)
void
updateSequence(java.lang.String key)
-
-
-
Field Detail
-
TABLE_PREFIX
public static final java.lang.String TABLE_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DeltaStore
public DeltaStore(java.lang.String identifier, boolean isRestarting, Log logger, boolean removeDeleted) throws java.lang.Exception
- Throws:
java.lang.Exception
-
DeltaStore
public DeltaStore(java.lang.String identifier, boolean isRestarting) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
setCommitMode
public boolean setCommitMode(java.lang.String mode)
Set the commit behavior of Delta.- Parameters:
mode
- The intended behavior. Possible values are:- "After every database operation"
- "On Connector close"
- "On end of AL cycle"
- "No autocommit"
- Returns:
- false if the requested mode is not a legal value
-
closeDelta
public void closeDelta() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
closeReusedStatements
public void closeReusedStatements() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
updateSequence
public void updateSequence(java.lang.String key) throws java.lang.Exception
- Throws:
java.lang.Exception
-
updateEntry
public void updateEntry(java.lang.String key, Entry entry) throws java.lang.Exception
- Throws:
java.lang.Exception
-
updateEntryBytes
public void updateEntryBytes(java.lang.String key, byte[] entryBytes) throws java.lang.Exception
- Throws:
java.lang.Exception
-
insertEntry
public void insertEntry(java.lang.String key, Entry entry) throws java.lang.Exception
- Throws:
java.lang.Exception
-
findEntry
public Entry findEntry(java.lang.String key) throws java.lang.Exception
- Throws:
java.lang.Exception
-
findEntryVerify
public Entry findEntryVerify(java.lang.String key) throws java.lang.Exception
- Throws:
java.lang.Exception
-
findEntryBytesVerify
public byte[] findEntryBytesVerify(java.lang.String key) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteEntry
public void deleteEntry(java.lang.String key) throws java.lang.Exception
- Throws:
java.lang.Exception
-
selectDeletedEntries
public void selectDeletedEntries() throws java.lang.Exception
Selects the deleted entries from the Delta Store table.- Throws:
java.lang.Exception
- if a database access error occurs or the given parameters are not ResultSet constants indicating type and concurrency
-
getNextDeletedEntry
public Entry getNextDeletedEntry(boolean deleteEntry) throws java.lang.Exception
Returns the next deleted Entry.- Throws:
java.lang.Exception
-
getNextDeletedEntry
public Entry getNextDeletedEntry(boolean deleteEntry, java.util.Set<java.lang.String> keys) throws java.lang.Exception
Returns the next deleted Entry, given a Set of keys for unchanged Entries. Will not return any Entry with a key in the given Set.- Parameters:
deleteEntry
- - If set, also delete the Entry from the deltaStorekeys
- - Should be null, or a Set containing keys for unchanged entries- Returns:
- The next deleted Entry
- Throws:
java.lang.Exception
-
getStatistics
public Entry getStatistics()
-
getStatisticsString
public java.lang.String getStatisticsString()
- Returns:
- The statistics for this run
- Since:
- 7.0
-
commit
public void commit() throws java.sql.SQLException
Commit the last transactions. The operation will NOT be executed if at the moment the Delta Store is iterating deleted entries.- Throws:
java.sql.SQLException
- Thrown if an error occurs
-
rollback
public void rollback() throws java.sql.SQLException
Rollback the last transactions. The operation will NOT be executed if at the moment the Delta Store is iterating deleted entries.- Throws:
java.sql.SQLException
- Thrown if an error occurs
-
commitOnEndIter
public void commitOnEndIter() throws java.sql.SQLException
Commit if in commit mode "On end of AL cycle". The operation will NOT be executed if at the moment the Delta Store is iterating deleted entries.- Throws:
java.sql.SQLException
- Thrown if an error occurs
-
setAllowDuplicateDeltaKeys
public void setAllowDuplicateDeltaKeys(boolean allowDuplicateDeltaKeys)
Indicates whether the duplicate delta keys are allowed.- Parameters:
allowDuplicateDeltaKeys
-true
if duplicate delta keys are allowedfalse
otherwise
-
setRowLocking
public void setRowLocking(int level) throws java.lang.Exception
This method sets the transaction isolation level used when working with the Delta Store. Setting higher isolation level reduces the transaction anomalies known as 'dirty reads', 'repeatable reads' and 'phantom reads' by using row and table locks.The transaction level is set only if transactions and the specified level are supported by the underlying database.
- Parameters:
level
- the integer value of the level as defined in theConnection
- Throws:
java.sql.SQLException
- if a database access error occurs.java.lang.Exception
-
-