net.sf.asyncobjects.util
Class CompensatedClosable

java.lang.Object
  extended by net.sf.asyncobjects.util.Compensated
      extended by net.sf.asyncobjects.util.CompensatedClosable
All Implemented Interfaces:
ExplicitSharing

public abstract class CompensatedClosable
extends Compensated

An utility subclass that closes closable that has been received.

Author:
const

Constructor Summary
CompensatedClosable()
           
 
Method Summary
protected  void compensateValue(Object value)
          Compensate successful execution
protected abstract  ACloseable open()
          An open method that should be overriden by subclasses.
protected  Object run()
          Run primary action.
 
Methods inherited from class net.sf.asyncobjects.util.Compensated
cancel, committed, compensateFailure, equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompensatedClosable

public CompensatedClosable()
Method Detail

compensateValue

protected void compensateValue(Object value)
                        throws Throwable
Description copied from class: Compensated
Compensate successful execution

Specified by:
compensateValue in class Compensated
Parameters:
value - a value to compensate with
Throws:
Throwable - if there is problem with compensating. Note that fault is logged and ignored.
See Also:
Compensated.compensateValue(java.lang.Object)

run

protected final Object run()
                    throws Throwable
Description copied from class: Compensated
Run primary action. This method is called by containing class upon recieving instance of this class.

Specified by:
run in class Compensated
Returns:
a value that is either promise, asyncobject, or scalar value. It is not treated specially.
Throws:
Throwable - if there is a problem during execution
See Also:
Compensated.run()

open

protected abstract ACloseable open()
                            throws Throwable
An open method that should be overriden by subclasses.

Returns:
an proxy for closeable resource that will be eventually resolved
Throws:
Throwable - if there is a problem


Copyright © 2002-2007 Constantine Plotnikov. All Rights Reserved.