The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Still No Spaces/Scale-Out/XTP possible in Scala?

3 replies on 1 page. Most recent reply: Oct 11, 2009 6:27 PM by Gregg Wonderly

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Dušan Kysel

Posts: 11
Nickname: dusank
Registered: Mar, 2008

Still No Spaces/Scale-Out/XTP possible in Scala? Posted: Nov 28, 2008 7:12 PM
Reply to this message Reply
Advertisement
Scala is quite impressive, but does it finally integrate with any production ready, well-tested solutions for XTP distributed computing, or perhaps have some "good enough" (SLA container, good manageability and commercial support at least) solutions of its own?

The lack of any Tuple Space implementations/integrations seems to make its applicability quite limited to relatively small/simple/cheap systems if you don't want to or can't afford to spend your resources building something powerful enough yourself inhouse, doesn't it?

One might think that the complementary POJO model for JavaSpaces included in the Gigaspaces XAP platform might provide at least some degree of interoperability (although designed only for Java/Spring, therefore inherently quite suboptimal). Unfortunately even this was proven to be wrong lately:

http://forum.openspaces.org/thread.jspa?messageID=10365

If not, its a pity as Scalas impressive design tradeoffs certainly seem to provide all what it would take to really shine in this area ...


Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: Still No Spaces/Scale-Out/XTP possible in Scala? Posted: Nov 28, 2008 10:20 PM
Reply to this message Reply
I don't know why POJOs wouldn't work with GigaSpaces. To create a POJO in Scala that you want to work with Java framework you would normally annotate the fields with scala.reflect.BeanProperty. That will generate the get and set methods in the bytecodes.

The reason Jini/JavaSpace entries aren't straitforward to write in Scala is that Scala provides no native way to get public fields in the bytecodes, and Jini/JavaSpace entries use public fields. Public fields in Scala source get turned into Scala-style setters and getter methods, which allows fields to be overridden in subclasses. However, you can use entries from Scala that were written Java no problem. It may be possible to make entry fields public with a Scala compiler plug-in too, but I wouldn't be sure until I tried it. I'd like to try that when I get time. If someone else has tried it, please post here and let us know how it went.

Dušan Kysel

Posts: 11
Nickname: dusank
Registered: Mar, 2008

Re: Still No Spaces/Scale-Out/XTP possible in Scala? Posted: Nov 29, 2008 3:29 PM
Reply to this message Reply
Hi Bill,

thanks for your fast reply!

As mentioned in the GS XAP forum post I linked to, neither the BeanProperty annotation approach nor writing the setters/getters ad hoc works.

You can check this out yourself pretty fast by trying out the attached example4shay-scala-gs-integration.zip maven projects, which are just slight modifications of the basic GS archetype documented here:

http://www.gigaspaces.com/wiki/display/XAP66/Writing+Your+First+Scalable+Application
http://www.gigaspaces.com/wiki/display/XAP66/Maven+Plugin

It might prove to be some bug (hidden dependency perhaps) in GS XAP itself, unfortunately the people at GS don't seem to have been able to figure it out yet either and other XAP supported languages e.g. Groovy don't have such issues AFAIK ...

A Scala compiler plug-in for generating JINI/GS Entries would certainly help to find the root of this problem as well as make Scala accessible to (Giga)Space users ...

Let's hope someone with pretty good knowledge of the Scala Compiler architecture finds time to try it out soon.

Regards,

Dusan

Gregg Wonderly

Posts: 317
Nickname: greggwon
Registered: Apr, 2003

Re: Still No Spaces/Scale-Out/XTP possible in Scala? Posted: Oct 11, 2009 6:27 PM
Reply to this message Reply
There is a fairly old, unfinished project on java.net that I created, at http://griddle.dev.java.net. It is a tuple space that is based on the JavaSpaces API model, but has a couple of fundamental differences. First, keys are wrapped in a class which has a comparison/matching method on it that you provide. Data is separate from this class. The intent is that the key wrapper class would be something that would change very seldomly so that you don't get into problems associated with live code that JavaSpaces tries to completely avoid by using custom serialization and marshalled objects.
<p>
Data is separate from the keys so that it can be marshalled and stay that way. However, no explicit marshalling is done for you, you have to do all of that. Thus, in small, dedicated applications, you can choose to do whatever level of live objects you need.
<p>
There is iterator support so that you can make a query and poll it forever to get all matches. There is an executor facility that lets you put live code into the space. The executor "add" to the space returns an iterator implementation so that there is no difference in how you use the space with executors vs queries.
<p>
I put this together in a pretty short amount of time to give people a way to look at iterators and executors when the JavaSpaces05 implementation discussion was going on.
<p>
I've not put it into production use, but have played with it at length and tried to make it as functional as I could at demonstrating all the features.
<p>
The inclusion of the matching method in the class might make it play with Scala much more readily.

Flat View: This topic has 3 replies on 1 page
Topic: A list containing strings and Ints? Previous Topic   Next Topic Topic: One small errata for the book

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use