Currently I'm using JDBC templates to query the database for information. I'm constantly pinging the oracle DB to check if a table in particular has been updated, if it has, then I run a function, if not, then I wait a bit and ping it again.
ReportsDao rDao = new ReportsDao();
while(true)
{
List<ReportRequest> rr = rDao.selectAll();
for (ReportRequest r: rr)
{
if(!r.getDone())
{
//do stuff
}
}
try {
Thread.sleep(10000);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
{
So my question is, how can I avoid this constant pinging of the database for new information? Is it possible to have a listener sit around that triggers what I want it to do once the table is updated?