1

O/R マッピングに休止状態を使用する Java アプリケーションがあり、休止状態に同梱されている c3p0 接続プールも使用しています。DBはオラクルです。

これは私の中にありますhibernate.cfg.xml

<property name="hibernate.c3p0.min_size">3</property>
<property name="hibernate.c3p0.max_size">5</property>
<property name="hibernate.c3p0.max_statements">20</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.idleTestPeriod">120</property>        

これは、休止状態セッションを取得する方法です。

public class HibernateUtil {
    private static Logger log = Logger.getLogger(HibernateUtil.class);
    private static final SessionFactory sessionFactory;

    private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";
    static {
        try {
            // Create the SessionFactory from hibernate.cfg.xml
            sessionFactory = new Configuration().configure(CONFIG_FILE_LOCATION).buildSessionFactory();
        } catch (Throwable ex) {
            // Make sure you log the exception, as it might be swallowed
            log.fatal("Initial SessionFactory creation failed." + ex.getMessage());
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }
}

しかしSELECT * FROM V$SESSION WHERE machine='xxx';、Oracle で実行すると、接続数が 20 に達し、max_size.

最大接続数は Linux 環境では機能しませんが、Unix と Windows では機能します。微調整が必​​要な Linux の設定はありますか?

また、以前に 20 を設定したように、アプリケーションのキャッシュがどこかにあるのではないかと疑ってmax_sizeいます。Tomcat 5.5 でアプリケーションを実行しています。しかし、Tomcat にそのようなアプリケーション キャッシュがあることは知りません。

別の情報: Linux 2.6.9-34.ELsmp を実行しています。Red Hat Enterprise Linux AS release 4 (Nahant Update 3)

ありがとう。

4

1 に答える 1

0

アプリケーションからではなく、追加の DB セッションが開かれていると思います。たとえば、SELECTステートメントの実行に使用している追加の接続が必要です。

于 2011-01-11T05:24:35.417 に答える