1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.context.notification; |
8 | |
|
9 | |
import org.mule.api.context.notification.BlockingServerEvent; |
10 | |
import org.mule.api.context.notification.ServerNotification; |
11 | |
import org.mule.api.transaction.Transaction; |
12 | |
|
13 | |
public class TransactionNotification extends ServerNotification implements BlockingServerEvent |
14 | |
{ |
15 | |
|
16 | |
|
17 | |
|
18 | |
private static final long serialVersionUID = -3245036187011582121L; |
19 | |
public static final int TRANSACTION_BEGAN = TRANSACTION_EVENT_ACTION_START_RANGE + 1; |
20 | |
public static final int TRANSACTION_COMMITTED = TRANSACTION_EVENT_ACTION_START_RANGE + 2; |
21 | |
public static final int TRANSACTION_ROLLEDBACK = TRANSACTION_EVENT_ACTION_START_RANGE + 3; |
22 | |
|
23 | |
static |
24 | |
{ |
25 | 0 | registerAction("begin", TRANSACTION_BEGAN); |
26 | 0 | registerAction("commit", TRANSACTION_COMMITTED); |
27 | 0 | registerAction("rollback", TRANSACTION_ROLLEDBACK); |
28 | 0 | } |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
private String transactionStringId; |
35 | |
|
36 | |
public TransactionNotification(Transaction transaction, int action) |
37 | |
{ |
38 | 0 | super(transaction.getId(), action, transaction.getId()); |
39 | 0 | this.transactionStringId = transaction.getId(); |
40 | 0 | } |
41 | |
|
42 | |
public String getTransactionStringId() |
43 | |
{ |
44 | 0 | return this.transactionStringId; |
45 | |
} |
46 | |
|
47 | |
@Override |
48 | |
public String toString() |
49 | |
{ |
50 | 0 | return EVENT_NAME + "{" + "action=" + getActionName(action) + ", transactionStringId=" + transactionStringId |
51 | |
+ ", timestamp=" + timestamp + "}"; |
52 | |
} |
53 | |
|
54 | |
} |