Methods like aggregate on scala.collection.parallel.immutable.ParIterableLike process using Threads.
Does that mean I shouldn’t be using parallel collections if my Scala code is called from an EJB, because in EJB land its illegal to do your own threading?
If it is illegal, is there any plan to make an EJB friendly version that would use the EJB 3.1 @Asynchronous annotation?
See also: http://markusjais.com/scalas-parallel-collections-and-the-aggregate-method/
Its “illegal” in the sense that its not recommended, not in the sense that it can not be done. Its not recommended because the EJB container has the responsibility for starting/stopping/activating/passivating threads. If your bean started a thread and let it run indefinitely you could certainly get into odd states. If however your bean started a thread (such as by using a par collection operation) and did not return to the container until your par operation was complete, then you would likely be fine.
See http://java.sun.com/blueprints/qanda/ejb_tier/restrictions.html#threads for more details.