Skip to content

Commit

Permalink
Remove deprecated SendChannel.isFull (#2613)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwwdfsad committed Apr 6, 2021
1 parent 98532c9 commit eb963e8
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 21 deletions.
2 changes: 0 additions & 2 deletions kotlinx-coroutines-core/api/kotlinx-coroutines-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,6 @@ public final class kotlinx/coroutines/channels/ConflatedBroadcastChannel : kotli
public final fun getValueOrNull ()Ljava/lang/Object;
public fun invokeOnClose (Lkotlin/jvm/functions/Function1;)V
public fun isClosedForSend ()Z
public fun isFull ()Z
public fun offer (Ljava/lang/Object;)Z
public fun openSubscription ()Lkotlinx/coroutines/channels/ReceiveChannel;
public fun send (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand Down Expand Up @@ -857,7 +856,6 @@ public abstract interface class kotlinx/coroutines/channels/SendChannel {
public abstract fun getOnSend ()Lkotlinx/coroutines/selects/SelectClause2;
public abstract fun invokeOnClose (Lkotlin/jvm/functions/Function1;)V
public abstract fun isClosedForSend ()Z
public abstract fun isFull ()Z
public abstract fun offer (Ljava/lang/Object;)Z
public abstract fun send (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun trySend-JP2dKIU (Ljava/lang/Object;)Ljava/lang/Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ internal abstract class AbstractSendChannel<E>(
// ------ SendChannel ------

public final override val isClosedForSend: Boolean get() = closedForSend != null
public override val isFull: Boolean get() = isFullImpl
protected val isFullImpl: Boolean get() = queue.nextNode !is ReceiveOrClosed<*> && isBufferFull
private val isFullImpl: Boolean get() = queue.nextNode !is ReceiveOrClosed<*> && isBufferFull

public final override suspend fun send(element: E) {
// fast path -- try offer non-blocking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ internal open class ArrayChannel<E>(
protected final override val isBufferAlwaysFull: Boolean get() = false
protected final override val isBufferFull: Boolean get() = size.value == capacity && onBufferOverflow == BufferOverflow.SUSPEND

override val isFull: Boolean get() = lock.withLock { isFullImpl }
override val isEmpty: Boolean get() = lock.withLock { isEmptyImpl }
override val isClosedForReceive: Boolean get() = lock.withLock { super.isClosedForReceive }

Expand Down
10 changes: 0 additions & 10 deletions kotlinx-coroutines-core/common/src/channels/Channel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ public interface SendChannel<in E> {
@ExperimentalCoroutinesApi
public val isClosedForSend: Boolean

/**
* Returns `true` if the channel is full (out of capacity), which means that an attempt to [send] will suspend.
* This function returns `false` if the channel [is closed for `send`][isClosedForSend].
*
* @suppress **Will be removed in next releases, no replacement.**
*/
@ExperimentalCoroutinesApi
@Deprecated(level = DeprecationLevel.ERROR, message = "Will be removed in next releases without replacement")
public val isFull: Boolean

/**
* Sends the specified [element] to this channel, suspending the caller while the buffer of this channel is full
* or if it does not exist, or throws an exception if the channel [is closed for `send`][isClosedForSend] (see [close] for details).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public class ConflatedBroadcastChannel<E>() : BroadcastChannel<E> {
}

public override val isClosedForSend: Boolean get() = _state.value is Closed
public override val isFull: Boolean get() = false

@Suppress("UNCHECKED_CAST")
public override fun openSubscription(): ReceiveChannel<E> {
Expand Down
2 changes: 1 addition & 1 deletion kotlinx-coroutines-core/jvm/src/channels/Channels.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package kotlinx.coroutines.channels
import kotlinx.coroutines.*

/**
* Adds [element] into to this channel, **blocking** the caller while this channel [Channel.isFull],
* Adds [element] into to this channel, **blocking** the caller while this channel is full,
* or throws exception if the channel [Channel.isClosedForSend] (see [Channel.close] for details).
*
* This is a way to call [Channel.send] method inside a blocking code using [runBlocking],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public final class kotlinx/coroutines/reactive/PublisherCoroutine : kotlinx/coro
public fun invokeOnClose (Lkotlin/jvm/functions/Function1;)Ljava/lang/Void;
public synthetic fun invokeOnClose (Lkotlin/jvm/functions/Function1;)V
public fun isClosedForSend ()Z
public fun isFull ()Z
public fun offer (Ljava/lang/Object;)Z
public synthetic fun onCompleted (Ljava/lang/Object;)V
public fun registerSelectClause2 (Lkotlinx/coroutines/selects/SelectInstance;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)V
Expand Down
1 change: 0 additions & 1 deletion reactive/kotlinx-coroutines-reactive/src/Publish.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public class PublisherCoroutine<in T>(
private var cancelled = false // true when Subscription.cancel() is invoked

override val isClosedForSend: Boolean get() = isCompleted
override val isFull: Boolean = mutex.isLocked
override fun close(cause: Throwable?): Boolean = cancelCoroutine(cause)
override fun invokeOnClose(handler: (Throwable?) -> Unit): Nothing =
throw UnsupportedOperationException("PublisherCoroutine doesn't support invokeOnClose")
Expand Down
1 change: 0 additions & 1 deletion reactive/kotlinx-coroutines-rx2/src/RxObservable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ private class RxObservableCoroutine<T : Any>(
private val _signal = atomic(OPEN)

override val isClosedForSend: Boolean get() = isCompleted
override val isFull: Boolean = mutex.isLocked
override fun close(cause: Throwable?): Boolean = cancelCoroutine(cause)
override fun invokeOnClose(handler: (Throwable?) -> Unit) =
throw UnsupportedOperationException("RxObservableCoroutine doesn't support invokeOnClose")
Expand Down
1 change: 0 additions & 1 deletion reactive/kotlinx-coroutines-rx3/src/RxObservable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ private class RxObservableCoroutine<T: Any>(
private val _signal = atomic(OPEN)

override val isClosedForSend: Boolean get() = isCompleted
override val isFull: Boolean = mutex.isLocked
override fun close(cause: Throwable?): Boolean = cancelCoroutine(cause)
override fun invokeOnClose(handler: (Throwable?) -> Unit) =
throw UnsupportedOperationException("RxObservableCoroutine doesn't support invokeOnClose")
Expand Down

0 comments on commit eb963e8

Please sign in to comment.