Project

General

Profile

« Previous | Next » 

Revision 6468

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

View differences:

CNodeService.java
145 145
    systemMetadata.setReplicationPolicy(policy);
146 146
    
147 147
    // update the metadata
148
    HazelcastService.getInstance().getSystemMetadataMap().lock(systemMetadata.getIdentifier());
149
    HazelcastService.getInstance().getSystemMetadataMap().put(systemMetadata.getIdentifier(), systemMetadata);
150
    HazelcastService.getInstance().getSystemMetadataMap().unlock(systemMetadata.getIdentifier());
151

  
148
    try {
149
	    HazelcastService.getInstance().getSystemMetadataMap().lock(systemMetadata.getIdentifier());
150
	    HazelcastService.getInstance().getSystemMetadataMap().put(systemMetadata.getIdentifier(), systemMetadata);
151
	    HazelcastService.getInstance().getSystemMetadataMap().unlock(systemMetadata.getIdentifier());
152
    } catch (Exception e) {
153
		throw new ServiceFailure("4882", e.getMessage());
154
	} finally {
155
	    HazelcastService.getInstance().getSystemMetadataMap().unlock(systemMetadata.getIdentifier());
156
	}
157
    
152 158
    return true;
153 159
  }
154 160

  
......
203 209
    systemMetadata.setReplicaList(replicas);
204 210
    
205 211
    // update the metadata
206
    HazelcastService.getInstance().getSystemMetadataMap().put(systemMetadata.getIdentifier(), systemMetadata);
207

  
212
    try {
213
	    HazelcastService.getInstance().getSystemMetadataMap().lock(systemMetadata.getIdentifier());
214
	    HazelcastService.getInstance().getSystemMetadataMap().put(systemMetadata.getIdentifier(), systemMetadata);
215
	    HazelcastService.getInstance().getSystemMetadataMap().unlock(systemMetadata.getIdentifier());
216
    } catch (Exception e) {
217
		throw new ServiceFailure("4700", e.getMessage());
218
	} finally {
219
	    HazelcastService.getInstance().getSystemMetadataMap().unlock(systemMetadata.getIdentifier());
220
	}
221
	
208 222
    return true;
209 223
  }
210 224

  
......
532 546
        sysmeta.setDateSysMetadataModified(new Date());
533 547
        try {
534 548
          HazelcastService.getInstance().getSystemMetadataMap().lock(sysmeta.getIdentifier());
535
        	HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
549
          HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
536 550
          HazelcastService.getInstance().getSystemMetadataMap().unlock(sysmeta.getIdentifier());
537
          
538 551
        } catch (Exception e) {
539 552
            throw new ServiceFailure("4862", "Error inserting system metadata: " + e.getClass() + ": " + e.getMessage());
540 553
        } finally {
......
596 609
        // update the system metadata into the object store
597 610
        logMetacat.debug("Starting to update SystemMetadata...");
598 611
        sysmeta.setDateSysMetadataModified(new Date());
599
        HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
600 612
        
613
        // update system metadata
614
        try {
615
    	    HazelcastService.getInstance().getSystemMetadataMap().lock(sysmeta.getIdentifier());
616
    	    HazelcastService.getInstance().getSystemMetadataMap().put(sysmeta.getIdentifier(), sysmeta);
617
    	    HazelcastService.getInstance().getSystemMetadataMap().unlock(sysmeta.getIdentifier());
618
        } catch (Exception e) {
619
    		throw new ServiceFailure("4852", e.getMessage());
620
    	} finally {
621
    	    HazelcastService.getInstance().getSystemMetadataMap().unlock(sysmeta.getIdentifier());
622
    	}
623
        
601 624
        logMetacat.debug("Returning from updateSystemMetadata");
602 625
        EventLog.getInstance().log(null, session.getSubject().getValue(), guid.getValue(), "updateSystemMetadata");
603 626
        return true;
......
713 736
    systemMetadata.setRightsHolder(userId);
714 737
    
715 738
    // update the metadata
716
    HazelcastService.getInstance().getSystemMetadataMap().put(systemMetadata.getIdentifier(), systemMetadata);
717

  
739
    try {
740
	    HazelcastService.getInstance().getSystemMetadataMap().lock(systemMetadata.getIdentifier());
741
	    HazelcastService.getInstance().getSystemMetadataMap().put(systemMetadata.getIdentifier(), systemMetadata);
742
	    HazelcastService.getInstance().getSystemMetadataMap().unlock(systemMetadata.getIdentifier());
743
    } catch (Exception e) {
744
		throw new ServiceFailure("4490", e.getMessage());
745
	} finally {
746
	    HazelcastService.getInstance().getSystemMetadataMap().unlock(systemMetadata.getIdentifier());
747
	}
748
    
718 749
    return pid;
719 750
  }
720 751

  
......
758 789
	      break;
759 790
	        
760 791
      }
761
	     //lock, get, and unlock the pid
792
	    //lock, get, and unlock the pid
762 793
	    HazelcastService.getInstance().getSystemMetadataMap().lock(pid);
763
      sysmeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
764
      HazelcastService.getInstance().getSystemMetadataMap().unlock(pid);
794
	    sysmeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
795
	    HazelcastService.getInstance().getSystemMetadataMap().unlock(pid);
765 796
	    List<Replica> replicaList = sysmeta.getReplicaList();
766 797
	    
767 798
	    // find the replica with the status set to 'requested'

Also available in: Unified diff