@@ -84,7 +84,7 @@ public QueryService(Database database, javaxt.io.Directory jobDir, javaxt.io.Dir
8484 //Spawn threads used to execute queries
8585 int numThreads = 1 ; //TODO: Make configurable...
8686 for (int i =0 ; i <numThreads ; i ++){
87- new Thread (new QueryProcessor (database )).start ();
87+ new Thread (new QueryProcessor (database , this )).start ();
8888 }
8989 }
9090
@@ -126,6 +126,12 @@ else if (path.equals("tables")){
126126 }
127127
128128
129+ //**************************************************************************
130+ //** notify
131+ //**************************************************************************
132+ public void notify (QueryJob job ){}
133+
134+
129135 //**************************************************************************
130136 //** query
131137 //**************************************************************************
@@ -573,6 +579,7 @@ private ServiceResponse cancel(ServiceRequest request, Database database) {
573579 //Update job status
574580 job .status = "canceled" ;
575581 job .updated = new javaxt .utils .Date ();
582+ notify (job );
576583
577584
578585 //Cancel the query in the database
@@ -742,6 +749,18 @@ public QueryJob(long userID, Select select, Long offset, Long limit, JSONObject
742749 }
743750 }
744751
752+ public String getID (){
753+ return id ;
754+ }
755+
756+ public long getUserID (){
757+ return userID ;
758+ }
759+
760+ public String getStatus (){
761+ return status ;
762+ }
763+
745764 public void addTempTable (CreateTable stmt ){
746765 tempTable = stmt ;
747766 }
@@ -865,9 +884,11 @@ public JSONObject toJson() {
865884 */
866885 private class QueryProcessor implements Runnable {
867886 private Database database ;
887+ private QueryService queryService ;
868888
869- public QueryProcessor (Database database ){
889+ public QueryProcessor (Database database , QueryService queryService ){
870890 this .database = database ;
891+ this .queryService = queryService ;
871892 }
872893
873894 public void run () {
@@ -906,6 +927,7 @@ public void run() {
906927 job .status = "running" ;
907928 job .updated = new javaxt .utils .Date ();
908929 long startTime = System .currentTimeMillis ();
930+ queryService .notify (job );
909931
910932
911933 //Open database connection
@@ -977,6 +999,7 @@ public void run() {
977999 //Update job status
9781000 job .status = "complete" ;
9791001 job .updated = new javaxt .utils .Date ();
1002+ queryService .notify (job );
9801003 }
9811004 catch (Exception e ){
9821005 if (conn !=null ) conn .close ();
@@ -987,6 +1010,7 @@ public void run() {
9871010 else {
9881011 job .status = "failed" ;
9891012 job .updated = new javaxt .utils .Date ();
1013+ queryService .notify (job );
9901014
9911015
9921016 java .io .PrintStream ps = null ;
0 commit comments