change
This commit is contained in:
parent
a000e6d306
commit
bee49162ff
|
@ -27,6 +27,15 @@ public class MultiThreadsWithSameStatmentTest {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void release(){
|
||||||
|
try {
|
||||||
|
stmt.close();
|
||||||
|
conn.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -46,8 +55,8 @@ public class MultiThreadsWithSameStatmentTest {
|
||||||
}
|
}
|
||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
resultSet.close();
|
resultSet.close();
|
||||||
|
service.release();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -57,6 +66,7 @@ public class MultiThreadsWithSameStatmentTest {
|
||||||
try {
|
try {
|
||||||
Service service = new Service();
|
Service service = new Service();
|
||||||
service.stmt.executeUpdate("insert into jdbctest.weather values(now,1)");
|
service.stmt.executeUpdate("insert into jdbctest.weather values(now,1)");
|
||||||
|
service.release();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -76,13 +86,5 @@ public class MultiThreadsWithSameStatmentTest {
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void after() {
|
public void after() {
|
||||||
try {
|
|
||||||
if (stmt != null)
|
|
||||||
stmt.close();
|
|
||||||
if (conn != null)
|
|
||||||
conn.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue