I have been testing how hibernate behavies during a LAN failure. My test is simply pull the LAN cable from the database machine and try to do a transaction. However I have not been successful in getting Hibernate to bail out and throw an exception in a timely manner. My requirement is for it to wait a maximum of 2 minutes but all of my configuration changes seem to make no difference. It doesn't seem to do anything at all until the DB is reconnected to the network. I have waited upwards of 10 minutes for any sign and it just sits there. I have attached my current config files and the stack trace of the thread that is waiting on the DB. Is there something that i am missing?
Any help would be greatly appreciated,
Kirk
Hibernate version:
3.2.0
Mapping documents:
contents of the hibernate.cfg.xml file
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">30</property>
<property name="hibernate.c3p0.timeout">60</property>
<property name="hibernate.c3p0.max_size">5</property>
<property name="hibernate.c3p0.max_statements">10</property>
<property name="hibernate.c3p0.min_size">3</property>
<property name="hibernate.c3p0.validate">false</property>
additionally iI have set the following parameters in the c3p0.properties file
c3p0.acquireRetryAttempts=1
c3p0.acquireRetryDelay=1000
c3p0.breakAfterAcquireFailure=false
Code between sessionFactory.openSession() and session.close():
Code:
public CSUser getUser(String aLoginId) throws DataAccessException {
Session session = OpenHibernateSession();
try {
CSUser csUser = (CSUser) session.createQuery(
"from CSUser csuser where csuser.loginID = :arg0")
.setString("arg0", aLoginId)
.uniqueResult();
return csUser;
} catch (HibernateException e) {
sLog.error(method + e.getMessage());
throw new DataAccessException(e.toString());
} finally {
CloseHibernateSession();
}
}
Full stack trace of any exception that occurs:
Thread [Thread-2] (Suspended)
SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]
SocketInputStream.read(byte[], int, int) line: not available
DataPacket(Packet).receive() line: not available
DataPacket.receive() line: not available
NetInputStream.getNextPacket() line: not available
NetInputStream.read(byte[], int, int) line: not available
NetInputStream.read(byte[]) line: not available
NetInputStream.read() line: not available
T4CMAREngine.unmarshalUB1() line: 971
T4CMAREngine.unmarshalSB1() line: 941
T4C8Oall.receive() line: 432
T4CPreparedStatement.doOall8(boolean, boolean, boolean, boolean) line: 181
T4CPreparedStatement.execute_for_describe() line: 420
T4CPreparedStatement(OracleStatement).execute_maybe_describe() line: 896
T4CPreparedStatement.execute_maybe_describe() line: 452
T4CPreparedStatement(OracleStatement).doExecuteWithTimeout() line: 986
T4CPreparedStatement(OraclePreparedStatement).executeInternal() line: 2888
T4CPreparedStatement(OraclePreparedStatement).executeQuery() line: 2929
NewProxyPreparedStatement.executeQuery() line: 76
BatchingBatcher(AbstractBatcher).getResultSet(PreparedStatement) line: 186
QueryLoader(Loader).getResultSet(PreparedStatement, boolean, boolean, RowSelection, SessionImplementor) line: 1668
QueryLoader(Loader).doQuery(SessionImplementor, QueryParameters, boolean) line: 662
QueryLoader(Loader).doQueryAndInitializeNonLazyCollections(SessionImplementor, QueryParameters, boolean) line: 224
QueryLoader(Loader).doList(SessionImplementor, QueryParameters) line: 2144
QueryLoader(Loader).listIgnoreQueryCache(SessionImplementor, QueryParameters) line: 2028
QueryLoader(Loader).list(SessionImplementor, QueryParameters, Set, Type[]) line: 2023
QueryLoader.list(SessionImplementor, QueryParameters) line: 393
QueryTranslatorImpl.list(SessionImplementor, QueryParameters) line: 338
HQLQueryPlan.performList(QueryParameters, SessionImplementor) line: 172
SessionImpl.list(String, QueryParameters) line: 1121
QueryImpl.list() line: 79
QueryImpl(AbstractQueryImpl).uniqueResult() line: 780
HibernateTest.getUser(String) line: 141
HibernateTest.run() line: 74
Name and version of the database you are using:
oracle 10g
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html