Skip to content

Commit

Permalink
add a reproduction program for sesscion close case
Browse files Browse the repository at this point in the history
  • Loading branch information
t-horikawa committed Sep 25, 2023
1 parent 225d629 commit 778ce05
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/cases/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,16 @@ tasks.register('runMS', JavaExec) {
systemProperty 'org.slf4j.simpleLogger.showShortLogName', 'true'
systemProperty 'org.slf4j.simpleLogger.levelInBrackets', 'true'
}


tasks.register('run345', JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = 'com.tsurugidb.tsubakuro.examples.sesscionClose.Main'

systemProperty 'tsurugi.dbname', findProperty('tsurugi.dbname') ?: 'ipc:tsurugi'

systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', findProperty('loglevel') ?: 'info'
systemProperty 'org.slf4j.simpleLogger.showThreadName', 'false'
systemProperty 'org.slf4j.simpleLogger.showShortLogName', 'true'
systemProperty 'org.slf4j.simpleLogger.levelInBrackets', 'true'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.tsurugidb.tsubakuro.examples.sesscionClose;

import com.tsurugidb.tsubakuro.exception.ServerException;
import com.tsurugidb.tsubakuro.common.Session;
import com.tsurugidb.tsubakuro.common.SessionBuilder;
import com.tsurugidb.tsubakuro.sql.SqlClient;


public final class Main {
private static String url = System.getProperty("tsurugi.dbname");

public static void main(String[] args) {
for (int i = 0; i < 50; i++) {
try {
Session session = SessionBuilder.connect(url).create();
SqlClient sqlClient = SqlClient.attach(session);
var futureTransaction = sqlClient.createTransaction();

session.close();
} catch (Exception e) {
System.out.println(e);
}
}
System.out.println("================");
for (int i = 0; i < 50; i++) {
try {
Session session = SessionBuilder.connect(url).create();
SqlClient sqlClient = SqlClient.attach(session);
var futureTransaction = sqlClient.createTransaction().get();

session.close();
} catch (Exception e) {
System.out.println(e);
}
}
}

private Main(String[] args) {
}
}

0 comments on commit 778ce05

Please sign in to comment.