@@ -76,15 +76,15 @@ public void setValidationQuery(String validationQuery) {
76
76
77
77
/**
78
78
* Set the interval between validation runs (in seconds).
79
- * Default is 1 .
79
+ * Default is {@value #DEFAULT_INTERVAL} .
80
80
*/
81
81
public void setInterval (int interval ) {
82
82
this .interval = interval ;
83
83
}
84
84
85
85
/**
86
86
* Set the timeout (in seconds) after which a fatal exception
87
- * will be thrown. Default is 60 .
87
+ * will be thrown. Default is {@value #DEFAULT_TIMEOUT} .
88
88
*/
89
89
public void setTimeout (int timeout ) {
90
90
this .timeout = timeout ;
@@ -127,11 +127,15 @@ public void afterPropertiesSet() {
127
127
}
128
128
catch (SQLException ex ) {
129
129
latestEx = ex ;
130
- logger .debug ("Validation query [" + this .validationQuery + "] threw exception" , ex );
131
- float rest = ((float ) (deadLine - System .currentTimeMillis ())) / 1000 ;
132
- if (rest > this .interval ) {
133
- logger .warn ("Database has not started up yet - retrying in " + this .interval +
134
- " seconds (timeout in " + rest + " seconds)" );
130
+ if (logger .isDebugEnabled ()) {
131
+ logger .debug ("Validation query [" + this .validationQuery + "] threw exception" , ex );
132
+ }
133
+ if (logger .isWarnEnabled ()) {
134
+ float rest = ((float ) (deadLine - System .currentTimeMillis ())) / 1000 ;
135
+ if (rest > this .interval ) {
136
+ logger .warn ("Database has not started up yet - retrying in " + this .interval +
137
+ " seconds (timeout in " + rest + " seconds)" );
138
+ }
135
139
}
136
140
}
137
141
finally {
@@ -149,8 +153,8 @@ public void afterPropertiesSet() {
149
153
"Database has not started up within " + this .timeout + " seconds" , latestEx );
150
154
}
151
155
152
- float duration = (System .currentTimeMillis () - beginTime )*1f / 1000 ;
153
156
if (logger .isInfoEnabled ()) {
157
+ float duration = ((float ) (System .currentTimeMillis () - beginTime )) / 1000 ;
154
158
logger .info ("Database startup detected after " + duration + " seconds" );
155
159
}
156
160
}
0 commit comments