-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recreated ClientState as wrapper around GrpcChannel to preserve compatibility with generated clients from previous versions.
- Loading branch information
1 parent
57308a4
commit 6966c54
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
runtime/src/main/scala/akka/grpc/internal/ClientState.scala
This file contains 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 @@ | ||
/* | ||
* Copyright (C) 2018-2021 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akka.grpc.internal | ||
|
||
import java.util.concurrent.CompletionStage | ||
|
||
import scala.concurrent.Future | ||
|
||
import akka.Done | ||
import akka.actor.ClassicActorSystemProvider | ||
import akka.annotation.{InternalApi, InternalStableApi} | ||
import akka.event.LoggingAdapter | ||
import akka.grpc.{GrpcChannel, GrpcClientSettings} | ||
|
||
/** | ||
* INTERNAL API | ||
* | ||
* Deprecated: This class wraps a GrpcChannel for compatibility with clients generated by previous versions. | ||
*/ | ||
@deprecated("Kept for binary compatibility between generated code and runtime", "akka-grpc 2.1.4") | ||
@InternalApi | ||
final class ClientState(channel: GrpcChannel)( | ||
implicit sys: ClassicActorSystemProvider) { | ||
|
||
@InternalStableApi | ||
val internalChannel: InternalChannel = | ||
channel.internalChannel | ||
|
||
@InternalStableApi | ||
def this(settings: GrpcClientSettings, log: LoggingAdapter)(implicit sys: ClassicActorSystemProvider) = | ||
this(GrpcChannel(settings)) | ||
|
||
def closedCS(): CompletionStage[Done] = channel.closedCS() | ||
def closeCS(): CompletionStage[Done] = channel.closeCS() | ||
|
||
def closed(): Future[Done] = channel.closed() | ||
|
||
def close(): Future[Done] = channel.close() | ||
} | ||
|
||
/** | ||
* INTERNAL API | ||
* Used from generated code so can't be private. | ||
* | ||
* Thrown if a withChannel call is called after closing the internal channel | ||
*/ | ||
@InternalApi | ||
final class ClientClosedException() extends RuntimeException("withChannel called after close()") |