Search in sources :

Example 1 with Peer

use of com.alibaba.dubbo.remoting.p2p.Peer in project dubbo by alibaba.

the class FileGroup method join.

public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Peer peer = super.join(url, handler);
    try {
        String full = url.toFullString();
        String[] lines = IOUtils.readLines(file);
        for (String line : lines) {
            if (full.equals(line)) {
                return peer;
            }
        }
        IOUtils.appendLines(file, new String[] { full });
    } catch (IOException e) {
        throw new RemotingException(new InetSocketAddress(NetUtils.getLocalHost(), 0), getUrl().toInetSocketAddress(), e.getMessage(), e);
    }
    return peer;
}
Also used : InetSocketAddress(java.net.InetSocketAddress) Peer(com.alibaba.dubbo.remoting.p2p.Peer) RemotingException(com.alibaba.dubbo.remoting.RemotingException) IOException(java.io.IOException)

Example 2 with Peer

use of com.alibaba.dubbo.remoting.p2p.Peer in project dubbo by alibaba.

the class MulticastGroup method join.

@Override
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Peer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}
Also used : Peer(com.alibaba.dubbo.remoting.p2p.Peer)

Aggregations

Peer (com.alibaba.dubbo.remoting.p2p.Peer)2 RemotingException (com.alibaba.dubbo.remoting.RemotingException)1 IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1