com.bigdata.service.jini.master
Class AbstractResourceScanner<V>

java.lang.Object
  extended by com.bigdata.service.jini.master.AbstractResourceScanner<V>
All Implemented Interfaces:
Callable<Long>
Direct Known Subclasses:
FileSystemScanner

public abstract class AbstractResourceScanner<V>
extends Object
implements Callable<Long>

Abstract base class for the scanner for a mapped master job. The Callable should return the #of resources which were accepted for processing.

Version:
$Id$
Author:
Bryan Thompson

Field Summary
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
protected AbstractResourceScanner(BlockingBuffer<V[]> buffer)
           
 
Method Summary
 void accept(V resource)
          Accept a resource for processing.
 Long call()
          Invokes runScanner(), queuing and transferring chunks of resources to the BlockingBuffer specified to the ctor.
 long getAcceptCount()
          Return the #of accepted resources.
protected abstract  void runScanner()
          Run the scanner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
Constructor Detail

AbstractResourceScanner

protected AbstractResourceScanner(BlockingBuffer<V[]> buffer)
Parameters:
buffer - The buffer to which the resources should be added.
Method Detail

getAcceptCount

public final long getAcceptCount()
Return the #of accepted resources.


call

public final Long call()
                throws Exception
Invokes runScanner(), queuing and transferring chunks of resources to the BlockingBuffer specified to the ctor. When runScanner() completes normally, the remaining resources are transferred from the internal queue to the BlockingBuffer.

Specified by:
call in interface Callable<Long>
Returns:
The #of resources accepted by the scanner.
Throws:
Exception

runScanner

protected abstract void runScanner()
                            throws Exception
Run the scanner.

Throws:
Exception

accept

public void accept(V resource)
            throws InterruptedException
Accept a resource for processing.

Parameters:
resource - The resource.
Throws:
InterruptedException


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.