Class AbstractResultListener
- java.lang.Object
-
- org.apache.iotdb.db.wal.utils.listener.AbstractResultListener
-
- Direct Known Subclasses:
WALFlushListener,WALRecoverListener
public abstract class AbstractResultListener extends java.lang.ObjectThis abstract class aims to listen to the result of some operation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractResultListener.Status
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Exceptioncauseprotected AbstractResultListener.Statusstatusprotected booleanwaittrue means waiting until getting the result
-
Constructor Summary
Constructors Constructor Description AbstractResultListener(boolean wait)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractResultListenerfail(java.lang.Exception e)Set status to failure and notify all threads waiting for the result.java.lang.ExceptiongetCause()Get the cause exception to failure.AbstractResultListenersucceed()Set status to success and notify all threads waiting for the result.AbstractResultListener.StatuswaitForResult()Wait until getting the result.
-
-
-
Field Detail
-
wait
protected final boolean wait
true means waiting until getting the result
-
status
protected volatile AbstractResultListener.Status status
-
cause
protected volatile java.lang.Exception cause
-
-
Method Detail
-
succeed
public AbstractResultListener succeed()
Set status to success and notify all threads waiting for the result.
-
fail
public AbstractResultListener fail(java.lang.Exception e)
Set status to failure and notify all threads waiting for the result.
-
waitForResult
public AbstractResultListener.Status waitForResult()
Wait until getting the result.
Notice: wait only when wait status is ture.
-
getCause
public java.lang.Exception getCause()
Get the cause exception to failure.
-
-