multicastSocket should be volatile as well...

This commit is contained in:
Shay Banon 2013-03-19 10:23:39 +01:00
parent c92207f483
commit f4a212420b
1 changed files with 2 additions and 17 deletions

View File

@ -62,44 +62,29 @@ public class MulticastZenPing extends AbstractLifecycleComponent<ZenPing> implem
private static final byte[] INTERNAL_HEADER = new byte[]{1, 9, 8, 4}; private static final byte[] INTERNAL_HEADER = new byte[]{1, 9, 8, 4};
private final String address; private final String address;
private final int port; private final int port;
private final String group; private final String group;
private final int bufferSize; private final int bufferSize;
private final int ttl; private final int ttl;
private final ThreadPool threadPool; private final ThreadPool threadPool;
private final TransportService transportService; private final TransportService transportService;
private final ClusterName clusterName; private final ClusterName clusterName;
private final NetworkService networkService; private final NetworkService networkService;
private volatile DiscoveryNodesProvider nodesProvider;
private final boolean pingEnabled; private final boolean pingEnabled;
private volatile DiscoveryNodesProvider nodesProvider;
private volatile Receiver receiver; private volatile Receiver receiver;
private volatile Thread receiverThread; private volatile Thread receiverThread;
private volatile MulticastSocket multicastSocket;
private MulticastSocket multicastSocket;
private DatagramPacket datagramPacketSend; private DatagramPacket datagramPacketSend;
private DatagramPacket datagramPacketReceive; private DatagramPacket datagramPacketReceive;
private final AtomicInteger pingIdGenerator = new AtomicInteger(); private final AtomicInteger pingIdGenerator = new AtomicInteger();
private final Map<Integer, ConcurrentMap<DiscoveryNode, PingResponse>> receivedResponses = newConcurrentMap(); private final Map<Integer, ConcurrentMap<DiscoveryNode, PingResponse>> receivedResponses = newConcurrentMap();
private final Object sendMutex = new Object(); private final Object sendMutex = new Object();
private final Object receiveMutex = new Object(); private final Object receiveMutex = new Object();
public MulticastZenPing(ThreadPool threadPool, TransportService transportService, ClusterName clusterName) { public MulticastZenPing(ThreadPool threadPool, TransportService transportService, ClusterName clusterName) {