Hi,
in the meantime I developed this workaround with a thread.
Code:
final Thread t = new Thread() {
/*
* (non-Javadoc)
*
* @see java.lang.Thread#run()
*/
@Override
public void run() {
HibernateUtil.SESSION_FACTORY = aConfig.buildSessionFactory();
}
};
t.start();
/* Timeout */
Thread.sleep(10000);
if (HibernateUtil.SESSION_FACTORY == null) {
DB_CONNECTION_NOT_PRESENT = true;
MainFrame.INSTANCE.applyGuiState(GuiStates.NO_DATABSE_PRESENT);
throw new JDBCConnectionException(
"Timeout of 10 seconds reached! Databse may not available!", null);
}
The main problem wasn't really the long timeout of the underlying structure, but he fact that I couldn't catch these Exceptions and retried to retrieve the db connection, which caused a kind of deadlock.
So even the timeout would be shorter, I can't recognize that the connection was failed and so I can't stop the retrying.
Any other suggestions are still welcome.
Greetings Michael