Class AbstractConnectionClient
java.lang.Object
org.apache.dubbo.remoting.transport.AbstractPeer
org.apache.dubbo.remoting.transport.AbstractEndpoint
org.apache.dubbo.remoting.transport.AbstractClient
org.apache.dubbo.remoting.api.connection.AbstractConnectionClient
- All Implemented Interfaces:
Resetable,Channel,ChannelHandler,Client,Endpoint,IdleSensible
-
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddCloseListener(Runnable func) add a listener that will be executed when the connection is closed.abstract voidaddConnectedListener(Runnable func) add a listener that will be executed when a connection is established.abstract voidAdd a listener that will be executed when the connection is disconnected.abstract voiddestroy()This method will be invoked when counter reaches 0, override this method to destroy materials related to the specific resource.abstract <T> TgetChannel(Boolean generalizable) if generalizable, return NIOChannel else return Dubbo ChannellongGet counterfinal voidincrease()abstract booleanconnection is available.abstract voidonConnected(Object channel) when connected, callback.abstract voidwhen goaway, callback.booleanrelease()Decreases the reference count by 1 and calls} if the reference count reaches 0.invalid @link
{@link this#destroyfinal booleanretain()Increments the reference count by 1.Methods inherited from class org.apache.dubbo.remoting.transport.AbstractClient
close, close, disconnect, getAttribute, getConnectAddress, getLocalAddress, getRemoteAddress, hasAttribute, isConnected, reconnect, removeAttribute, send, setAttribute, toStringMethods inherited from class org.apache.dubbo.remoting.transport.AbstractEndpoint
reset, resetMethods inherited from class org.apache.dubbo.remoting.transport.AbstractPeer
caught, connected, disconnected, getChannelHandler, getDelegateHandler, getHandler, getUrl, isClosed, isClosing, received, send, sent, startCloseMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.dubbo.remoting.Endpoint
getChannelHandler, getUrl, isClosed, send, startCloseMethods inherited from interface org.apache.dubbo.remoting.IdleSensible
canHandleIdle
-
Method Details
-
increase
public final void increase() -
retain
public final boolean retain()Increments the reference count by 1. -
release
public boolean release()Decreases the reference count by 1 and calls} if the reference count reaches 0.invalid @link
{@link this#destroy -
isAvailable
public abstract boolean isAvailable()connection is available.- Returns:
- boolean
-
addConnectedListener
add a listener that will be executed when a connection is established.- Parameters:
func- execute function
-
addDisconnectedListener
Add a listener that will be executed when the connection is disconnected.- Parameters:
func- execute function
-
addCloseListener
add a listener that will be executed when the connection is closed.- Parameters:
func- execute function
-
onConnected
when connected, callback.- Parameters:
channel- Channel
-
onGoaway
when goaway, callback.- Parameters:
channel- Channel
-
destroy
public abstract void destroy()This method will be invoked when counter reaches 0, override this method to destroy materials related to the specific resource. -
getChannel
if generalizable, return NIOChannel else return Dubbo Channel- Parameters:
generalizable- generalizable- Returns:
- Dubbo Channel or NIOChannel such as NettyChannel
-
getCounter
public long getCounter()Get counter
-