• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 123
Firefox Browser Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Vinod suryawanshi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic