Project

General

Profile

« Previous | Next » 

Revision 6468

catch runtime exceptions that arise from hazelcast storage errors in the system metadata map

View differences:

D1NodeService.java
242 242
    }
243 243

  
244 244
    // save the sysmeta
245
    HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
245
    try {
246
    	HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
247
    } catch (Exception e) {
248
        throw new ServiceFailure("1190", e.getMessage());
249
	}
246 250
    
247 251
    // setting the resulting identifier failed
248 252
    if (localId == null ) {
249 253
      throw new ServiceFailure("1190", "The Node is unable to create the object. ");
250 254
    }
251 255

  
252
    
253 256
    resultPid = pid;
254 257
    
255 258
    return resultPid;
......
551 554
    systemMetadata.setAccessPolicy(accessPolicy);
552 555
    
553 556
    // update the metadata
554
    HazelcastService.getInstance().getSystemMetadataMap().put(systemMetadata.getIdentifier(), systemMetadata);
555

  
557
    try {
558
    	HazelcastService.getInstance().getSystemMetadataMap().lock(systemMetadata.getIdentifier());
559
    	HazelcastService.getInstance().getSystemMetadataMap().put(systemMetadata.getIdentifier(), systemMetadata);
560
    	HazelcastService.getInstance().getSystemMetadataMap().unlock(systemMetadata.getIdentifier());
561
	} catch (Exception e) {
562
		throw new ServiceFailure("4430", e.getMessage());
563
	} finally {
564
		HazelcastService.getInstance().getSystemMetadataMap().unlock(systemMetadata.getIdentifier());
565
	}
566
    
556 567
    // TODO: how do we know if the map was persisted?
557 568
    success = true;
558 569
    
......
941 952
        sysmeta.getDateSysMetadataModified());
942 953

  
943 954
    //insert the system metadata
944
    HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
945
      
955
    try {
956
    	HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
957
    } catch (Exception e) {
958
        throw new ServiceFailure("1190", e.getMessage());
959
	}  
946 960
  }
947 961

  
948 962
  /**
......
955 969
      
956 970
    logMetacat.debug("D1NodeService.updateSystemMetadata() called.");
957 971
    sysMeta.setDateSysMetadataModified(new Date());
958
    HazelcastService.getInstance().getSystemMetadataMap().put(sysMeta.getIdentifier(), sysMeta);
972
    try {
973
    	HazelcastService.getInstance().getSystemMetadataMap().lock(sysMeta.getIdentifier());
974
    	HazelcastService.getInstance().getSystemMetadataMap().put(sysMeta.getIdentifier(), sysMeta);
975
    	HazelcastService.getInstance().getSystemMetadataMap().unlock(sysMeta.getIdentifier());
976
	} catch (Exception e) {
977
		throw new ServiceFailure("4862", e.getMessage());
978
	} finally {
979
		HazelcastService.getInstance().getSystemMetadataMap().unlock(sysMeta.getIdentifier());
980
	}
959 981
      
960 982
  }
961 983

  

Also available in: Unified diff