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 |
static int |
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)
Set the SQL query string to use for validation.
|
public static final int DEFAULT_INTERVAL
public static final int DEFAULT_TIMEOUT
protected final Log logger
public void setDataSource(DataSource dataSource)
public void setValidationQuery(String validationQuery)
public void setInterval(int interval)
public void setTimeout(int timeout)
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean