File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ protected void CheckReaders()
265
265
}
266
266
}
267
267
268
- public void CloseCommands ( )
268
+ public virtual void CloseCommands ( )
269
269
{
270
270
_releasing = true ;
271
271
try
Original file line number Diff line number Diff line change
1
+ using System ;
1
2
using System . Data . Common ;
2
3
using System . Text ;
3
4
using NHibernate . AdoNet . Util ;
@@ -97,5 +98,21 @@ private MySqlClientSqlCommandSet CreateConfiguredBatch()
97
98
{
98
99
return new MySqlClientSqlCommandSet ( batchSize ) ;
99
100
}
101
+
102
+ public override void CloseCommands ( )
103
+ {
104
+ base . CloseCommands ( ) ;
105
+
106
+ try
107
+ {
108
+ currentBatch . Dispose ( ) ;
109
+ }
110
+ catch ( Exception e )
111
+ {
112
+ // Prevent exceptions when closing the batch from hiding any original exception
113
+ // (We do not know here if this batch closing occurs after a failure or not.)
114
+ Log . Warn ( "Exception closing batcher" , e ) ;
115
+ }
116
+ }
100
117
}
101
118
}
Original file line number Diff line number Diff line change @@ -117,5 +117,21 @@ private SqlClientSqlCommandSet CreateConfiguredBatch()
117
117
118
118
return result ;
119
119
}
120
+
121
+ public override void CloseCommands ( )
122
+ {
123
+ base . CloseCommands ( ) ;
124
+
125
+ try
126
+ {
127
+ _currentBatch . Dispose ( ) ;
128
+ }
129
+ catch ( Exception e )
130
+ {
131
+ // Prevent exceptions when closing the batch from hiding any original exception
132
+ // (We do not know here if this batch closing occurs after a failure or not.)
133
+ Log . Warn ( "Exception closing batcher" , e ) ;
134
+ }
135
+ }
120
136
}
121
137
}
You can’t perform that action at this time.
0 commit comments