Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ protected DbVolume(Builder b) throws IOException {
}

@Override
protected void initialize() throws IOException {
super.initialize();
protected void initializeImpl() throws IOException {
super.initializeImpl();
scanForDbStorePaths();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ private void initializeVolumeSet() throws IOException {
}

for (String locationString : rawLocations) {
StorageVolume volume = null;
try {
StorageLocation location = StorageLocation.parse(locationString);

StorageVolume volume = volumeFactory.createVolume(
volume = volumeFactory.createVolume(
location.getUri().getPath(), location.getStorageType());

LOG.info("Added Volume : {} to VolumeSet",
Expand All @@ -183,8 +184,11 @@ private void initializeVolumeSet() throws IOException {
volumeMap.put(volume.getStorageDir().getPath(), volume);
volumeStateMap.get(volume.getStorageType()).add(volume);
} catch (IOException e) {
StorageVolume volume =
volumeFactory.createFailedVolume(locationString);
if (volume != null) {
volume.shutdown();
}

volume = volumeFactory.createFailedVolume(locationString);
failedVolumeMap.put(locationString, volume);
LOG.error("Failed to parse the storage location: " + locationString, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,16 @@ public void format(String cid) throws IOException {
* otherwise returns with IOException.
* @throws IOException
*/
protected void initialize() throws IOException {
protected final void initialize() throws IOException {
try {
initializeImpl();
} catch (Exception e) {
shutdown();
throw e;
}
}

protected void initializeImpl() throws IOException {
VolumeState intialVolumeState = analyzeVolumeState();
switch (intialVolumeState) {
case NON_EXISTENT:
Expand Down