How to call getServletContext() equivalent in AppEngineMapper derived class?
I have a Mapper class which extends AppEngineMapper<Key, Entity, NullWritable, 开发者_高级运维NullWritable>
.
Now inside my map function (public void map(Key key, Entity value, Context context)
), I need to get access to PersistenceManager
. To get singleton PersistenceManager
, I need ServletContext
object.
Typically, in a HTTPServlet
extended class, I call getServletContext()
and pass it to get PersistenceManager
object. But in Mapper extended class, I don't have or can call getServletContext()
.
Can anyone advice on how to get servletcontext in my mapper class or if there is a way to pass servlet context from my servlet to Mapper extended class? I am using auto-mapreduce (programmatically) through a cron job.
精彩评论