File tree Expand file tree Collapse file tree
tx-plugins-db/src/main/java/com/codingapi/tx/datasource/relational Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ public class LCNDBConnection extends AbstractTransactionThread implements LCNCon
4343
4444 private TxTask waitTask ;
4545
46+ private boolean readOnly = false ;
47+
4648
4749 public LCNDBConnection (Connection connection , DataSourceService dataSourceService , ICallClose <ILCNResource > runnable ) {
4850 logger .info ("init lcn connection ! " );
@@ -102,6 +104,11 @@ public void close() throws SQLException {
102104 return ;
103105 }
104106
107+ if (readOnly ){
108+ closeConnection ();
109+ logger .info ("now transaction is readOnly , groupId:" + groupId );
110+ return ;
111+ }
105112
106113 logger .info ("now transaction state is " + state + ", (1:commit,0:rollback) groupId:" + groupId );
107114
@@ -187,6 +194,7 @@ public void setAutoCommit(boolean autoCommit) throws SQLException {
187194 public void setReadOnly (boolean readOnly ) throws SQLException {
188195
189196 if (readOnly ) {
197+ this .readOnly = readOnly ;
190198 logger .info ("setReadOnly - >" + readOnly );
191199 connection .setReadOnly (readOnly );
192200
You can’t perform that action at this time.
0 commit comments