previous next trail start tutorial home feedback openwings.org

Failure Recovery

This section describes some techniques for creating high availability applications. Openwings provides the infrastructure to detect services coming and going; how a developer decides to respond to these events is critical to fault recovery. The key things developers have to consider are:

  1. How to select a service to connect to?
  2. How to handle a service disconnect?
  3. Is your service interaction stateful or stateless?

In a stateless interaction, one call on a service interface is not dependent on another call. In these cases changing the service provider between calls has no effect. In stateful interactions, one call provides state in either the service user or service provider that is needed for subsequent calls. A change of service between calls in a stateful interaction will cause a corruption of the state model.

To find a service, it is recommended that components use a UseServiceListener. This allows for any order of service initialization. It also allows for the discovery of additional services in case of a failure. If your application design is re-entrant or threaded you can pass the new service in or start a new thread. This technique will even work with stateful connections, because it allows you to start at an initial state again.

There are two ways that Openwings exposes service failures to applications. On making a service call, the user can get a RemoteException or a callback to the UseServiceListener.providedServiceRemoved() method. A developer has to decide whether to switch services inline, i.e. in the thread the exception occurred, or to let a new service discovery create a new thread of execution. The second approach is easier because the exception can be propagated.

The inline recovery technique is often needed for components that are interacting with many services at once. If the interactions are stateless, a wrapper can automatically switch services and hide the exception. If the connection is stateful, the application logic will need to be more complex. It may have to roll back state from many services at once.

Consider which approach is best for your application and stick with that.

Next: ServiceUI Development

back to top

Copyright 2002, General Dynamics Decision Systems. All rights reserved.

previous next trail start tutorial home feedback openwings.org