aspose file tools*
The moose likes Java in General and the fly likes how i call another java function from java program,and response without waiting return of function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how i call another java function from java program,and response without waiting return of function" Watch "how i call another java function from java program,and response without waiting return of function" New topic
Author

how i call another java function from java program,and response without waiting return of function

Vinod suryawanshi
Ranch Hand

Joined: Aug 08, 2012
Posts: 45
hi friends excuse me if i am posting a basic qustion, but please reply answer or hint...
i am working on flight booking system. So we request for specific flight ticket to our vendor. we send XML request to vendor. After that vendor do requested processing and save necessary changes in there database in vendor database. vendor not send any response to our side. here booking task completed. Now we need to know status of that booking requested that will change from pending to success on vendor database. We have to fetch that by making XML request for ticket status to vendor.
But problem here is, after flight booking i need to show my website visitor the status of booking request and status will change on vendor server within 2 to 30 minutes.
So is it possible that i can call one function from my java program and send response page to web site user and that function will keep running in background on my server 6 times with interval of 5 minutes. So when status change i can store that in my server database.
i did some home work on this, and i know that i can use thread and keep them sleep for 5 minutes with max 6 times until i got response. but can anybody suggest me how i create such process calling from my java program that will keep working in background on server.
Kathleen Angeles
Ranch Hand

Joined: Aug 06, 2012
Posts: 122

One good way is to have the vendor call you back when a processing is completed. You can have anything like a Rest service, xml web service, simple servlet, etc. waiting for your vendor to call to report a completed processing.
Vinod suryawanshi
Ranch Hand

Joined: Aug 08, 2012
Posts: 45
Thanks for your response Kathleen Angeles,
I know what your saying, but this vendor not sending us any report he just set changes in his own database, and we have to make status request again to take fetch that status.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3946
    
  17

Hi Vinod,

If you need to do this in a loop the best thing to do is figure out how to do it once. That is the tough part. Once you know how to do it once, write a loop. Take into consideration on how to stop, when to sleep, and when you could/should skip sleeping. Once you can do it in a loop in a manner that functions appropriately it is trivial to make it work in a Thread. But you might consider other options than using a thread for each customer. But don't jump ahead with those concerns until you can get your single request working and your loop of requests working.


Steve
Vinod suryawanshi
Ranch Hand

Joined: Aug 08, 2012
Posts: 45
Steve Luke thanks for your replay.
I done this, i use thread concept for this. i create new thread and call that function. So that thread will keep running on server until he get response from vendor server. and after getting response, its done necessary changes in our server database.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how i call another java function from java program,and response without waiting return of function
 
Similar Threads
Some details about Air India
Chapter 6(Session Management) notes (HFSJ) for revision
To keep request alive in a webservice
Help with progressing in my Assignment
Need a best messaging Solution