Map Reduce with appenginejs?

7 views
Skip to first unread message

Greg

unread,
Oct 9, 2010, 3:58:54 PM10/9/10
to appenginejs
Hi

Is it possible to use Map Reduce with appenginejs?

Im guessing you could use the java version of Map Reduce and invoke it
from javasript. But how would you implement the mapper call back
functions in javascript? Would that be possible or would you have to
implement them in java?

Sorry if this stuff is all very obvious, but I don't have a great deal
of experience with Java.

Cheers,
Greg

Frederick Polgardy

unread,
Oct 9, 2010, 4:09:59 PM10/9/10
to appen...@googlegroups.com
You can implement any Java interface with Rhino, and pass it in anywhere an instance of that interface is expected. For example:

new java.lang.Thread(
new java.lang.Runnable({
run: function() {
print(42)
}
})).start()

-Fred

Greg

unread,
Oct 10, 2010, 8:13:26 AM10/10/10
to appenginejs
Interesting, thanks.

How about extending classes, can that be done? I ask because the java
mapreduce,

http://code.google.com/p/appengine-mapreduce/wiki/GettingStartedInJava

requires you to extend the abstract class 'AppEngineMapper' (e.g. see
http://code.google.com/p/appengine-mapreduce/source/browse/trunk/java/example/com/google/appengine/demos/mapreduce/TestMapper.java)

Frederick Polgardy

unread,
Oct 10, 2010, 8:27:14 AM10/10/10
to appen...@googlegroups.com
Yes, to implement more than one interface, or extend class and possibly one or more interfaces, you use the JavaAdapter function. It takes any number of classes or interfaces (no more than one class, obviously) and a hash of method impls:

new java.lang.Thread(
JavaAdapter(java.lang.Runnable, {
run: function() {
print(42)
}
})).start()

-Fred

George Moschovitis

unread,
Oct 10, 2010, 10:08:55 AM10/10/10
to appen...@googlegroups.com
some time ago, I started work on porting the python version of mapper to javascript.
I don't have time to pursue this at the moment, perhaps another hacker can contribute this part
to appenginejs.

-g.
Reply all
Reply to author
Forward
0 new messages