Project

General

Profile

« Previous | Next » 

Revision 2649

Added by Jing Tao about 19 years ago

Fixed a bug if one server failed in replication, it will cause another server failed.

View differences:

src/edu/ucsb/nceas/metacat/ForceReplicationHandler.java
143 143
  public void run()
144 144
  {
145 145

  
146
    try
147
    {
146
    
148 147
      // URL for notifcation
149 148
      URL comeAndGetIt = null;
150 149
      // If no server in xml_replication table, metacat don't need do anything
......
157 156
      // into the database before we send force replication request
158 157
      int sleepTime = Integer.parseInt
159 158
                         (MetaCatUtil.getOption("forcereplicationwaitingtime"));
160
      Thread.sleep(sleepTime);
159
      try
160
      {
161
        Thread.sleep(sleepTime);
162
      }
163
      catch(Exception ee)
164
      {
165
        MetaCatUtil.debugMessage("Couldn't sleep in force replication", 20);
166
      }
161 167
      MetaCatUtil.debugMessage("notification server:"+notificationServer, 34);
162 168
      // Check every server in the serverlists
163 169
      for (int i=0; i<serverLists.size(); i++)
164 170
      {
165 171
        //Set comeAndGetIt null
166 172
        comeAndGetIt = null;
167
        // Get ReplicationServer object in index i
173
         // Get ReplicationServer object in index i
168 174
        ReplicationServer replicationServer = serverLists.serverAt(i);
169
       // Get this ReplicationServer 's name
175
        // Get this ReplicationServer 's name
170 176
        String server = replicationServer.getServerName();
177
        try
178
        {
179
        
171 180

  
172 181
        // If the server is the notification server, we don't notify it back
173 182
        // again, if server is null we don't replication it
......
341 350
          //send out the url.  message is a dummy variable as the target of
342 351
          //the URL never directly replies to the request.  this simply
343 352
          //invoces a read request from the server to this local machine.
344
        }//if notification server
353
         }//if notification server
354
        }
355
        catch (Exception ee)
356
        {
357
            MetaCatUtil.debugMessage("error in ForceReplicationHandler.run for server " 
358
                    + server +" "+ee.getMessage(), 20);
359
             ee.printStackTrace();
360
        }
345 361
      }//for
346 362

  
347
    }//try
348
    catch(Exception e)
349
    {
350
      System.out.println("error in ForceReplicationHandler.run: " +
351
                          e.getMessage());
352
      e.printStackTrace(System.out);
353
    }
354
    MetaCatUtil.debugMessage("exiting ForceReplicationHandler Thread", 25);
363
   
364
      MetaCatUtil.debugMessage("exiting ForceReplicationHandler Thread", 25);
355 365
  }//run
356 366
}//ForceReplication class

Also available in: Unified diff