~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to src/main/java/net/sf/ehcache/transaction/TransactionIDFactory.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 *  Copyright 2003-2010 Terracotta, Inc.
 
2
 *  Copyright Terracotta, Inc.
3
3
 *
4
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
5
 *  you may not use this file except in compliance with the License.
15
15
 */
16
16
package net.sf.ehcache.transaction;
17
17
 
 
18
import java.util.Set;
 
19
 
 
20
import net.sf.ehcache.Ehcache;
18
21
import net.sf.ehcache.transaction.xa.XidTransactionID;
19
22
 
20
23
import javax.transaction.xa.Xid;
29
32
 
30
33
    /**
31
34
     * Create a unique transaction ID
 
35
     *
32
36
     * @return a transaction ID
33
37
     */
34
38
    TransactionID createTransactionID();
35
39
 
36
40
    /**
 
41
     * Restore a transaction ID from its serialized form
 
42
     *
 
43
     * @param serializedForm the TransactionID serialized form
 
44
     * @return the restored TransactionID
 
45
     */
 
46
    TransactionID restoreTransactionID(TransactionIDSerializedForm serializedForm);
 
47
 
 
48
    /**
37
49
     * Create a transaction ID based on a XID for uniqueness
 
50
     *
38
51
     * @param xid the XID
39
52
     * @return a transaction ID
40
53
     */
41
 
    XidTransactionID createXidTransactionID(Xid xid);
 
54
    XidTransactionID createXidTransactionID(Xid xid, Ehcache cache);
 
55
 
 
56
    /**
 
57
     * Restore a XID transaction ID from its serialized form
 
58
     *
 
59
     * @param serializedForm the XidTransactionID serialized form
 
60
     * @return the restored XidTransactionID
 
61
     */
 
62
    XidTransactionID restoreXidTransactionID(XidTransactionIDSerializedForm serializedForm);
 
63
 
 
64
    /**
 
65
     * Mark that this transaction's decision is commit
 
66
     *
 
67
     * @param transactionID transaction to be marked
 
68
     */
 
69
    void markForCommit(TransactionID transactionID);
 
70
 
 
71
    /**
 
72
     * Mark this transaction ID for rollback
 
73
     */
 
74
    void markForRollback(XidTransactionID transactionID);
 
75
 
 
76
    /**
 
77
     * Check if the given transaction should be committed or not
 
78
     *
 
79
     * @param transactionID transaction to be queried
 
80
     * @return true if the transaction should be committed
 
81
     */
 
82
    boolean isDecisionCommit(TransactionID transactionID);
 
83
 
 
84
    /**
 
85
     * Clear this transaction's state representation.
 
86
     *
 
87
     * @param transactionID transaction to be cleared
 
88
     */
 
89
    void clear(TransactionID transactionID);
 
90
 
 
91
    /**
 
92
     * Get the set of all XID transactions of a cache.
 
93
     *
 
94
     * @return the set of transactions
 
95
     */
 
96
    Set<XidTransactionID> getAllXidTransactionIDsFor(Ehcache cache);
 
97
 
 
98
    /**
 
99
     * Get the set of all known transactions.
 
100
     *
 
101
     * @return the set of transactions
 
102
     */
 
103
    Set<TransactionID> getAllTransactionIDs();
 
104
 
 
105
    /**
 
106
     * Return {@code true} if the factory state is persistent (survives JVM restart).
 
107
     *
 
108
     * @return {@code true} is state is persistent
 
109
     */
 
110
    Boolean isPersistent();
 
111
 
 
112
    /**
 
113
     * Check if the transaction ID expired, ie: that the transaction died abnormally
 
114
     *
 
115
     * @return true if the transaction ID expired and should be cleaned up, false otherwise
 
116
     */
 
117
    boolean isExpired(TransactionID transactionID);
42
118
 
43
119
}