# Class GcpManagedChannel.ChannelRef (1.11.0)

    protected class GcpManagedChannel.ChannelRef

A wrapper of real grpc channel, it provides helper functions to calculate affinity counts and
active streams count.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> GcpManagedChannel.ChannelRef

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### ChannelRef(ManagedChannel channel)

    protected ChannelRef(ManagedChannel channel)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `channel` | `io.grpc.ManagedChannel` |

### ChannelRef(ManagedChannel channel, int affinityCount, int activeStreamsCount)

    protected ChannelRef(ManagedChannel channel, int affinityCount, int activeStreamsCount)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `channel` | `io.grpc.ManagedChannel` |
| `affinityCount` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `activeStreamsCount` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

## Methods

### activeStreamsCountDecr(long startNanos, Status status, boolean fromClientSide)

    protected void activeStreamsCountDecr(long startNanos, Status status, boolean fromClientSide)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `startNanos` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `status` | `io.grpc.Status` |
| `fromClientSide` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

### activeStreamsCountIncr()

    protected void activeStreamsCountIncr()

### affinityCountDecr()

    protected void affinityCountDecr()

### affinityCountIncr()

    protected void affinityCountIncr()

### getActiveStreamsCount()

    protected int getActiveStreamsCount()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getAffinityCount()

    protected int getAffinityCount()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getAndResetErrCalls()

    protected long getAndResetErrCalls()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getAndResetOkCalls()

    protected long getAndResetOkCalls()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getChannel()

    protected ManagedChannel getChannel()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `io.grpc.ManagedChannel` |   |

### getConnectedSinceNanos()

    protected long getConnectedSinceNanos()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getId()

    protected int getId()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getState()

    protected ConnectivityState getState()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `io.grpc.ConnectivityState` |   |

### isActive()

    protected boolean isActive()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### messageReceived()

    protected void messageReceived()

### resetAffinityCount()

    protected void resetAffinityCount()