com.alibaba.dubbo.remoting.transport
Class AbstractPeer

java.lang.Object
  extended by com.alibaba.dubbo.remoting.transport.AbstractPeer
All Implemented Interfaces:
ChannelHandler, Endpoint
Direct Known Subclasses:
AbstractChannel, AbstractEndpoint

public abstract class AbstractPeer
extends Object
implements Endpoint, ChannelHandler

AbstractPeer

Author:
qian.lei, william.liangf

Constructor Summary
AbstractPeer(URL url, ChannelHandler handler)
           
 
Method Summary
 void caught(Channel ch, Throwable ex)
          on exception caught.
 void close()
          close the channel.
 void close(int timeout)
          Graceful close the channel.
 void connected(Channel ch)
          on channel connected.
 void disconnected(Channel ch)
          on channel disconnected.
 ChannelHandler getChannelHandler()
          get channel handler.
 ChannelHandler getDelegateHandler()
          返回最终的handler,可能已被wrap,需要区别于getChannelHandler
 ChannelHandler getHandler()
          Deprecated. 
 URL getUrl()
          get url.
 boolean isClosed()
          is closed.
 boolean isClosing()
           
 void received(Channel ch, Object msg)
          on message received.
 void send(Object message)
          send message.
 void sent(Channel ch, Object msg)
          on message sent.
 void startClose()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.alibaba.dubbo.remoting.Endpoint
getLocalAddress, send
 

Constructor Detail

AbstractPeer

public AbstractPeer(URL url,
                    ChannelHandler handler)
Method Detail

send

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

Specified by:
send in interface Endpoint
Throws:
RemotingException

close

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

Specified by:
close in interface Endpoint

close

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

Specified by:
close in interface Endpoint

startClose

public void startClose()
Specified by:
startClose in interface Endpoint

getUrl

public URL getUrl()
Description copied from interface: Endpoint
get url.

Specified by:
getUrl in interface Endpoint
Returns:
url

getChannelHandler

public ChannelHandler getChannelHandler()
Description copied from interface: Endpoint
get channel handler.

Specified by:
getChannelHandler in interface Endpoint
Returns:
channel handler

getHandler

@Deprecated
public ChannelHandler getHandler()
Deprecated. 

Returns:
ChannelHandler

getDelegateHandler

public ChannelHandler getDelegateHandler()
返回最终的handler,可能已被wrap,需要区别于getChannelHandler

Returns:
ChannelHandler

isClosed

public boolean isClosed()
Description copied from interface: Endpoint
is closed.

Specified by:
isClosed in interface Endpoint
Returns:
closed

isClosing

public boolean isClosing()

connected

public void connected(Channel ch)
               throws RemotingException
Description copied from interface: ChannelHandler
on channel connected.

Specified by:
connected in interface ChannelHandler
Parameters:
ch - channel.
Throws:
RemotingException

disconnected

public void disconnected(Channel ch)
                  throws RemotingException
Description copied from interface: ChannelHandler
on channel disconnected.

Specified by:
disconnected in interface ChannelHandler
Parameters:
ch - channel.
Throws:
RemotingException

sent

public void sent(Channel ch,
                 Object msg)
          throws RemotingException
Description copied from interface: ChannelHandler
on message sent.

Specified by:
sent in interface ChannelHandler
Parameters:
ch - channel.
msg - message.
Throws:
RemotingException

received

public void received(Channel ch,
                     Object msg)
              throws RemotingException
Description copied from interface: ChannelHandler
on message received.

Specified by:
received in interface ChannelHandler
Parameters:
ch - channel.
msg - message.
Throws:
RemotingException

caught

public void caught(Channel ch,
                   Throwable ex)
            throws RemotingException
Description copied from interface: ChannelHandler
on exception caught.

Specified by:
caught in interface ChannelHandler
Parameters:
ch - channel.
ex - exception.
Throws:
RemotingException


Copyright © 2012–2017 Alibaba. All rights reserved.