My java service has the while loop (service will not end - unless the shutdown service is called).
The concern part is, for whatever reason if the Integration server is automatically restarted, my IS server is not coming up since i have added that java service is start up and the service is not completely executed (because of the while loop). (Stuck in the package)
Yes IS will stuck/hang/crashes some times the if the service is going thru infinite loop (may not recover)
So in your programming logic don’t you have logic for exit-Loop condition as it sounds to be it’s going to infinite loop and try to debug it with lesser volume of data or check the JS syntax to see where it went wrong with the for loop code block.
Just thought of adding some more info about my requirement. My POC service will wait for the connections, as soon as the client connects to my service, i will be acknowledging it. (Which is way i cant end my loop). Rather than changing my code, would like to understand, is there anyway to add as a startup.!
Assuming you truly need this loop - like Holger, I’m also interested in learning more details because perhaps you don’t really need this loop - but again, assuming for now you truly need this loop, then your startup service should spawn a new thread and you should execute the loop inside that thread. This way your startup service can complete and your loop can continue to run.
I developed a code in webMethods 9.6 (Java service) - Socket programming.
To accept / listen to the connections i need a while loop in it. Because of this while loop - i’m not able add this as a startup service.
Reason is, if server got restarted - the IS will get stuck in between, that’s the worry part for me at the moment.
Thanks Holger, my shut down service will be different java service, where i will close the port. the ports are getting closed in shutdown service. I’m worrying in case of any restart happened, it will get stuck in between.
I’ll try to explore the Quiesce Mode from IS Administrator guide.
Again, you need to spawn a new thread and place your loop inside that thread. Your problem is because you have the while(true) loop inside the startup service, your startup service never completes and the IS thinks it’s still starting. You can easily test this theory by replacing the while(true) loop with a call to Thread.sleep. Suppose you sleep for 1 minute, you should see in your logs that the IS is now taking 1 minute longer to start than before.
By the way, at some point, back in the webMethods Advantage days, there was a sample socket adapter package. You may want to search the “samples” section for that package to see if it still exists. If I recall correctly, it was called WmSocket or something like that.
Thanks Percio, i’ll try to implement the thread and lets see how it behaves.Also i tried to see the samples for the socket adapter package, unfortuantely i couldn’t find it, hence i proceeded with the new java service. thanks again for the inputs.
One thing about startup service is, do not think the package will work only after startup service executed.
During the execution of startup service, the services in the package could be invoked by others, even it could cause problems.
So just consider startup service will be automatically invoked after package loaded, no any other guaranty.