net.sf.lucis.core.impl
Class MayFail<T>

java.lang.Object
  extended by net.sf.lucis.core.impl.MayFail<T>
Type Parameters:
T - Result type.

public abstract class MayFail<T>
extends Object

A writer is the object that applies the operations into a store.

Author:
Andres Rodriguez.

Method Summary
 IndexException getException()
           
 T getResult()
           
abstract  IndexStatus getStatus()
           
static
<V> MayFail<V>
of(Callable<V> callabe)
          Runs a possibly failed result from the execution of a callable.
static
<V> V
run(Callable<V> callabe)
          Runs a callable translating the exceptions, except InterruptedException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getStatus

public abstract IndexStatus getStatus()

getResult

public T getResult()

getException

public IndexException getException()

run

public static <V> V run(Callable<V> callabe)
             throws InterruptedException
Runs a callable translating the exceptions, except InterruptedException.

Type Parameters:
V - Result type.
Parameters:
callabe - Callable to run.
Returns:
The callable result.
Throws:
IndexException - If an error occurs.
InterruptedException - if the current task has been interrupted.

of

public static <V> MayFail<V> of(Callable<V> callabe)
                     throws InterruptedException
Runs a possibly failed result from the execution of a callable.

Type Parameters:
V - Result type.
Parameters:
callabe - Callable to run.
Returns:
The possible failed callable result.
Throws:
InterruptedException - if the current task has been interrupted.


Copyright © 2013. All Rights Reserved.