开发者

How to call getServletContext() equivalent in AppEngineMapper derived class?

开发者 https://www.devze.com 2023-03-30 03:42 出处:网络
I have a Mapper class which extends AppEngineMapper<Key, Entity, NullWritable, 开发者_高级运维NullWritable>.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消