things.common.tools
Class Tender<I,O>

java.lang.Object
  extended by things.common.tools.Tender<I,O>

public class Tender<I,O>
extends java.lang.Object

A tender transaction object. There can be only ONE accept thread, but as many tender threads. The tender threads will lock the tender in turn until they get their response.

Either side can declare the tender healthy or not. If the responder does so, it'll cause the tender to error. Once it is unhealthy, it'll accept no more tenders.

Version:
1.0

Version History

EPG - Rewrite from anther project - 2 FEB 07
 
Author:
Erich P. Gatejen

Constructor Summary
Tender()
           
 
Method Summary
 I accept()
          Accept a tendered transaction.
 void response(O output)
          Respond to a tendered transaction.
 O tender(I input)
          Tender a transaction.
 void unhealthy()
          Mark the tender as unhealthy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tender

public Tender()
Method Detail

tender

public O tender(I input)
         throws ThingsException
Tender a transaction.

Parameters:
input - The input object.
Returns:
the output object.
Throws:
ThingsException

accept

public I accept()
         throws ThingsException,
                java.lang.InterruptedException
Accept a tendered transaction.

Returns:
The input object.
Throws:
ThingsException
java.lang.InterruptedException

response

public void response(O output)
              throws ThingsException
Respond to a tendered transaction.

Parameters:
output - The response.
Throws:
ThingsException

unhealthy

public void unhealthy()
Mark the tender as unhealthy.



Things.