All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ontology2.bakemono.abstractions.NamedKeyValueAcceptor Maven / Gradle / Ivy

There is a newer version: 3.2
Show newest version
package com.ontology2.bakemono.abstractions;

import java.io.IOException;

import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Mapper.Context;
import org.apache.hadoop.mapreduce.lib.output.MultipleOutputs;

import com.ontology2.bakemono.mapred.RealMultipleOutputs;

public class NamedKeyValueAcceptor implements KeyValueAcceptor {

    private final String name;
    private final RealMultipleOutputs mos;

    public NamedKeyValueAcceptor(final RealMultipleOutputs mos, final String name) {
        this.name = name;
        this.mos=mos;
    }

    @Override
    public void write(K k, V v,Mapper.Context c) throws IOException, InterruptedException {
        mos.write(name,k,v);
    }

    //
    // the correct way to close the OutputStreams behind this object is to
    // close the mos object once in the Mapper when the framework is tearing
    // the mapper down (see PSE3Mapper.java)
    //

    @Override
    public void close(Mapper.Context c) throws IOException, InterruptedException {
    };
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy