com.alibaba.dubbo.remoting.p2p.exchange.ExchangePeer Java Examples

The following examples show how to use com.alibaba.dubbo.remoting.p2p.exchange.ExchangePeer. 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: FileExchangeGroup.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
public ExchangePeer joinExchange(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer 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: FileExchangeGroup.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public ExchangePeer joinExchange(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer 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: FileExchangeGroup.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
public ExchangePeer joinExchange(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer 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: FileExchangeGroup.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public ExchangePeer joinExchange(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer 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: FileExchangeGroup.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public ExchangePeer joinExchange(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer 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: AbstractExchangeGroup.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangeServer server = servers.get(url);
    if (server == null) { // TODO exist concurrent gap
        server = Exchangers.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ExchangeServerPeer(server, clients, this);
}
 
Example #7
Source File: AbstractExchangeGroup.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangeServer server = servers.get(url);
    if (server == null) { // TODO 有并发间隙
        server = Exchangers.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ExchangeServerPeer(server, clients, this);
}
 
Example #8
Source File: AbstractExchangeGroup.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangeServer server = servers.get(url);
    if (server == null) { // TODO 有并发间隙
        server = Exchangers.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ExchangeServerPeer(server, clients, this);
}
 
Example #9
Source File: AbstractExchangeGroup.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangeServer server = servers.get(url);
    if (server == null) { // TODO 有并发间隙
        server = Exchangers.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ExchangeServerPeer(server, clients, this);
}
 
Example #10
Source File: AbstractExchangeGroup.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangeServer server = servers.get(url);
    if (server == null) { // TODO 有并发间隙
        server = Exchangers.bind(url, handler);
        servers.put(url, server);
        dispatcher.addChannelHandler(handler);
    }
    return new ExchangeServerPeer(server, clients, this);
}
 
Example #11
Source File: MulticastExchangeGroup.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
@Override
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}
 
Example #12
Source File: MulticastExchangeGroup.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}
 
Example #13
Source File: MulticastExchangeGroup.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
@Override
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}
 
Example #14
Source File: MulticastExchangeGroup.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}
 
Example #15
Source File: MulticastExchangeGroup.java    From dubbox with Apache License 2.0 4 votes vote down vote up
@Override
public ExchangePeer join(URL url, ExchangeHandler handler) throws RemotingException {
    ExchangePeer peer = super.join(url, handler);
    send(JOIN + " " + url.toFullString());
    return peer;
}