From c89dfe3f1ed81e70305f1cbdac3b165dfc6ff79f Mon Sep 17 00:00:00 2001 From: ce Date: Wed, 24 Apr 2019 12:30:38 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BD=BF=E7=94=A8=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E7=9A=84map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GoroutineSessionMap.go | 4 ++++ TransactionAspectSupport.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/GoroutineSessionMap.go b/GoroutineSessionMap.go index 8c037f5..cff4acc 100644 --- a/GoroutineSessionMap.go +++ b/GoroutineSessionMap.go @@ -24,3 +24,7 @@ func (it *GoroutineSessionMap) Get(k int64) Session { return nil } } + +func (it *GoroutineSessionMap) Delete(k int64) { + it.m.Delete(k) +} diff --git a/TransactionAspectSupport.go b/TransactionAspectSupport.go index 543ed82..983d9ac 100644 --- a/TransactionAspectSupport.go +++ b/TransactionAspectSupport.go @@ -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)