public class DatabaseStartupValidator extends Object implements InitializingBean
Useful to defer application initialization until a database has started up. Particularly appropriate for waiting on a slowly starting Oracle database.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INTERVAL
The default interval.
|
static int |
DEFAULT_TIMEOUT
The default timeout.
|
protected Log |
logger |
Constructor and Description |
---|
DatabaseStartupValidator() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Check whether the validation query can be executed on a Connection
from the specified DataSource, with the specified interval between
checks, until the specified timeout.
|
void |
setDataSource(DataSource dataSource)
Set the DataSource to validate.
|
void |
setInterval(int interval)
Set the interval between validation runs (in seconds).
|
void |
setTimeout(int timeout)
Set the timeout (in seconds) after which a fatal exception
will be thrown.
|
void |
setValidationQuery(String validationQuery)
Deprecated.
as of 5.3, in favor of the JDBC 4.0 connection validation
|
public static final int DEFAULT_INTERVAL
public static final int DEFAULT_TIMEOUT
protected final Log logger
public void setDataSource(DataSource dataSource)
@Deprecated public void setValidationQuery(String validationQuery)
public void setInterval(int interval)
public void setTimeout(int timeout)
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean