• 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

Handling critical object if it is down

 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In our J2EE web application we have so many critical functionality which is handled by various component. Say if one of the critical object or the respective critical system is down. How we can serve the request and still get the response from those systems? How this can be handled technically through code? I know we can go for service virtualization and create a system which will emulate the behavior of critical object or system. But for that we need to use the respective tools which is quite costly. How the same can be handled using java code , whether we can create a clone of that critical object and still serve the request eventhough the origibal critical object is down or can we create a proxy of that critical object? How we can handle it in java through code? Please clarify.


Thanks.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Handling failover is a very rich and broad subject, and probably any post on a message board on the subject won't do it justice. The most general solution to build a high availability service is to have complete redundancy. However, that may not be a good solution to every problem. If you have a specific scenario that you want to address, you are welcome to post , and you might get some good suggestions
 
Rithanya Laxmi
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jayesh, we have a payment system which should be up & running always, there are cases when the payment system is down we are unable to process the payments? hence to create a high available payment service what we need to do whether we need to cluster the partcular service and make sure there wont be a failover or how we can handle the same in the code? Is there any alternative? please let me know.

Thanks.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your question certainly seems to be asking "How can I write code which can retrieve information from a service which is not running?" Hopefully that is just careless reading on my part, because obviously that isn't one of the alternatives. Unless you had in mind returning a message saying "Sorry, that service is not available now, please try again later."
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to agree with Paul here. It does seem like you're asking how to get a cookie from the jar when there are no cookies in the jar. Impossible.

What you need to do in this situation is prevent a cascading failure. That is, if that payment system goes wrong or goes missing then your application is not taken down with it. You need to be able to handle that scenario and make your application respond accordingly. First and foremost you need to configure wait timeouts whenever you connect to an external system so that you don't get stuck waiting forever on a dead resource. Another technique you can apply here is to use a mechanism called a "Circuit Breaker". This will stop your application trying to access a dead resource after x number of failed attempts and then wait for some timeout before trying again. This prevents your application spending time and resources trying to connect to a resource that it already knows is probably dead. "Fail fast" is the buzzword for this one.

In summary, you cannot guarantee 100% uptime and correct behaviour of any external system. Your application needs to deal with this and respond accordingly.

I would highly recommend getting hold of a copy of Michael T Nygard's "Release It!" book which is a goldmine of techniques on dealing with software integration realities.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic