O/R 매핑을 위해 최대 절전 모드를 사용하는 Java 응용 프로그램이 있고 최대 절전 모드와 함께 제공되는 c3p0 연결 풀링도 사용합니다. DB는 Oracle입니다.c3p0의 최대 연결 수는 Linux에서 작동하지 않습니다.
이에 내 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';
을 실행할 때 연결 수 인 20에 도달 할 수 있습니다 max_size
보다 큽니다.
Linux 환경에서는 최대 연결이 작동하지 않지만 Unix 및 Windows에서는 최대 연결이 작동하지 않습니다. Linux의 모든 설정을 조정해야합니까?
이전에 내가 max_size
을 20으로 설정했기 때문에 어딘가에 응용 프로그램의 캐시가있는 것으로 의심됩니다. Tomcat 5.5에서 응용 프로그램을 실행 중입니다. 하지만 Tomcat에서 이러한 응용 프로그램 캐시를 알지 못합니다.
다른 정보 : Linux 2.6.9-34.ELsmp를 실행하고 있습니다. Red Hat Enterprise Linux AS release 4 (Nahant Update 3)
감사합니다.
프로토콜 불일치입니다. 바이너리로드 리프터 용 프로토콜로 변환하면 C3P0은 연결이 끊어지지 않고 완벽하게 상호 운용됩니다. – Kylar
Kylar, 친절하게 더 설명해 주시겠습니까? 감사. –