Code Review
/
ric-plt
/
submgr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
RICPLT-3014 Subs multiple rmr endpoints
[ric-plt/submgr.git]
/
pkg
/
control
/
transaction.go
diff --git
a/pkg/control/transaction.go
b/pkg/control/transaction.go
index
867b854
..
9adaeca
100644
(file)
--- a/
pkg/control/transaction.go
+++ b/
pkg/control/transaction.go
@@
-36,7
+36,7
@@
type TransactionXappKey struct {
}
func (key *TransactionXappKey) String() string {
}
func (key *TransactionXappKey) String() string {
- return
key.RmrEndpoint.String() + "/" + key.Xid
+ return
"transkey(" + key.RmrEndpoint.String() + "/" + key.Xid + ")"
}
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
@@
-61,14
+61,18
@@
type Transaction struct {
ForwardRespToXapp bool
}
ForwardRespToXapp bool
}
-func (t *Transaction) String() string {
- t.mutex.Lock()
- defer t.mutex.Unlock()
+func (t *Transaction) StringImpl() string {
var subId string = "?"
if t.Subs != nil {
subId = strconv.FormatUint(uint64(t.Subs.Seq), 10)
}
var subId string = "?"
if t.Subs != nil {
subId = strconv.FormatUint(uint64(t.Subs.Seq), 10)
}
- return subId + "/" + t.RmrEndpoint.String() + "/" + t.Xid
+ return "trans(" + t.RmrEndpoint.String() + "/" + t.Xid + "/" + t.Meid.RanName + "/" + subId + ")"
+}
+
+func (t *Transaction) String() string {
+ t.mutex.Lock()
+ defer t.mutex.Unlock()
+ return t.StringImpl()
}
func (t *Transaction) GetXid() string {
}
func (t *Transaction) GetXid() string {
@@
-115,16
+119,18
@@
func (t *Transaction) RetryTransaction() {
}
func (t *Transaction) Release() {
}
func (t *Transaction) Release() {
- xapp.Logger.Info("Transaction: Releasing %s", t)
t.mutex.Lock()
t.mutex.Lock()
- defer t.mutex.Unlock()
- if t.Subs != nil {
- t.Subs.UnSetTransaction(t)
- }
- if t.tracker != nil {
- xappkey := TransactionXappKey{t.RmrEndpoint, t.Xid}
- t.tracker.UnTrackTransaction(xappkey)
- }
+ subs := t.Subs
+ tracker := t.tracker
+ xappkey := TransactionXappKey{t.RmrEndpoint, t.Xid}
t.Subs = nil
t.tracker = nil
t.Subs = nil
t.tracker = nil
+ t.mutex.Unlock()
+
+ if subs != nil {
+ subs.UnSetTransaction(t)
+ }
+ if tracker != nil {
+ tracker.UnTrackTransaction(xappkey)
+ }
}
}