Just my two cents, but, if your ressources can be intantiated at
configuration time, you can use the "configure" method from
MapperReduceBase Object to assign your local static objects with the
values taken from the job configuration object


public class Normalize_Reduce extends MapReduceBase implements
Reducer<..., ..., ..., ...>
{
private ... ;

// Methode to get back some knowledge about your Job conf
public void configure(JobConf job)
{
}

//
public void reduce(... p_key, Iterator<...> p_values,
OutputCollector<..., ...> output, Reporter reporter)
throws IOException
{
}

}

I might have not understood your needs, but hope it helps



Lowell Kirsh a écrit :
I have a Mapper class which needs access to several dependencies (such
as a db). It seems that because the framework is new'ing up instances of
my Mapper class, I have little control over its lifecycle. Up to now,
I've been setting them up as static fields in that class, which is not
ideal. Is there a better way to inject my dependencies?

Thanks,
Lowell

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 4 | next ›
Discussion Overview
groupmapreduce-user @
categorieshadoop
postedSep 4, '09 at 8:26p
activeSep 15, '09 at 3:39p
posts4
users4
websitehadoop.apache.org...
irc#hadoop

People

Translate

site design / logo © 2022 Grokbase