Mercurial > lbo > hg > clusterrpc-java
view src/main/java/net/borgac/clusterrpc/client/GlobalContextProvider.java @ 6:0e608c466a58
Implement ClientChannel/SocketWrapper and add logging and tests
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 24 Sep 2016 16:42:13 +0200 |
parents | 117cb812e28a |
children |
line wrap: on
line source
package net.borgac.clusterrpc.client; import org.zeromq.ZMQ; /** * Provides access to the single ZeroMQ context that is shared. by all sockets. * * @author lbo */ final class GlobalContextProvider { private static final ZMQ.Context context = ZMQ.context(1); static ZMQ.Socket socket(int type) { return context.socket(type); } static ZMQ.Socket clientSocket() { // We need to do everything ourselves, as JeroMQ doesn't yet support // all features used by clusterrpc servers. ZMQ.Socket sock = socket(ZMQ.DEALER); // Missing against original implementation: // Immediate = false // Relaxed = 1 // ReqCorrelate = 1 sock.setIPv4Only(false); sock.setLinger(0); sock.setSendTimeOut(10_000); sock.setReceiveTimeOut(10_000); sock.setReconnectIVL(100); return sock; } }