• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java program termination on AS400 using sockets

 
Simon Machin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a messaging application which runs on AS400. The init part of the app sits and waits once it has registered the MessageListener in order that the program doesn't terminate.
This is all fine, the problem is that because shutdownHooks do not function properly in iSeries (from IBM "It appears that the failure of the shutdownhook to execute is a permanent restriction on the iSeries")
when I want to end the program, I find I cannot do this gracefully and so risk losing messages which have been part processed.
What I think I need is some way of sending a signal to the program which will not kill the JVM, but will tell it to cease processing and end properly. I was thinking I might be able to do this using an RPG program and sockets but I've not used sockets and don't know where to start. Any ideas?
Cheers
Simon
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, trivially, something like this replacing your current "sits and waits" would work:

[ January 16, 2004: Message edited by: Ernest Friedman-Hill ]
 
Simon Machin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent, thats perfect. Have created a new class to be run when shutdown is required, which just sets up a connection on said port and sends one line. Receiver program (which has been blocking on accept() until connection received) then just carries on into a finally block with all the shutdown tasks. Quite elegant, adn it works
Many thanks!
S
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!