Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
Do the connection whith HWM for send is set without limit to avoid pr…
Browse files Browse the repository at this point in the history
…oblem due to the buffer size when connect to server for large number of attributes
  • Loading branch information
Pascal-Verdier committed Nov 12, 2019
1 parent 1ab7008 commit b00043a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions dao/src/main/java/fr/esrf/TangoApi/events/ZmqMainThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ public class ZmqMainThread extends Thread {

private static final long SendHwmSocket = 10000;
//===============================================================
private class ZmqPollers extends ZMQ.Poller {
//===============================================================
private static class ZmqPollers extends ZMQ.Poller {
private ZmqPollers(ZMQ.Context context, int size) {
super(context, size);
}
}
//===============================================================
//===============================================================
/**
* Default constructor
* @param context ZMQ context instance
Expand Down Expand Up @@ -667,19 +667,20 @@ private void connectIfNotDone(ZMQ.Socket socket, ZMQutils.ControlStructure contr
// Check if it ia a reconnection -> disconnect before connection
if (controlStructure.forceReconnection && alreadyConnected(controlStructure.endPoint)) {
try {
// needs an un subscribe before disconnection
//socket.unsubscribe(controlStructure.eventName.getBytes());
socket.disconnect(controlStructure.endPoint);
}
catch (org.zeromq.ZMQException e) {
System.err.println(e.getMessage());
}
}

// Do the connection
//System.out.println("Connect on " + controlStructure.endPoint);
//System.out.println(" for " + controlStructure.eventName);
socket.setHWM(controlStructure.hwm);

// Do the connection (HWM for send is set without limit
// to avoid problem due to the buffer size when connect
// to server for large number of attributes)
socket.setSndHWM(0);
socket.setRcvHWM(controlStructure.hwm);
socket.connect(controlStructure.endPoint);
if (!alreadyConnected(controlStructure.endPoint)) {
EventList eventList = new EventList();
Expand Down Expand Up @@ -763,11 +764,9 @@ private static String formatTime(long ms)

return time + "." + ms;
}


//===============================================================
//===============================================================
private class EventList extends ArrayList<String> {
private static class EventList extends ArrayList<String> {
private String getEvent(String eventName) {
for (String event : this) {
if (event.equals(eventName)) {
Expand Down

0 comments on commit b00043a

Please sign in to comment.