it.geosolutions.tools.commons.file
Class Producer

java.lang.Object
  extended by it.geosolutions.tools.commons.file.Producer

public abstract class Producer
extends Object

A class implementing a producer which write on a PipeWriter. Using this class you can easily implement a producer consumer application.

Author:
Carlo Cancellieri - carlo.cancellieri@geo-solutions.it

Constructor Summary
Producer(ExecutorService e)
           
 
Method Summary
 void close(boolean force)
           
 PipedReader produce()
           
protected abstract  void producer(PipedWriter pw)
          Implementing this method you have to write on the pipedWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Producer

public Producer(ExecutorService e)
Method Detail

producer

protected abstract void producer(PipedWriter pw)
                          throws Exception
Implementing this method you have to write on the pipedWriter

Parameters:
pw - the pipeWriter to use to write on
Throws:
Exception - if needed you can throw an Exception which is not handled by the produce() method.

produce

public final PipedReader produce()
                          throws IOException
Parameters:
e - the executor service to use (if it is null a SingleThreadExecutor will be used)
the - producer object which implements the producer method (which effectively write on the pipedWriter)
Returns:
a PipedReader which should be used to consume the output of this filter
Throws:
IOException

close

public void close(boolean force)


Copyright © 2011-2012 GeoSolutions. All Rights Reserved.