Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

adriaanm
Copy link
Contributor

Provide deprecated compatibility stubs for the types and static members,
which forward as follows:

scala.concurrent.forkjoin.ForkJoinPool         => java.util.concurrent.ForkJoinPool
scala.concurrent.forkjoin.ForkJoinTask         => java.util.concurrent.ForkJoinTask
scala.concurrent.forkjoin.ForkJoinWorkerThread => java.util.concurrent.ForkJoinWorkerThread
scala.concurrent.forkjoin.LinkedTransferQueue  => java.util.concurrent.LinkedTransferQueue
scala.concurrent.forkjoin.RecursiveAction      => java.util.concurrent.RecursiveAction
scala.concurrent.forkjoin.RecursiveTask        => java.util.concurrent.RecursiveTask
scala.concurrent.forkjoin.ThreadLocalRandom    => java.util.concurrent.ThreadLocalRandom

To prepare for Java 9, the Scala library avoids using sun.misc.Unsafe.
However, for now, it does provide a convenience accessor for it via scala.concurrent.util.Unsafe.
This (deprecated) class will be removed as soon as the eco-system drops its use
(akka-actor, I'm looking at you -- cc @viktorklang).

@scala-jenkins scala-jenkins added this to the 2.12.0-M3 milestone Jul 15, 2015
@adriaanm adriaanm force-pushed the unforkjoin branch 2 times, most recently from be0c544 to 8367c59 Compare July 15, 2015 06:15
@adriaanm
Copy link
Contributor Author

Provide deprecated compatibility stubs for the types and static members,
which forward as follows:

```
scala.concurrent.forkjoin.ForkJoinPool         => java.util.concurrent.ForkJoinPool
scala.concurrent.forkjoin.ForkJoinTask         => java.util.concurrent.ForkJoinTask
scala.concurrent.forkjoin.ForkJoinWorkerThread => java.util.concurrent.ForkJoinWorkerThread
scala.concurrent.forkjoin.LinkedTransferQueue  => java.util.concurrent.LinkedTransferQueue
scala.concurrent.forkjoin.RecursiveAction      => java.util.concurrent.RecursiveAction
scala.concurrent.forkjoin.RecursiveTask        => java.util.concurrent.RecursiveTask
scala.concurrent.forkjoin.ThreadLocalRandom    => java.util.concurrent.ThreadLocalRandom
```

To prepare for Java 9, the Scala library does not itself use `sun.misc.Unsafe`.
However, for now, it provide a convenience accessor for it
via `scala.concurrent.util.Unsafe`. This (deprecated) class will
be removed as soon as the eco-system drops its use
(akka-actor, I'm looking at you).
@adriaanm
Copy link
Contributor Author

Review by @SethTisue

@VladUreche
Copy link
Contributor

This patch will make the Oracle guys working on Project Jigsaw very happy, as it removes the Unsafe dependency 👍

https://issues.scala-lang.org/browse/SI-9381

@viktorklang
Copy link
Contributor

Thanks @ktoso for akka/akka#18009

@retronym
Copy link
Member

@adriaanm I've removed further detritus here: adriaanm/scala@adriaanm:unforkjoin...retronym:review/unforkjoin

Use j.u.c.Forkjoin directly in active and disabled tests

Remove bitrotted benchmarks code

I was going to update these to use `java.util.concurrent.ForkJoin`
directly, instead of our deprecated stubs.

But most of them don't compile anymore (e.g. scala.testing.Benchmark
has been removed, ClassTag imports missing).

While I'm all for benchmarks, we should have large swathes of code
checked in that isn't at compiled and run automatically.

I'm happy to help someone resurrect these in a suitable form.
@adriaanm
Copy link
Contributor Author

Thanks! Looks like I missed quite a few spots :-) Squashed them onto my first round of sweeping.

@retronym
Copy link
Member

Not sure quite how to manage the updates for these, but I've grepped for forkjoin in the default branch of a few GitHub orgs to show the spots that ought be updated eventually: https://gist.github.com/retronym/979da8069e04fd14b448

Maybe we can find some additional defacto API that needs to be stubbed in these, too.

@retronym retronym added the release-notes worth highlighting in next release notes label Jul 17, 2015
@retronym
Copy link
Member

LGTM, I've added the "release-notes" label.

@retronym
Copy link
Member

LGTM

SethTisue added a commit that referenced this pull request Jul 20, 2015
Remove our fork of forkjoin. Java 8 bundles it.
@SethTisue SethTisue merged commit 100a234 into scala:2.12.x Jul 20, 2015
@SethTisue
Copy link
Member

@axel22 and @Ichoran, the removal of benchmark code might interest you


// TODO: remove once akka no longer needs it, hopefully by 2.12.0-M3!
@Deprecated
public final class Unsafe {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of other places where we'll need to get rid of Unsafe, most notably, Futures and TrieMap.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Futures don't use Unsafe anymore AFAIK

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One left to fix then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction - the TrieMap uses AtomicReferenceFieldUpdaters - we never changed it to Unsafe. So, we're good there too.

@axel22
Copy link
Contributor

axel22 commented Jul 20, 2015

I'm a little bit surprised that we decided to remove the old (currently unused) benchmark code as part of this PR (which is about dropping our bundled Fork/Join pools) - I thought that PRs are supposed to be on-topic. But that's ok with me.

For what it's worth, I would be interested in reviving some of these benchmarks, and making sure that they run on a nightly basis, along with producing some fancy reports. These need not impact the correctness of the build, but would be useful as a sanity check - we often ask our submitters to do some benchmarks. We certainly have the infrastructure to do that systematically now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants