com.cloudtran.coherence.hospital
Class Hospital

java.lang.Object
  extended by com.cloudtran.coherence.hospital.Hospital

public class Hospital
extends Object

The hospital is where sick transactions go. It is not intended for internal program errors or configuration errors: it requires a transaction context. The general idea is that there is a source, transaction data, a message (optional - may be in the exception). There may then be one or more actions causing errors - for example, putting multiple objects into the grid during replication can result in multiple errors. Each action/error instance contains an exception (probably), an operation, and some data. For example: source = transaction logger, operation = create file; data = the grid objects in the transaction; The hospital class is in Coherence because we use some coherence-specific classes. Usage: the static publish() is a one-shot. For a possibly-multiple error, do this:
Hospital h = new Hospital();//(outside any processing)
h.addError(...); // for each error
h.publish(); // at the end of processing, whether or not there were any errors
TBD: we need to know if we should pull down the grid, carry on, log or whatever. There may be an opportunity to add more framework for application developers.


Nested Class Summary
static class Hospital.HospitalData
           
static class Hospital.Source
           
 
Constructor Summary
Hospital()
           
 
Method Summary
 void addError(Hospital.Source source, CTxDefinition ctxDefinition, String message, Exception exception, Object action, Object dataObject)
           
 boolean needsToBePublished()
           
 void publish()
          If any errors have been added, this method will publish them to the listeners.
static void publish(Hospital.Source source, CTxDefinition ctxDefinition, String message, Exception exception, Object action, Object dataObject)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hospital

public Hospital()
Method Detail

addError

public void addError(Hospital.Source source,
                     CTxDefinition ctxDefinition,
                     String message,
                     Exception exception,
                     Object action,
                     Object dataObject)

needsToBePublished

public boolean needsToBePublished()

publish

public static void publish(Hospital.Source source,
                           CTxDefinition ctxDefinition,
                           String message,
                           Exception exception,
                           Object action,
                           Object dataObject)

publish

public void publish()
If any errors have been added, this method will publish them to the listeners. It will also reset the hospitalData, so the same Hospital instance can be use for multiple invocations