scalax.io

CloseAction

trait CloseAction [-A] extends AnyRef

A strategy object representing an action to take upon closing a Resource. CloseActions can be composed using the +: and :+ method and can be added to a Resource when it is created or added to an existing Resource object.

If an exception is raised by the CloseAction it will be cause by the apply method and will be returned to the Resource calling the exception. Normally the exception will be added to the collection of Throwables in the Resource so errors triggered by the CloseActions will be obtainable from the Resource.

Also related to exceptions is the fact that all CloseActions will be executed when they are combined. For example if CloseAction A and B are combined and A fails with an exception B will still be executed.

The easiest method for creating a close action is to simply call the CloseAction.apply factory method. It takes a function and contructs a CloseAction from it.

val loggingCloseAction = CloseAction[Any]{_ =>
   println("InputStream "+r+" is closing")
}
A

The type of object this action

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. CloseAction
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Abstract Value Members

  1. def closeImpl (resource: A): Unit

    The actual implementation of the action.

    The actual implementation of the action. Implementers of a CloseAction must implement this method.

    resource

    the resource that will be closed.

    Attributes
    protected abstract

Concrete Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def +: [B <: A] (other: CloseAction[B]): CloseAction[B]

    Construct a new CloseAction consisting of other then this.

    Construct a new CloseAction consisting of other then this.

    other

    an action to prepend to this action

    returns

    an action consisting of first executing other then this

  5. def :+ [B <: A] (other: CloseAction[B]): CloseAction[B]

    Construct a new CloseAction consisting of this then other.

    Construct a new CloseAction consisting of this then other.

    other

    an action to append to this action

    returns

    an action consisting of first executing this then other

  6. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  7. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  8. def apply (resource: A): List[Throwable]

    Execute the action and return any Exceptions that may have been raised during the execution of this method.

    Execute the action and return any Exceptions that may have been raised during the execution of this method.

    resource

    the resource being closed

    returns

    the errors that occurred while executing the message.

  9. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  10. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  12. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  14. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  15. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  16. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  17. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  18. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  19. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  20. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  21. def toString (): String

    Definition Classes
    AnyRef → Any
  22. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  23. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  24. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any