Project

General

Profile

« Previous | Next » 

Revision 6692

make sure to get/put system metadata to the HZ map instead of using IdentifierManager directly
verified changes for: https://redmine.dataone.org/issues/1999

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
27 27
import java.io.InputStream;
28 28
import java.security.NoSuchAlgorithmException;
29 29
import java.sql.SQLException;
30
import java.util.ArrayList;
31 30
import java.util.Calendar;
32 31
import java.util.Date;
33 32
import java.util.List;
......
84 83
import org.dataone.service.types.v1.Services;
85 84
import org.dataone.service.types.v1.Session;
86 85
import org.dataone.service.types.v1.Subject;
87
import org.dataone.service.types.v1.SubjectList;
88 86
import org.dataone.service.types.v1.Synchronization;
89 87
import org.dataone.service.types.v1.SystemMetadata;
90 88
import org.dataone.service.types.v1.util.ChecksumUtil;
......
856 854
                Date logDate = logEntry.getDateLogged();
857 855
                // if we are filtering by format
858 856
                if (formatId != null) {
859
                    SystemMetadata sysmeta = IdentifierManager.getInstance().getSystemMetadata(pid.getValue());
857
                    SystemMetadata sysmeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
860 858
                    if (!sysmeta.getFormatId().getValue().equals(formatId.getValue())) {
861 859
                        // does not match
862 860
                        continue;
......
1100 1098
        
1101 1099
        // compare what we have locally to what is sent in the change notification
1102 1100
        try {
1103
            currentLocalSysMeta = 
1104
                IdentifierManager.getInstance().getSystemMetadata(pid.getValue());
1105
        
1106
        } catch (McdbDocNotFoundException e) {
1101
            currentLocalSysMeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
1102
             
1103
        } catch (RuntimeException e) {
1107 1104
            String msg = "SystemMetadata for pid " + pid.getValue() +
1108
              " cpouldn't be updated because it couldn't be found locally: " +
1105
              " couldn't be updated because it couldn't be found locally: " +
1109 1106
              e.getMessage();
1110
            logMetacat.warn(msg);
1111
            
1107
            logMetacat.error(msg);
1108
            ServiceFailure sf = new ServiceFailure("1333", msg);
1109
            sf.initCause(e);
1110
            throw sf; 
1112 1111
        }
1113 1112
        
1114 1113
        if (currentLocalSysMeta.getSerialVersion().longValue() < serialVersion ) {
......
1116 1115
                newSysMeta = cn.getSystemMetadata(null, pid);
1117 1116
            } catch (NotFound e) {
1118 1117
                // huh? you just said you had it
1119
                logMetacat.error("On updating the local copy of system metadata " + 
1120
                    "for pid " + pid.getValue() +", the CN reports it is not found." +
1121
                    " The error message was: " + e.getMessage());
1122
                
1118
            	String msg = "On updating the local copy of system metadata " + 
1119
                "for pid " + pid.getValue() +", the CN reports it is not found." +
1120
                " The error message was: " + e.getMessage();
1121
                logMetacat.error(msg);
1122
                ServiceFailure sf = new ServiceFailure("1333", msg);
1123
                sf.initCause(e);
1124
                throw sf;
1123 1125
            }
1126
            
1124 1127
            // update the local copy of system metadata for the pid
1125 1128
            try {
1126
                IdentifierManager.getInstance().updateSystemMetadata(newSysMeta);
1129
                HazelcastService.getInstance().getSystemMetadataMap().put(newSysMeta.getIdentifier(), newSysMeta);
1127 1130
                logMetacat.info("Updated local copy of system metadata for pid " +
1128 1131
                    pid.getValue() + " after change notification from the CN.");
1129 1132
                
1130
            } catch (McdbDocNotFoundException e) {
1133
            } catch (RuntimeException e) {
1131 1134
                String msg = "SystemMetadata for pid " + pid.getValue() +
1132
                  " cpouldn't be updated because it couldn't be found: " +
1135
                  " couldn't be updated: " +
1133 1136
                  e.getMessage();
1134
                logMetacat.warn(msg);
1135
                
1137
                logMetacat.error(msg);
1138
                ServiceFailure sf = new ServiceFailure("1333", msg);
1139
                sf.initCause(e);
1140
                throw sf;
1136 1141
            }
1137 1142
        }
1138 1143
        

Also available in: Unified diff