com.alibaba.dubbo.remoting.transport
Class AbstractClient

java.lang.Object
  extended by com.alibaba.dubbo.remoting.transport.AbstractPeer
      extended by com.alibaba.dubbo.remoting.transport.AbstractEndpoint
          extended by com.alibaba.dubbo.remoting.transport.AbstractClient
All Implemented Interfaces:
Resetable, Channel, ChannelHandler, Client, Endpoint
Direct Known Subclasses:
GrizzlyClient, MinaClient, NettyClient, NettyClient

public abstract class AbstractClient
extends AbstractEndpoint
implements Client

AbstractClient

Author:
qian.lei, chao.liuc

Constructor Summary
AbstractClient(URL url, ChannelHandler handler)
           
 
Method Summary
 void close()
          close the channel.
 void close(int timeout)
          Graceful close the channel.
 void disconnect()
           
 Object getAttribute(String key)
          get attribute.
 InetSocketAddress getConnectAddress()
           
 InetSocketAddress getLocalAddress()
          get local address.
 InetSocketAddress getRemoteAddress()
          get remote address.
 boolean hasAttribute(String key)
          has attribute.
 boolean isConnected()
          is connected.
 void reconnect()
          reconnect.
 void removeAttribute(String key)
          remove attribute.
 void send(Object message, boolean sent)
          send message.
 void setAttribute(String key, Object value)
          set attribute.
 String toString()
           
 
Methods inherited from class com.alibaba.dubbo.remoting.transport.AbstractEndpoint
reset, reset
 
Methods inherited from class com.alibaba.dubbo.remoting.transport.AbstractPeer
caught, connected, disconnected, getChannelHandler, getDelegateHandler, getHandler, getUrl, isClosed, isClosing, received, send, sent, startClose
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.alibaba.dubbo.remoting.Client
reset
 
Methods inherited from interface com.alibaba.dubbo.remoting.Endpoint
getChannelHandler, getUrl, isClosed, send, startClose
 
Methods inherited from interface com.alibaba.dubbo.common.Resetable
reset
 

Constructor Detail

AbstractClient

public AbstractClient(URL url,
                      ChannelHandler handler)
               throws RemotingException
Throws:
RemotingException
Method Detail

getConnectAddress

public InetSocketAddress getConnectAddress()

getRemoteAddress

public InetSocketAddress getRemoteAddress()
Description copied from interface: Channel
get remote address.

Specified by:
getRemoteAddress in interface Channel
Returns:
remote address.

getLocalAddress

public InetSocketAddress getLocalAddress()
Description copied from interface: Endpoint
get local address.

Specified by:
getLocalAddress in interface Endpoint
Returns:
local address.

isConnected

public boolean isConnected()
Description copied from interface: Channel
is connected.

Specified by:
isConnected in interface Channel
Returns:
connected

getAttribute

public Object getAttribute(String key)
Description copied from interface: Channel
get attribute.

Specified by:
getAttribute in interface Channel
Parameters:
key - key.
Returns:
value.

setAttribute

public void setAttribute(String key,
                         Object value)
Description copied from interface: Channel
set attribute.

Specified by:
setAttribute in interface Channel
Parameters:
key - key.
value - value.

removeAttribute

public void removeAttribute(String key)
Description copied from interface: Channel
remove attribute.

Specified by:
removeAttribute in interface Channel
Parameters:
key - key.

hasAttribute

public boolean hasAttribute(String key)
Description copied from interface: Channel
has attribute.

Specified by:
hasAttribute in interface Channel
Parameters:
key - key.
Returns:
has or has not.

send

public void send(Object message,
                 boolean sent)
          throws RemotingException
Description copied from interface: Endpoint
send message.

Specified by:
send in interface Endpoint
sent - 是否已发送完成
Throws:
RemotingException

disconnect

public void disconnect()

reconnect

public void reconnect()
               throws RemotingException
Description copied from interface: Client
reconnect.

Specified by:
reconnect in interface Client
Throws:
RemotingException

close

public void close()
Description copied from interface: Endpoint
close the channel.

Specified by:
close in interface Endpoint
Overrides:
close in class AbstractPeer

close

public void close(int timeout)
Description copied from interface: Endpoint
Graceful close the channel.

Specified by:
close in interface Endpoint
Overrides:
close in class AbstractPeer

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012–2017 Alibaba. All rights reserved.