O
- type of values accepted by this output
R
- type returned by
finish(java.util.Collection<? extends com.google.appengine.tools.mapreduce.OutputWriter<O>>)
public abstract class Output<O,R>
extends java.lang.Object
implements java.io.Serializable
OutputWriter
s and may
produce a result to be returned in
MapReduceResult
(see
finish(java.util.Collection<? extends com.google.appengine.tools.mapreduce.OutputWriter<O>>)
).
This class is really an interface that might be evolving. In order to avoid breaking users when we change the interface, we made it an abstract class.
Constructor and Description |
---|
Output
()
|
Modifier and Type | Method and Description |
---|---|
abstract java.util.List<? extends
OutputWriter
<
O
>>
|
createWriters
(int numShards)
Returns a list of writers, one for each shard, for this output.
|
abstract
R
|
finish
(java.util.Collection<? extends
OutputWriter
<
O
>> writers)
Returns a result to be made available through
MapReduceResult.getOutputResult()
.
|
Context
|
getContext
()
|
public Context getContext()
public abstract java.util.List<? extends OutputWriter<O>> createWriters(int numShards)
numShards
- The number of shards which should be equal to the number of
OutputWriter
s returned.
public abstract R finish(java.util.Collection<? extends OutputWriter<O>> writers) throws java.io.IOException
MapReduceResult.getOutputResult()
.
This method allows the
Output
to inspect the final state of its
OutputWriter
s
to produce a final result object. For example, if the
OutputWriter
s produce blobs in
blobstore,
finish
could collect and return a list of blob IDs.
Should return null if no such result makes sense for this kind of output.
Called after all
OutputWriter
s have been closed (with
OutputWriter.close()
). It
is possible for this method to be called more than once with the same
writers
collection. It is also possible for the job to fail after this is invoked.
The
writers
argument will contain the same writers that
createWriters(int)
returned
in the same order. Writers may be serialized and deserialized multiple times. typically,
getWriter
will have been called in a different JVM.
java.io.IOException
Copyright © 2011 Google Inc. All Rights Reserved.