Class AbstractURLBuffer
- java.lang.Object
-
- com.digitalpebble.stormcrawler.persistence.urlbuffer.AbstractURLBuffer
-
- All Implemented Interfaces:
URLBuffer
- Direct Known Subclasses:
SchedulingURLBuffer
,SimpleURLBuffer
public abstract class AbstractURLBuffer extends Object implements URLBuffer
Abstract class for URLBuffer interface, meant to simplify the code of the implementations and provide some default methods- Since:
- 1.15
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractURLBuffer.URLMetadata
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>
in_buffer
protected EmptyQueueListener
listener
protected URLPartitioner
partitioner
protected Map<String,Queue<AbstractURLBuffer.URLMetadata>>
queues
-
Fields inherited from interface com.digitalpebble.stormcrawler.persistence.urlbuffer.URLBuffer
bufferClassParamName
-
-
Constructor Summary
Constructors Constructor Description AbstractURLBuffer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(String URL, Metadata m)
Stores the URL and its Metadata using the hostname as key.boolean
add(String URL, Metadata m, String key)
Stores the URL and its Metadata under a given key.void
configure(Map<String,Object> stormConf)
boolean
hasNext()
Implementations of this method should be synchronisedint
numQueues()
Total number of queues in the buffer *void
setEmptyQueueListener(EmptyQueueListener l)
int
size()
Total number of URLs in the buffer *
-
-
-
Field Detail
-
listener
protected EmptyQueueListener listener
-
partitioner
protected final URLPartitioner partitioner
-
queues
protected final Map<String,Queue<AbstractURLBuffer.URLMetadata>> queues
-
-
Method Detail
-
numQueues
public int numQueues()
Total number of queues in the buffer *
-
add
public boolean add(String URL, Metadata m, String key)
Stores the URL and its Metadata under a given key.
-
add
public boolean add(String URL, Metadata m)
Stores the URL and its Metadata using the hostname as key.
-
size
public int size()
Total number of URLs in the buffer *
-
setEmptyQueueListener
public void setEmptyQueueListener(EmptyQueueListener l)
- Specified by:
setEmptyQueueListener
in interfaceURLBuffer
-
-