类 ClientCnxIdleState
java.lang.Object
org.apache.pulsar.client.impl.ClientCnxIdleState
-
嵌套类概要
嵌套类修饰符和类型类说明static enumIndicates the usage status of the connection and whether it has been released. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voiddoIdleDetect(long maxIdleSeconds) Check whether the connection is idle, and if so, set the idle-state to #ClientCnxIdleState.State.IDLE.Get idle-stat.booleanisIdle()booleanbooleanbooleanisUsing()voidTry to transform the state of the connection to #ClientCnxIdleState.State.IDLE, state should only be transformed to #ClientCnxIdleState.State.IDLEfrom state #ClientCnxIdleState.State.USING. if the state is successfully transformed, "idleMarkTime" will be assigned to current time.booleanChanges the idle-state of the connection to #ClientCnxIdleState.State.RELEASED, This method only changes this connection from the #ClientCnxIdleState.State.RELEASINGstate to the #ClientCnxIdleState.State.RELEASEDstate, and close if change state to #ClientCnxIdleState.State.RELEASEDsuccess.booleanChanges the idle-state of the connection to #ClientCnxIdleState.State.RELEASING, This method only changes this connection from the #ClientCnxIdleState.State.IDLEstate to the #ClientCnxIdleState.State.RELEASINGstate.booleanChanges the idle-state of the connection to #ClientCnxIdleState.State.USINGas much as possible, This method is used when connection borrow, and resetidleMarkTimeif change state to #ClientCnxIdleState.State.USINGsuccess.
-
构造器详细资料
-
ClientCnxIdleState
-
-
方法详细资料
-
getIdleStat
Get idle-stat.- 返回:
- connection idle-stat
-
isUsing
public boolean isUsing()- 返回:
- Whether this connection is in use.
-
isIdle
public boolean isIdle()- 返回:
- Whether this connection is in idle.
-
isReleasing
public boolean isReleasing()- 返回:
- Whether this connection is in idle and will be released soon.
-
isReleased
public boolean isReleased()- 返回:
- Whether this connection has already been released.
-
tryMarkIdleAndInitIdleTime
public void tryMarkIdleAndInitIdleTime()Try to transform the state of the connection to #ClientCnxIdleState.State.IDLE, state should only be transformed to #ClientCnxIdleState.State.IDLEfrom state #ClientCnxIdleState.State.USING. if the state is successfully transformed, "idleMarkTime" will be assigned to current time. -
tryMarkUsingAndClearIdleTime
public boolean tryMarkUsingAndClearIdleTime()Changes the idle-state of the connection to #ClientCnxIdleState.State.USINGas much as possible, This method is used when connection borrow, and resetidleMarkTimeif change state to #ClientCnxIdleState.State.USINGsuccess.- 返回:
- Whether change idle-stat to #
ClientCnxIdleState.State.USINGsuccess. False is returned only if the connection has already been released.
-
tryMarkReleasing
public boolean tryMarkReleasing()Changes the idle-state of the connection to #ClientCnxIdleState.State.RELEASING, This method only changes this connection from the #ClientCnxIdleState.State.IDLEstate to the #ClientCnxIdleState.State.RELEASINGstate.- 返回:
- Whether change idle-stat to #
ClientCnxIdleState.State.RELEASINGsuccess.
-
tryMarkReleasedAndCloseConnection
public boolean tryMarkReleasedAndCloseConnection()Changes the idle-state of the connection to #ClientCnxIdleState.State.RELEASED, This method only changes this connection from the #ClientCnxIdleState.State.RELEASINGstate to the #ClientCnxIdleState.State.RELEASEDstate, and close if change state to #ClientCnxIdleState.State.RELEASEDsuccess.- 返回:
- Whether change idle-stat to #
ClientCnxIdleState.State.RELEASEDand close connection success.
-
doIdleDetect
public void doIdleDetect(long maxIdleSeconds) Check whether the connection is idle, and if so, set the idle-state to #ClientCnxIdleState.State.IDLE. If the state is already idle and the is reached, set the state to #ClientCnxIdleState.State.RELEASING.
-