public interface Observer
Column
and be notified of changes to the Column via the
process(TransactionBase, Bytes, Column)
method. An observer is created for each worker
thread and reused for the lifetime of a worker thread. Consider extending
AbstractObserver
as it will let you optionally implement init(Context)
and
close()
. The abstract class will also shield you from the addition of interface methods.Modifier and Type | Interface and Description |
---|---|
static interface |
Observer.Context |
static class |
Observer.NotificationType |
static class |
Observer.ObservedColumn
A
Column and Observer.NotificationType pair |
Modifier and Type | Method and Description |
---|---|
void |
close()
Implemented by user to close resources used by Observer
|
Observer.ObservedColumn |
getObservedColumn()
Implemented by user to return an
Observer.ObservedColumn that will trigger this observer. |
void |
init(Observer.Context context)
Implemented by user to initialize Observer.
|
void |
process(TransactionBase tx,
Bytes row,
Column col)
Implemented by users to process notifications on a
Observer.ObservedColumn . |
void init(Observer.Context context) throws Exception
context
- Observer contextException
void process(TransactionBase tx, Bytes row, Column col) throws Exception
Observer.ObservedColumn
. If a notification
occurs, this method passes the user a TransactionBase
as well as the row and
Column
where the notification occurred. The user can use the TransactionBase
to
read and write to Fluo. After this method returns, TransactionBase
will be committed
and closed by Fluo.Exception
Observer.ObservedColumn getObservedColumn()
Observer.ObservedColumn
that will trigger this observer. During
initialization, this information is stored in zookeeper so that workers have a consistent view.
If a worker loads an Observer and the information returned differs from what is in zookeeper
then an exception will be thrown. It is safe to assume that init(Context)
will be
called before this method. If the return value of the method is derived from what is passed to
init(Context)
, then the derivation process should be deterministic.void close()
Copyright © 2016 The Apache Software Foundation. All rights reserved.