Stay organized with collections Save and categorize content based on your preferences.
AbstractOwnableSynchronizer
abstract class AbstractOwnableSynchronizer : Serializable
A synchronizer that may be exclusively owned by a thread. This class provides a basis for creating locks and related synchronizers that may entail a notion of ownership. The AbstractOwnableSynchronizer
class itself does not manage or use this information. However, subclasses and tools may use appropriately maintained values to help control and monitor access and provide diagnostics.
Summary
Protected constructors |
Empty constructor for use by subclasses. |
Protected methods |
Thread! | Returns the thread last set by setExclusiveOwnerThread , or null if never set. |
Unit | Sets the thread that currently owns exclusive access. |
Protected constructors
AbstractOwnableSynchronizer
protected AbstractOwnableSynchronizer()
Empty constructor for use by subclasses.
Protected methods
getExclusiveOwnerThread
protected fun getExclusiveOwnerThread(): Thread!
Returns the thread last set by setExclusiveOwnerThread
, or null
if never set. This method does not otherwise impose any synchronization or volatile
field accesses.
Return |
Thread! | the owner thread |
setExclusiveOwnerThread
protected fun setExclusiveOwnerThread(thread: Thread!): Unit
Sets the thread that currently owns exclusive access. A null
argument indicates that no thread owns access. This method does not otherwise impose any synchronization or volatile
field accesses.
Parameters |
thread | Thread!: the owner thread |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# AbstractOwnableSynchronizer\n\nAdded in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nAbstractOwnableSynchronizer\n===========================\n\n```\nabstract class AbstractOwnableSynchronizer : Serializable\n```\n\n|---|-------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.util.concurrent.locks.AbstractOwnableSynchronizer](#) |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [AbstractQueuedLongSynchronizer](/reference/kotlin/java/util/concurrent/locks/AbstractQueuedLongSynchronizer), [AbstractQueuedSynchronizer](/reference/kotlin/java/util/concurrent/locks/AbstractQueuedSynchronizer) |---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AbstractQueuedLongSynchronizer](/reference/kotlin/java/util/concurrent/locks/AbstractQueuedLongSynchronizer) | A version of [AbstractQueuedSynchronizer](/reference/kotlin/java/util/concurrent/locks/AbstractQueuedSynchronizer) in which synchronization state is maintained as a `long`. | | [AbstractQueuedSynchronizer](/reference/kotlin/java/util/concurrent/locks/AbstractQueuedSynchronizer) | Provides a framework for implementing blocking locks and related synchronizers (semaphores, events, etc) that rely on first-in-first-out (FIFO) wait queues. | |\n\nA synchronizer that may be exclusively owned by a thread. This class provides a basis for creating locks and related synchronizers that may entail a notion of ownership. The `AbstractOwnableSynchronizer` class itself does not manage or use this information. However, subclasses and tools may use appropriately maintained values to help control and monitor access and provide diagnostics.\n\nSummary\n-------\n\n| Protected constructors ||\n|------------------------------------------------------------------------------------------------------------|---|\n| [AbstractOwnableSynchronizer](#AbstractOwnableSynchronizer())`()` Empty constructor for use by subclasses. |\n\n| Protected methods ||\n|------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Thread](../../../lang/Thread.html#)! | [getExclusiveOwnerThread](#getExclusiveOwnerThread())`()` Returns the thread last set by `setExclusiveOwnerThread`, or `null` if never set. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setExclusiveOwnerThread](#setExclusiveOwnerThread(java.lang.Thread))`(`thread:` `[Thread](../../../lang/Thread.html#)!`)` Sets the thread that currently owns exclusive access. |\n\nProtected constructors\n----------------------\n\n### AbstractOwnableSynchronizer\n\nAdded in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected AbstractOwnableSynchronizer()\n```\n\nEmpty constructor for use by subclasses.\n\nProtected methods\n-----------------\n\n### getExclusiveOwnerThread\n\nAdded in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected fun getExclusiveOwnerThread(): Thread!\n```\n\nReturns the thread last set by `setExclusiveOwnerThread`, or `null` if never set. This method does not otherwise impose any synchronization or `volatile` field accesses.\n\n| Return ||\n|---------------------------------------|------------------|\n| [Thread](../../../lang/Thread.html#)! | the owner thread |\n\n### setExclusiveOwnerThread\n\nAdded in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected fun setExclusiveOwnerThread(thread: Thread!): Unit\n```\n\nSets the thread that currently owns exclusive access. A `null` argument indicates that no thread owns access. This method does not otherwise impose any synchronization or `volatile` field accesses.\n\n| Parameters ||\n|----------|---------------------------------------------------------|\n| `thread` | [Thread](../../../lang/Thread.html#)!: the owner thread |"]]