• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Server side code execution progress on another server  RSS feed

 
mohammad shadab
Ranch Hand
Posts: 62
Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am having two servers A and B(both are on different domain), Server A sends a HTTP request using HttpURLConnection to B to initiate a process which might longer for 30 minutes,server B accepts this request and assign this task to a thread and sends back response to server A stating that process has been started.

Since Task started on server B will be completing in almost 30 minutes ,now server A wants to know the progress(it means wants to know how much work has been completed on server B).Right now i am sending new request from server A to B to know the status of executing task after every 45 seconds.
But i feel this is overload of requests,How can i reduce number of request without timeout problem?What will be the best way to know status of server B on server A?

Your quick response will be appreciated.

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66304
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohammad shadab wrote:But i feel this is overload of requests


Why?
 
mohammad shadab
Ranch Hand
Posts: 62
Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to show progress in browser, on server A i send an Ajax request to a servlet and this servlet then makes HTTP request to server B to get the status of execution,some times ajax requests were getting stopped with an error 'TOO MANY RECURSIVE CALLS '

Later i have maintained the time gap between requests(whenever request comes to server B it gives reply after 45 seconds by making thread sleep) and 'TOO MANU RECURSIVE CALLS ' error been resolved and things going fine .

But still i look for any other good way if possible or efficient way to achieve this.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohammad shadab wrote:But still i look for any other good way if possible or efficient way to achieve this.

Do you need to "show" progress?

Presumably, the task sends some sort of message when it's complete, so couldn't your "progress" simply be changed to a "request for progress"?
Then it could be driven by the person who wants to see the result (maybe including an estimated time remaining), rather than an automated polling function.

Also: the message "too many recursive calls" suggests to me that somehow each poll is being generated from the previous one; but I have no idea why, or whether this is an Ajax thing.

Winston
 
mohammad shadab
Ranch Hand
Posts: 62
Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i need to show progress.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohammad shadab wrote:Yes i need to show progress.

OK, then I'd look at that "recursive" bit, because it suggests that notifications are spawning further notifications, rather than being controlled by an external loop.

Winston
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!