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