org.ektorp.changes
Interface ChangesFeed

All Known Implementing Classes:
ContinuousChangesFeed

public interface ChangesFeed

ChangesFeed listens to the _changes feed in a CouchDB database. Feeds are created by calling the method changesFeed(ChangesCommand cmd) in CouchDbConnector. An active feed buffers incoming changes in a unbounded queue that will grow until OutOfMemoryException if not polled.

Author:
henrik lundgren

Method Summary
 void cancel()
          Will close this feed and interrupt any threads waiting on next()
 boolean isAlive()
           
 DocumentChange next()
          Retrieves and removes the head of this changes feed, waiting if necessary until an element becomes available.
 DocumentChange next(long timeout, TimeUnit unit)
          Retrieves and removes the head of this changes feed, waiting up to the specified wait time if necessary for an element to become available.
 DocumentChange poll()
          Retrieves and removes the head of this changes feed, do not wait until an element becomes available. returns null if empty
 int queueSize()
           
 

Method Detail

next

DocumentChange next()
                    throws InterruptedException
Retrieves and removes the head of this changes feed, waiting if necessary until an element becomes available.

Returns:
Throws:
InterruptedException - when this changes feed is closed or otherwise is interrupted

poll

DocumentChange poll()
                    throws InterruptedException
Retrieves and removes the head of this changes feed, do not wait until an element becomes available. returns null if empty

Returns:
Throws:
InterruptedException - when this changes feed is closed or otherwise is interrupted

next

DocumentChange next(long timeout,
                    TimeUnit unit)
                    throws InterruptedException
Retrieves and removes the head of this changes feed, waiting up to the specified wait time if necessary for an element to become available.

Parameters:
timeout -
unit -
Returns:
Throws:
InterruptedException - when this changes feed is closed or otherwise is interrupted

cancel

void cancel()
Will close this feed and interrupt any threads waiting on next()


isAlive

boolean isAlive()
Returns:
true if this feed is active.

queueSize

int queueSize()
Returns:
the size of this feed's unhandled internal queue.


Copyright © 2011. All Rights Reserved.