Project

General

Profile

« Previous | Next » 

Revision 6489

use default hazelcast config when not configured to use an external one

View differences:

src/edu/ucsb/nceas/metacat/dataone/hazelcast/HazelcastService.java
26 26

  
27 27
package edu.ucsb.nceas.metacat.dataone.hazelcast;
28 28

  
29
import java.io.FileNotFoundException;
29 30
import java.util.Collection;
30 31
import java.util.Date;
31 32

  
......
57 58
import edu.ucsb.nceas.metacat.properties.PropertyService;
58 59
import edu.ucsb.nceas.metacat.shared.BaseService;
59 60
import edu.ucsb.nceas.metacat.shared.ServiceException;
61
import edu.ucsb.nceas.utilities.FileUtil;
60 62
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
61 63
/**
62 64
 * The Hazelcast service enables Metacat as a Hazelcast cluster member
......
145 147
    
146 148
    logMetacat.debug("HazelcastService.doRefresh() called.");
147 149
    
148
    try {
149
    	String configFileName = PropertyService.getProperty("dataone.hazelcast.configFilePath");
150
//    	System.setProperty("hazelcast.config", configFileName);
151
		Config config = new FileSystemXmlConfig(configFileName);
152
		Hazelcast.init(config);
153
    } catch (Exception e) {
154
      String msg = e.getMessage();
155
      logMetacat.error(msg);
156
      throw new ServiceException(msg);
157
    }
150
	String configFileName = null;
151
	Config config = null;
152
	try {
153
		configFileName = PropertyService.getProperty("dataone.hazelcast.configFilePath");
154
		config = new FileSystemXmlConfig(configFileName);
155
	} catch (Exception e) {
156
		logMetacat.warn("Custom Hazelcast configuration not defined, using default.", e);
157
		configFileName = PropertyService.CONFIG_FILE_DIR + FileUtil.getFS() + "hazelcast.xml";
158
		// make sure we have the config
159
		try {
160
			config = new FileSystemXmlConfig(configFileName);
161
		} catch (FileNotFoundException e1) {
162
			String msg = e.getMessage();
163
			logMetacat.error(msg);
164
			throw new ServiceException(msg);
165
		}
166
	}
167

  
168
	Hazelcast.init(config);
158 169
    
159 170
    // Get configuration properties on instantiation
160 171
    try {

Also available in: Unified diff