Version 132.1 by Ravi Mendis on 2010/03/04 00:23

Hide last authors
Ravi Mendis 111.1 1 Given that todays processors ship with dual or quad cores and server processors ship with between 8 to 32 cores, languages like Java, Ruby, Groovy and Python are struggling to keep up. Scala, as its name suggests is built from the ground-up for concurrent programming - a methodology that can take advantage of these modern multi-core processors.
Ravi Mendis 50.1 2
Ravi Mendis 125.1 3 If you use Scala for a concurrent programming, the chances are that you're using Scala Actor to do that.
Ravi Mendis 50.1 4
Ravi Mendis 129.1 5 {{info}}
Ravi Mendis 50.1 6
Ravi Mendis 129.1 7 Concurrent programming in Scala is based on *Actors* and mailboxes - a common metaphor that is alternatively known as *Message Queues*.
Ravi Mendis 50.1 8
9 {{/info}}
10
11 == Using Scala Actors with EOF ==
12
Ravi Mendis 119.1 13 EOF being notoriously single-threaded, is incredibly unsuitable for use by Scala Actors.
14 Instead you may still use EOF but only to execute SQL directly.
Ravi Mendis 50.1 15
Ravi Mendis 73.1 16 === Using EOAccess to execute SQL ===
Ravi Mendis 50.1 17
18 Use Wonder API: [[ERXEOAccessUtilities.evaluateSQLWithEntityNamed()>>http://webobjects.mdimension.com/hudson/job/Wonder53/javadoc/er/extensions/eof/ERXEOAccessUtilities.html#evaluateSQLWithEntity(com.webobjects.eocontrol.EOEditingContext,%20com.webobjects.eoaccess.EOEntity,%20java.lang.String)]]
19
Ravi Mendis 73.1 20 ==== Caveats ====
Ravi Mendis 50.1 21
Ravi Mendis 125.1 22 If you're updating the state of EOs directly using SQL from Scala Actors, you will subsequently need to refresh/refetch these EOs from the WebObjects application.
Ravi Mendis 50.1 23
Ravi Mendis 125.1 24 == Alternatives ==
Ravi Mendis 50.1 25
Ravi Mendis 125.1 26 You may also manipulate the database from outside of the EOF stack.
Ravi Mendis 50.1 27
Ravi Mendis 73.1 28 === Squeryl ===
Ravi Mendis 50.1 29
Ravi Mendis 131.1 30 [[Squeryl>>http://max-l.github.com/Squeryl/index.html]] is a Scala [[Domain-specific language>>http://en.wikipedia.org/wiki/Domain-specific_language]] for SQL.
Ravi Mendis 125.1 31 You may update EOs from Scala Actors using Squeryl instead of using EOF. The advantage here is that you may access the database concurrently avoiding the single-threaded EOF bottleneck in your concurrent application.
Ravi Mendis 50.1 32
Ravi Mendis 73.1 33 However the same caveat applies - you will need to refresh EOs in the EOF stack for the WebObjects application to reflect the changes made by Squeryl.