Project

General

Profile

« Previous | Next » 

Revision 6888

Added by Chris Jones over 12 years ago

When loading all keys from Metacat into the hzSystemMetadata map, also load identifiers into the hzIdentifiers set if they are not already there. Although entries may be evicted from the map, the list of identifiers will remain. The list will have a fairly small memory footprint since it's just identifiers.

View differences:

SystemMetadataMap.java
2 2

  
3 3
import java.util.Collection;
4 4
import java.util.HashMap;
5
import java.util.HashSet;
6 5
import java.util.Map;
7 6
import java.util.Set;
8 7

  
......
12 11
import org.dataone.service.types.v1.ObjectList;
13 12
import org.dataone.service.types.v1.SystemMetadata;
14 13

  
14
import com.hazelcast.core.Hazelcast;
15 15
import com.hazelcast.core.MapLoader;
16 16
import com.hazelcast.core.MapStore;
17 17

  
18 18
import edu.ucsb.nceas.metacat.IdentifierManager;
19 19
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
20
import edu.ucsb.nceas.metacat.dataone.CNodeService;
20
import edu.ucsb.nceas.metacat.properties.PropertyService;
21
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
21 22

  
22 23
/**
23 24
 * Storage implementation for Hazelcast System Metadata
......
91 92

  
92 93
	@Override
93 94
	public Set<Identifier> loadAllKeys() {
94
		Set<Identifier> pids = new HashSet<Identifier>();
95
	  
96
	    //Set<Identifier> pids = new HashSet<Identifier>();
97
	  String identifiersSet;
98
    try {
99
        identifiersSet = 
100
            PropertyService.getProperty("dataone.hazelcast.storageCluster.identifiersSet");
101
        
102
    } catch (PropertyNotFoundException e1) {
103
        identifiersSet = "hzIdentifiers";
104
        
105
    }
106
    Set<Identifier> pids = Hazelcast.getSet(identifiersSet);
107
		
95 108
		try {
96 109
			ObjectList ol = IdentifierManager.getInstance().querySystemMetadata(
97 110
					null, //startTime, 
......
103 116
					);
104 117
			for (ObjectInfo o: ol.getObjectInfoList()) {
105 118
				Identifier pid = o.getIdentifier();
106
				pids.add(pid);
119
				if ( !pids.contains(pid) ) {
120
		        pids.add(pid);
121
		        
122
				}				
107 123
			}
124
			
108 125
		} catch (Exception e) {
109 126
			throw new RuntimeException(e.getMessage(), e);
127
			
110 128
		}
111 129
		
112 130
		return pids;

Also available in: Unified diff