Skip to content

Commit

Permalink
fix 使用线程安全的map
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Apr 24, 2019
1 parent 96b0f69 commit c89dfe3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions GoroutineSessionMap.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ func (it *GoroutineSessionMap) Get(k int64) Session {
return nil
}
}

func (it *GoroutineSessionMap) Delete(k int64) {
it.m.Delete(k)
}
2 changes: 1 addition & 1 deletion TransactionAspectSupport.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func AopProxyService(service reflect.Value, engine *GoMybatisEngine) {
session, err = engine.NewSession(beanName)
defer func() {
session.Close()
engine.GoroutineSessionMap().Put(goroutineID, nil)
engine.GoroutineSessionMap().Delete(goroutineID)
}()
if err != nil {
panic(err)
Expand Down

0 comments on commit c89dfe3

Please sign in to comment.