From 10fa44e632dec82a2fb6100f2cc383f42a2f3113 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 02 Jul 2014 10:28:22 +0000
Subject: [PATCH] Code cleanup: - hid ReplicationDomain internals - moved test code out of production code - removed duplicated test code

---
 opends/src/server/org/opends/server/replication/service/ReplicationDomain.java |   63 ++-----------------------------
 1 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
index c17e470..06376f1 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -70,7 +70,7 @@
  *   The startup phase of the ReplicationDomain subclass,
  *   should read the list of replication servers from the configuration,
  *   instantiate a {@link ServerState} then start the publish service
- *   by calling {@link #startPublishService(ReplicationDomainCfg)}.
+ *   by calling {@link #startPublishService()}.
  *   At this point it can start calling the {@link #publish(UpdateMsg)}
  *   method if needed.
  * <p>
@@ -399,11 +399,7 @@
    */
   public ReplicationDomain(ReplicationDomainCfg config, long generationId)
   {
-    this.config = config;
-    this.assuredConfig = config;
-    this.generationId = generationId;
-    this.state = new ServerState();
-    this.generator = new CSNGenerator(getServerId(), state);
+    this(config, generationId, new ServerState());
   }
 
   /**
@@ -528,16 +524,6 @@
   }
 
   /**
-   * Returns the current config of this ReplicationDomain.
-   *
-   * @return the config
-   */
-  protected ReplicationDomainCfg getConfig()
-  {
-    return config;
-  }
-
-  /**
    * Returns the base DN of this ReplicationDomain. All Replication Domain using
    * this baseDN will be connected through the Replication Service.
    *
@@ -2967,13 +2953,10 @@
    * has been called, the publish service can be used by calling the
    * {@link #publish(UpdateMsg)} method.
    *
-   * @param config
-   *          The configuration that should be used.
    * @throws ConfigException
    *           If the DirectoryServer configuration was incorrect.
    */
-  public void startPublishService(ReplicationDomainCfg config)
-      throws ConfigException
+  public void startPublishService() throws ConfigException
   {
     synchronized (sessionLock)
     {
@@ -2994,7 +2977,7 @@
    * calling the {@link #processUpdate(UpdateMsg)}.
    * <p>
    * This method must be called once and must be called after the
-   * {@link #startPublishService(ReplicationDomainCfg)}.
+   * {@link #startPublishService()}.
    */
   public void startListenService()
   {
@@ -3104,7 +3087,7 @@
    * <p>
    * The Replication Service will restart from the point indicated by the
    * {@link ServerState} that was given as a parameter to the
-   * {@link #startPublishService(ReplicationDomainCfg)} at startup time.
+   * {@link #startPublishService()} at startup time.
    * <p>
    * If some data have changed in the repository during the period of time when
    * the Replication Service was disabled, this {@link ServerState} should
@@ -3459,42 +3442,6 @@
   }
 
   /**
-   * Publish information to the Replication Service (not assured mode).
-   *
-   * @param msg  The byte array containing the information that should
-   *             be sent to the remote entities.
-   */
-  void publish(byte[] msg)
-  {
-    UpdateMsg update;
-    synchronized (this)
-    {
-      update = new UpdateMsg(generator.newCSN(), msg);
-      /*
-      If assured replication is configured, this will prepare blocking
-      mechanism. If assured replication is disabled, this returns immediately
-      */
-      prepareWaitForAckIfAssuredEnabled(update);
-
-      publish(update);
-    }
-
-    try
-    {
-      /*
-      If assured replication is enabled, this will wait for the matching ack or
-      time out. If assured replication is disabled, this returns immediately
-      */
-      waitForAckIfAssuredEnabled(update);
-    } catch (TimeoutException ex)
-    {
-      // This exception may only be raised if assured replication is enabled
-      logError(NOTE_DS_ACK_TIMEOUT.get(getBaseDNString(),
-          Long.toString(getAssuredTimeout()), update.toString()));
-    }
-  }
-
-  /**
    * This method should return the generationID to use for this
    * ReplicationDomain.
    * This method can be called at any time after the ReplicationDomain

--
Gitblit v1.10.0