85 |
85 |
public static final String WAITIMEPOPERTYNAME = "index.regenerate.start.waitingtime";
|
86 |
86 |
public static final String MAXATTEMPTSPROPERTYNAME = "index.regenerate.start.maxattempts";
|
87 |
87 |
|
88 |
|
private static int waitingTime = WAITTIME;
|
89 |
|
private static int maxAttempts = MAXWAITNUMBER;
|
90 |
88 |
|
91 |
89 |
private SolrIndex solrIndex = null;
|
92 |
90 |
//private SystemMetadataEventListener systemMetadataListener = null;
|
... | ... | |
106 |
104 |
resourceMapNamespaces = Settings.getConfiguration().getList(RESOURCEMAPPROPERYNAME);
|
107 |
105 |
//this.systemMetadataListener = systemMetadataListener;
|
108 |
106 |
//this.mNode = new MNode(buildMNBaseURL());
|
109 |
|
try {
|
110 |
|
waitingTime = Settings.getConfiguration().getInt(WAITIMEPOPERTYNAME);
|
111 |
|
maxAttempts = Settings.getConfiguration().getInt(MAXATTEMPTSPROPERTYNAME);
|
112 |
|
} catch (Exception e) {
|
113 |
|
log.warn("IndexGenerator.constructor - couldn't read the waiting time or maxattempts from the metacat.properties file since : "+e.getMessage()+". Default values will be used");
|
114 |
|
waitingTime = WAITTIME;
|
115 |
|
maxAttempts = MAXWAITNUMBER;
|
116 |
|
}
|
|
107 |
|
117 |
108 |
}
|
118 |
109 |
|
119 |
110 |
/**
|
... | ... | |
720 |
711 |
int times = 0;
|
721 |
712 |
if(systemMetadataMap == null) {
|
722 |
713 |
systemMetadataMap = DistributedMapsFactory.getSystemMetadataMap();
|
723 |
|
/*while(true) {
|
724 |
|
try {
|
725 |
|
systemMetadataMap = DistributedMapsFactory.getSystemMetadataMap();
|
726 |
|
break;
|
727 |
|
} catch (FileNotFoundException e) {
|
728 |
|
throw e;
|
729 |
|
} catch (ServiceFailure e) {
|
730 |
|
if(times <= maxAttempts) {
|
731 |
|
log.warn("IndexGenerator.initSystemMetadataMap - the hazelcast service is not ready : "
|
732 |
|
+e.getMessage()+"\nWe will try to access it "+waitingTime/1000+" seconds later ");
|
733 |
|
try {
|
734 |
|
Thread.sleep(waitingTime);
|
735 |
|
} catch (Exception ee) {
|
736 |
|
log.warn("IndexGenerator.initSystemMetadataMap - the thread can't sleep for "+waitingTime/1000+" seconds to wait the hazelcast service");
|
737 |
|
}
|
738 |
|
|
739 |
|
} else {
|
740 |
|
throw new ServiceFailure("0000", "IndexGenerator.initSystemMetadataMap - the hazelcast service is not ready even though Metacat-index wailted for "+maxAttempts*waitingTime/1000+" seconds. We can't get the system metadata from it and the building index can't happen this time");
|
741 |
|
}
|
742 |
|
}
|
743 |
|
times++;
|
744 |
|
}*/
|
745 |
714 |
}
|
746 |
715 |
}
|
747 |
716 |
|
Clean up the code.