|
33 | 33 | import org.mycore.ocfl.niofs.storage.MCROCFLTransactionalTempFileStorage;
|
34 | 34 |
|
35 | 35 | /**
|
36 |
| - * Manages transactions for the OCFL file system, implementing {@link MCRPersistenceTransaction}. |
37 |
| - * Provides methods to begin, commit, rollback, and check the status of transactions. |
| 36 | + * Manages transactions for the OCFL (Oxford Common File Layout) file system within MyCoRe, |
| 37 | + * implementing {@link MCRPersistenceTransaction}. This class coordinates the lifecycle of a transaction, |
| 38 | + * including beginning, committing, and rolling back changes, ensuring data consistency in the OCFL file system. |
| 39 | + * <p> |
| 40 | + * Each transaction is uniquely identified by an ID, tracked in a thread-local variable for |
| 41 | + * thread-safe operations. |
38 | 42 | */
|
39 | 43 | public class MCROCFLFileSystemTransaction implements MCRPersistenceTransaction {
|
40 | 44 |
|
@@ -146,10 +150,20 @@ public int getCommitPriority() {
|
146 | 150 | return 5000;
|
147 | 151 | }
|
148 | 152 |
|
| 153 | + /** |
| 154 | + * Retrieves the current transaction ID, if any. |
| 155 | + * |
| 156 | + * @return the transaction ID, or {@code null} if no transaction is active. |
| 157 | + */ |
149 | 158 | public static Long getTransactionId() {
|
150 | 159 | return TRANSACTION_ID.get();
|
151 | 160 | }
|
152 | 161 |
|
| 162 | + /** |
| 163 | + * Checks if a transaction is currently active. |
| 164 | + * |
| 165 | + * @return {@code true} if a transaction is active, {@code false} otherwise. |
| 166 | + */ |
153 | 167 | public static boolean isActive() {
|
154 | 168 | return MCRTransactionManager.isActive(MCROCFLFileSystemTransaction.class);
|
155 | 169 | }
|
|
0 commit comments