Project

General

Profile

« Previous | Next » 

Revision 6430

add code to handle new entry when it is not on the local member of the sysmeta cluster

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
66 66
import com.hazelcast.core.Hazelcast;
67 67
import com.hazelcast.core.IMap;
68 68
import com.hazelcast.core.IQueue;
69
import com.hazelcast.core.Member;
70
import com.hazelcast.partition.Partition;
71
import com.hazelcast.partition.PartitionService;
69 72
import com.hazelcast.query.SqlPredicate;
70 73

  
71 74
import edu.ucsb.nceas.metacat.EventLog;
......
880 883
  @Override
881 884
  public void entryAdded(EntryEvent<Identifier, SystemMetadata> event) {
882 885

  
886
	  logMetacat.debug("Entry added to System Metadata map: " + event.getKey().getValue());
887
	  PartitionService partitionService = Hazelcast.getPartitionService();
888
	  Partition partition = partitionService.getPartition(event.getKey());
889
	  Member ownerMember = partition.getOwner();
890
	  if (!ownerMember.localMember()) {
891
		  // need to pull the entry into the local store
892
		  logMetacat.debug("Saving entry locally: " + event.getKey().getValue());
893
		  try {
894
			IdentifierManager.getInstance().createSystemMetadata(event.getValue());
895
		} catch (McdbDocNotFoundException e) {
896
			// TODO Auto-generated catch block
897
			e.printStackTrace();
898
		}
899
	  }
900
	  
883 901
    // TODO evaluate the type of system metadata change, decide if it warrants
884 902
    // a replication event, what type (DATA, METADATA, RESOURCE), 
885 903
    // iteratively lock the PID, create and submit the tasks, and expect a result back. 

Also available in: Unified diff