Project

General

Profile

« Previous | Next » 

Revision 3898

Added by Jing Tao almost 16 years ago

Check into cvs head. In handle replication list method, parser will be intialized every time when it handles a list from another server.

View differences:

src/edu/ucsb/nceas/metacat/ReplicationHandler.java
132 132
                                        // Server list
133 133
    String server = null; // Variable to store server name
134 134
    String update;
135
    ReplMessageHandler message = new ReplMessageHandler();
136 135
    Vector responses = new Vector();
137
    XMLReader parser;
138 136
    URL u;
139 137

  
140 138

  
141
    try
142
    {
143
      parser = initParser(message);
144
    }
145
    catch (Exception e)
146
    {
147
      MetacatReplication.replErrorLog("Failed to replicate becaue couldn't "+
148
                                 " initParser for message and" +e.getMessage());
149
      logMetacat.error("Failed to replicate becaue couldn't " +
150
                            " initParser for message and " +e.getMessage());
151
       // stop replication
152
       return;
153
    }
139
    
154 140
    //Check for every server in server list to get updated list and put
155 141
    // them in to response
156 142
    for (int i=0; i<serverList.size(); i++)
157 143
    {
144
    	
158 145
        // Get ReplicationServer object from server list
159 146
        replServer = serverList.serverAt(i);
160 147
        // Get server name from ReplicationServer object
......
209 196
    // go through response vector(it contains updated vector and delete vector
210 197
    for(int i=0; i<responses.size(); i++)
211 198
    {
199
    	XMLReader parser;
200
    	ReplMessageHandler message = new ReplMessageHandler();
201
    	try
202
        {
203
          parser = initParser(message);
204
        }
205
        catch (Exception e)
206
        {
207
          MetacatReplication.replErrorLog("Failed to replicate becaue couldn't "+
208
                                     " initParser for message and" +e.getMessage());
209
          logMetacat.error("Failed to replicate becaue couldn't " +
210
                                " initParser for message and " +e.getMessage());
211
           // stop replication
212
           return;
213
        }
214
    	
212 215
        try
213 216
        {
214 217
          parser.parse(new InputSource(
......
225 228
        }
226 229
        //v is the list of updated documents
227 230
        Vector updateList = new Vector(message.getUpdatesVect());
228
        MetacatReplication.replLog("The document list size is "+updateList.size());
231
        MetacatReplication.replLog("The document list size is "+updateList.size()+ " from "+message.getServerName());
229 232
        //System.out.println("v: " + v.toString());
230 233
        //d is the list of deleted documents
231 234
        Vector deleteList = new Vector(message.getDeletesVect());
232 235
        //System.out.println("d: " + d.toString());
233
        logMetacat.info("Update vector size: "+ updateList.size());
234
        logMetacat.info("Delete vector size: "+ deleteList.size());
235
        MetacatReplication.replLog("The delete document list size is "+deleteList.size());
236
        logMetacat.info("Update vector size: "+ updateList.size()+" from "+message.getServerName());
237
        logMetacat.info("Delete vector size: "+ deleteList.size()+" from "+message.getServerName());
238
        MetacatReplication.replLog("The delete document list size is "+deleteList.size()+" from "+message.getServerName());
236 239
        // go though every element in updated document vector
237 240
        handleDocList(updateList, DocumentImpl.DOCUMENTTABLE);
238 241
        //handle deleted docs
......
252 255
        
253 256
        // handle replicate doc in xml_revision
254 257
        Vector revisionList = new Vector(message.getRevisionsVect());
255
        MetacatReplication.replLog("The revision document list size is "+revisionList.size());
258
        MetacatReplication.replLog("The revision document list size is "+revisionList.size()+ " from "+message.getServerName());
259
        logMetacat.info("The revision document list size is "+revisionList.size()+ " from "+message.getServerName());
256 260
        handleDocList(revisionList, DocumentImpl.REVISIONTABLE);
257 261
        DOCINSERTNUMBER = 1;
258 262
        DOCERRORNUMBER  = 1;

Also available in: Unified diff