org.ektorp.impl.changes
Class ContinuousChangesFeed

java.lang.Object
  extended by org.ektorp.impl.changes.ContinuousChangesFeed
All Implemented Interfaces:
Runnable, ChangesFeed

public final class ContinuousChangesFeed
extends Object
implements ChangesFeed, Runnable

Author:
henrik lundgren

Constructor Summary
ContinuousChangesFeed(String dbName, HttpResponse httpResponse)
           
 
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()
           
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContinuousChangesFeed

public ContinuousChangesFeed(String dbName,
                             HttpResponse httpResponse)
Method Detail

next

public DocumentChange next()
                    throws InterruptedException
Description copied from interface: ChangesFeed
Retrieves and removes the head of this changes feed, waiting if necessary until an element becomes available.

Specified by:
next in interface ChangesFeed
Returns:
Throws:
InterruptedException - when this changes feed is closed or otherwise is interrupted

poll

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

Specified by:
poll in interface ChangesFeed
Returns:
Throws:
InterruptedException - when this changes feed is closed or otherwise is interrupted

next

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

Specified by:
next in interface ChangesFeed
Returns:
Throws:
InterruptedException - when this changes feed is closed or otherwise is interrupted

cancel

public void cancel()
Description copied from interface: ChangesFeed
Will close this feed and interrupt any threads waiting on next()

Specified by:
cancel in interface ChangesFeed

isAlive

public boolean isAlive()
Specified by:
isAlive in interface ChangesFeed
Returns:
true if this feed is active.

queueSize

public int queueSize()
Specified by:
queueSize in interface ChangesFeed
Returns:
the size of this feed's unhandled internal queue.

run

public void run()
Specified by:
run in interface Runnable


Copyright © 2011. All Rights Reserved.