• 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 to monitor a email resource

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to monitor an email resource defined in web.xml to know if connection has or can be established with the smtp server? My email server come on and off so I need to configure multiple email resource poitning to different smtp server but I do not want to wait for connection timeout in my application before fail over to another (This just takes too long). I want to be able to monitor the connection and choose an active one without waiting.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But the only way to find out whether a mail server (or any kind of server for that matter) is active is to try to connect to it. And that unavoidably requires waiting a decent amount of time before you conclude it isn't active. So there isn't any way to avoid waiting for a timeout.

You may imagine some scheme where you have some agent which is continuously testing to see if a server is active. But that doesn't solve your problem either, since knowing that the server was active two seconds ago tells you nothing about whether it's active right now. And you may find yourself trying to connect with the agent while it's in the process of waiting for a timeout to expire -- what are you going to do then?

So if your actual problem is that having to wait for timeouts is affecting your application's response time in a bad way, then I suggest you redesign your application so that it doesn't connect to the mail server itself. Have it send a message to some other process which is responsible for dealing with your unreliable servers and sending the mail when one is available.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic