qbit
qbit copied to clipboard
@PostCreate
@QueueCallback(QueueCallbackType.INIT)
fun connectionInit() {
checkConnectionBreaker()
}
@QueueCallback(QueueCallbackType.SHUTDOWN)
fun shutdown() {
try {
connectionBreaker.ifOk {
it.close()
}.cleanup { it.close() }
} catch (ex : Exception) {
logger.warn("unable to close connection", ex)
}
}
The above should also work like this
@PostCreate
fun connectionInit() {
checkConnectionBreaker()
}
@PreDestroy
fun shutdown() {
try {
connectionBreaker.ifOk {
it.close()
}.cleanup { it.close() }
} catch (ex : Exception) {
logger.warn("unable to close connection", ex)
}
}
http://docs.oracle.com/javaee/5/api/javax/annotation/PostConstruct.html