• R/O
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision2483 (tree)
Time2022-11-07 19:30:15
Authort_nakayama1971

Log Message

(empty log message)

Change Summary

Incremental Difference

--- trunk/framework/fwBase/src/main/java/common/db/JdbcSource.java (revision 2482)
+++ trunk/framework/fwBase/src/main/java/common/db/JdbcSource.java (revision 2483)
@@ -52,8 +52,7 @@
5252 * @return DAOオブジェクト
5353 */
5454 public static Dao getDao() {
55- final var df = Factory.create(DaoSession.class);
56- return df.getDao(DEFAULT_NAME.get());
55+ return getDao(DEFAULT_NAME.get());
5756 }
5857
5958 /**
@@ -115,8 +114,7 @@
115114 * @return エンコーディング文字列
116115 */
117116 public static Charset getCharset() {
118- final var cf = Factory.create(JdbcSession.class);
119- return cf.getCharset(DEFAULT_NAME.get());
117+ return getCharset(DEFAULT_NAME.get());
120118 }
121119
122120 /**
@@ -142,6 +140,17 @@
142140 }
143141
144142 /**
143+ * 最終リリース処理
144+ */
145+ public static void shutdown() {
146+ try {
147+ Factory.create(DaoSession.class).shutdown();
148+ } finally {
149+ deregister(JdbcSource.class.getClassLoader());
150+ }
151+ }
152+
153+ /**
145154 * ドライバ抹消
146155 *
147156 * @param cl ドライバ読込クラスローダ
--- trunk/framework/fwBase/src/main/java/common/db/dao/DaoSession.java (revision 2482)
+++ trunk/framework/fwBase/src/main/java/common/db/dao/DaoSession.java (revision 2483)
@@ -6,6 +6,7 @@
66 * @author Tadashi Nakayama
77 */
88 public interface DaoSession {
9+
910 /**
1011 * DAO取得
1112 *
@@ -13,4 +14,9 @@
1314 * @return コネクション
1415 */
1516 Dao getDao(String cname);
17+
18+ /**
19+ * 最終リリース
20+ */
21+ void shutdown();
1622 }
--- trunk/framework/fwOnline/src/main/java/online/listener/ContextListener.java (revision 2482)
+++ trunk/framework/fwOnline/src/main/java/online/listener/ContextListener.java (revision 2483)
@@ -18,7 +18,7 @@
1818 */
1919 @Override
2020 public void contextDestroyed(final ServletContextEvent arg0) {
21- JdbcSource.deregister(getClass().getClassLoader());
21+ JdbcSource.shutdown();
2222 }
2323
2424 /**
--- trunk/framework/pjBat/src/main/java/project/batch/ProjectPerform.java (revision 2482)
+++ trunk/framework/pjBat/src/main/java/project/batch/ProjectPerform.java (revision 2483)
@@ -63,7 +63,11 @@
6363 * @return 処理結果
6464 */
6565 public static int start(final Class<? extends ProjectBatch> cls, final String... args) {
66- return new ProjectPerform<>(cls).execute(args);
66+ try {
67+ return new ProjectPerform<>(cls).execute(args);
68+ } finally {
69+ JdbcSource.shutdown();
70+ }
6771 }
6872
6973 /**
--- trunk/framework/pjMw/src/main/java/common/db/dao/hibernate/DaoSessionImpl.java (revision 2482)
+++ trunk/framework/pjMw/src/main/java/common/db/dao/hibernate/DaoSessionImpl.java (revision 2483)
@@ -53,6 +53,20 @@
5353 }
5454
5555 /**
56+ * 最終リリース
57+ */
58+ @Override
59+ public void shutdown() {
60+ for (final Config cfg : this.config.values()) {
61+ try {
62+ cfg.getSessionFactory().close();
63+ } catch (final HibernateException e) {
64+ ThrowableUtil.warn(e);
65+ }
66+ }
67+ }
68+
69+ /**
5670 * DAO作成
5771 *
5872 * @param cname 設定名
@@ -61,7 +75,7 @@
6175 @Override
6276 public Dao getDao(final String cname) {
6377 try {
64- BaseDao bd = null;
78+ Dao bd = null;
6579 final var cfg = getConfig(cname);
6680 final var prop = cfg.getConfiguration().getProperties();
6781 if (prop != null) {
@@ -91,9 +105,7 @@
91105 * @return 設定
92106 */
93107 private Config getConfig(final String cname) {
94- return this.config.computeIfAbsent(toConfigName(cname), key ->
95- new Config(new Configuration().configure(key))
96- );
108+ return this.config.computeIfAbsent(toConfigName(cname), key -> new Config(new Configuration().configure(key)));
97109 }
98110
99111 /**
--- trunk/framework/pjMw/src/main/java/common/db/dao/hibernate/JtaDao.java (revision 2482)
+++ trunk/framework/pjMw/src/main/java/common/db/dao/hibernate/JtaDao.java (revision 2483)
@@ -90,14 +90,11 @@
9090
9191 /**
9292 * セションクローズ
93- *
9493 */
9594 @Override
9695 public void close() {
9796 try (var session = new NoCloseSession(getSession())) {
98- if (0 < session.getStatistics().getEntityCount()) {
99- session.clear();
100- }
97+ session.clear();
10198 }
10299 }
103100