| | |
| | | import static org.opends.server.synchronization.common.LogMessages.*; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.TreeSet; |
| | | import java.util.concurrent.Semaphore; |
| | | import java.io.IOException; |
| | |
| | | public class ChangelogBroker implements InternalSearchListener |
| | | { |
| | | private boolean shutdown = false; |
| | | private List<String> servers; |
| | | private Collection<String> servers; |
| | | private boolean connected = false; |
| | | private final Object lock = new Object(); |
| | | private String changelogServer = "Not connected"; |
| | |
| | | * @param servers list of servers used |
| | | * @throws Exception : in case of errors |
| | | */ |
| | | public void start(List<String> servers) |
| | | public void start(Collection<String> servers) |
| | | throws Exception |
| | | { |
| | | /* |
| | |
| | | try |
| | | { |
| | | SynchronizationMessage msg = session.receive(); |
| | | |
| | | if (msg instanceof WindowMessage) |
| | | { |
| | | WindowMessage windowMsg = (WindowMessage) msg; |
| | |
| | | debugInfo("ChangelogBroker Stop Closing session"); |
| | | } |
| | | |
| | | session.close(); |
| | | if (session != null) |
| | | session.close(); |
| | | } catch (IOException e) |
| | | {} |
| | | } |
| | |
| | | return numLostConnections; |
| | | } |
| | | |
| | | private void log(String message) |
| | | |
| | | /** |
| | | * Change some config parameters. |
| | | * |
| | | * @param changelogServers The new list of changelog servers. |
| | | * @param maxReceiveQueue The max size of receive queue. |
| | | * @param maxReceiveDelay The max receive delay. |
| | | * @param maxSendQueue The max send queue. |
| | | * @param maxSendDelay The max Send Delay. |
| | | * @param window The max window size. |
| | | * @param heartbeatInterval The heartbeat interval. |
| | | */ |
| | | public void changeConfig(Collection<String> changelogServers, |
| | | int maxReceiveQueue, int maxReceiveDelay, int maxSendQueue, |
| | | int maxSendDelay, int window, long heartbeatInterval) |
| | | { |
| | | int msgID = MSGID_UNKNOWN_TYPE; |
| | | logError(ErrorLogCategory.SYNCHRONIZATION, |
| | | ErrorLogSeverity.SEVERE_ERROR, |
| | | message, msgID); |
| | | this.servers = changelogServers; |
| | | this.maxRcvWindow = window; |
| | | this.heartbeatInterval = heartbeatInterval; |
| | | this.maxReceiveDelay = maxReceiveDelay; |
| | | this.maxReceiveQueue = maxReceiveQueue; |
| | | this.maxSendDelay = maxSendDelay; |
| | | this.maxSendQueue = maxSendQueue; |
| | | // TODO : Changing those parameters requires to either restart a new |
| | | // session with the changelog server or renegociate the parameters that |
| | | // were sent in the ServerStart message |
| | | } |
| | | } |