com.alibaba.dubbo.remoting.p2p.Peer Java Examples

The following examples show how to use com.alibaba.dubbo.remoting.p2p.Peer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileGroup.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: FileGroup.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
@Override
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;
}
 
Example #3
Source File: FileGroup.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: FileGroup.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #5
Source File: FileGroup.java    From dubbox with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #6
Source File: AbstractGroup.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Server server = servers.get(url);
    if (server == null) { // TODO 有并发间隙
        server = Transporters.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ServerPeer(server, clients, this);
}
 
Example #7
Source File: AbstractGroup.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Server server = servers.get(url);
    if (server == null) { // TODO 有并发间隙
        server = Transporters.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ServerPeer(server, clients, this);
}
 
Example #8
Source File: AbstractGroup.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Server server = servers.get(url);
    if (server == null) { // TODO 有并发间隙
        server = Transporters.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ServerPeer(server, clients, this);
}
 
Example #9
Source File: AbstractGroup.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Server server = servers.get(url);
    if (server == null) { // TODO 有并发间隙
        server = Transporters.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ServerPeer(server, clients, this);
}
 
Example #10
Source File: AbstractGroup.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Server server = servers.get(url);
    if (server == null) { // TODO exist concurrent gap
        server = Transporters.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ServerPeer(server, clients, this);
}
 
Example #11
Source File: AbstractExchangeGroup.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    return join(url, (ExchangeHandler) handler);
}
 
Example #12
Source File: MulticastGroup.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Override
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Peer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}
 
Example #13
Source File: AbstractExchangeGroup.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Override
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    return join(url, (ExchangeHandler) handler);
}
 
Example #14
Source File: AbstractExchangeGroup.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    return join(url, (ExchangeHandler) handler);
}
 
Example #15
Source File: MulticastGroup.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Peer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}
 
Example #16
Source File: MulticastGroup.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Peer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}
 
Example #17
Source File: AbstractExchangeGroup.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    return join(url, (ExchangeHandler) handler);
}
 
Example #18
Source File: AbstractExchangeGroup.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    return join(url, (ExchangeHandler) handler);
}
 
Example #19
Source File: MulticastGroup.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Peer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}
 
Example #20
Source File: MulticastGroup.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Override
public Peer join(URL url, ChannelHandler handler) throws RemotingException {
    Peer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}