java - After server spawning a new thread respond to the client -



java - After server spawning a new thread respond to the client -

i developing web application multithreading. concept clients send requests server. server creates new thread execute procedure (delete foder town name). client request , server response using restful web services.

here code server:

@get @path("/data_availability/{town} public response data_availability( @pathparam("town") string town) throws exception{ delete_dir procedure = new delete_dir(); thread thread = new thread(procedure); thread.start(); homecoming response.ok("done").build(); // here response. since create // new thread "done" }

and here code procedure:

public class delete_dir implements runnable{ string town; public void run() { seek { execute(); } grab (exception e) { e.printstacktrace(); } } public delete_dir( string town_ ){ town = town_; } public void execute(){ try{ file file = new file("c://" + town); fileutils.deletedirectory(file); }catch (exception e){ e.printstacktrace(system.out); } } }

how can respond client through class delete_dir ?? since create new thread if place response placed above "done".

java multithreading rest

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -