-
Notifications
You must be signed in to change notification settings - Fork 1.1k
replace scala.collection.concurrent
java files
#24005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Scala (https://www.scala-lang.org) | ||
* | ||
* Copyright EPFL and Lightbend, Inc. dba Akka | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (http://www.apache.org/licenses/LICENSE-2.0). | ||
* | ||
* See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
*/ | ||
|
||
package scala.collection.concurrent | ||
|
||
import scala.language.`2.13` | ||
import language.experimental.captureChecking | ||
|
||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater | ||
import scala.annotation.static | ||
|
||
private[concurrent] object CNodeBase { | ||
@static | ||
final val updater: AtomicIntegerFieldUpdater[CNodeBase[?, ?]] = | ||
AtomicIntegerFieldUpdater.newUpdater(classOf[CNodeBase[?, ?]], "csize") | ||
} | ||
|
||
private[concurrent] abstract class CNodeBase[K, V] extends MainNode[K, V] { | ||
|
||
@volatile var csize: Int = -1 | ||
|
||
def CAS_SIZE(oldval: Int, nval: Int): Boolean = { | ||
CNodeBase.updater.compareAndSet(this, oldval, nval) | ||
} | ||
|
||
def WRITE_SIZE(nval: Int): Unit = { | ||
CNodeBase.updater.set(this, nval) | ||
} | ||
|
||
def READ_SIZE(): Int = { | ||
CNodeBase.updater.get(this) | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Scala (https://www.scala-lang.org) | ||
* | ||
* Copyright EPFL and Lightbend, Inc. dba Akka | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (http://www.apache.org/licenses/LICENSE-2.0). | ||
* | ||
* See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
*/ | ||
|
||
package scala.collection.concurrent | ||
|
||
import scala.language.`2.13` | ||
import language.experimental.captureChecking | ||
|
||
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater | ||
import scala.annotation.static | ||
|
||
private[concurrent] object INodeBase { | ||
@static | ||
final val updater: AtomicReferenceFieldUpdater[INodeBase[?, ?], MainNode[?, ?]] = | ||
AtomicReferenceFieldUpdater.newUpdater(classOf[INodeBase[?, ?]], classOf[MainNode[?, ?]], "mainnode") | ||
|
||
@static final val RESTART: Object = new Object() | ||
|
||
@static final val NO_SUCH_ELEMENT_SENTINEL: Object = new Object() | ||
} | ||
|
||
private[concurrent] abstract class INodeBase[K, V](val gen: Gen) extends BasicNode { | ||
|
||
@volatile var mainnode: MainNode[K, V] = null | ||
|
||
def prev(): BasicNode = null | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Scala (https://www.scala-lang.org) | ||
* | ||
* Copyright EPFL and Lightbend, Inc. dba Akka | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (http://www.apache.org/licenses/LICENSE-2.0). | ||
* | ||
* See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
*/ | ||
|
||
package scala.collection.concurrent | ||
|
||
import scala.language.`2.13` | ||
import language.experimental.captureChecking | ||
|
||
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater | ||
import scala.annotation.static | ||
|
||
private[concurrent] object MainNode { | ||
@static val updater: AtomicReferenceFieldUpdater[MainNode[?, ?], MainNode[?, ?]] = | ||
AtomicReferenceFieldUpdater.newUpdater(classOf[MainNode[?, ?]], classOf[MainNode[?, ?]], "prev") | ||
} | ||
|
||
private[concurrent] abstract class MainNode[K, V] extends BasicNode { | ||
|
||
@volatile var prev: MainNode[K, V] = null | ||
|
||
def cachedSize(ct: Object): Int | ||
|
||
// standard contract | ||
def knownSize(): Int | ||
|
||
def CAS_PREV(oldval: MainNode[K, V], nval: MainNode[K, V]): Boolean = { | ||
MainNode.updater.compareAndSet(this, oldval, nval) | ||
} | ||
|
||
def WRITE_PREV(nval: MainNode[K, V]): Unit = { | ||
MainNode.updater.set(this, nval) | ||
} | ||
|
||
// do we need this? unclear in the javadocs... | ||
// apparently not - volatile reads are supposed to be safe | ||
// regardless of whether there are concurrent ARFU updates | ||
@deprecated | ||
def READ_PREV(): MainNode[K, V] = { | ||
MainNode.updater.get(this).asInstanceOf[MainNode[K, V]] | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
TrieMap.inodeupdater
is unused. but error without this change. Should we deprecate this field? 🤔