public void initializeLocation() { if (this.getStorageUri() != null) { switch (this.getLocationMode()) { case PRIMARY_ONLY: case PRIMARY_THEN_SECONDARY: this.setCurrentLocation(StorageLocation.PRIMARY); break; case SECONDARY_ONLY: case SECONDARY_THEN_PRIMARY: this.setCurrentLocation(StorageLocation.SECONDARY); break; default: throw new IllegalArgumentException(String.format(SR.ARGUMENT_OUT_OF_RANGE_ERROR, "locationMode", this.getLocationMode())); } } else { this.setCurrentLocation(StorageLocation.PRIMARY); } }
public void initializeLocation() { if (this.getStorageUri() != null) { switch (this.getLocationMode()) { case PRIMARY_ONLY: case PRIMARY_THEN_SECONDARY: this.setCurrentLocation(StorageLocation.PRIMARY); break; case SECONDARY_ONLY: case SECONDARY_THEN_PRIMARY: this.setCurrentLocation(StorageLocation.SECONDARY); break; default: throw new IllegalArgumentException(String.format(SR.ARGUMENT_OUT_OF_RANGE_ERROR, "locationMode", this.getLocationMode())); } } else { this.setCurrentLocation(StorageLocation.PRIMARY); } }
@SuppressWarnings("incomplete-switch") public void validateLocation() { if (this.getStorageUri() != null) { if (!this.getStorageUri().validateLocationMode(this.locationMode)) { throw new UnsupportedOperationException(SR.STORAGE_URI_MISSING_LOCATION); } } // If the command only allows for a specific location, we should target // that location no matter what the retry policy says. switch (this.getRequestLocationMode()) { case PRIMARY_ONLY: if (this.getLocationMode() == LocationMode.SECONDARY_ONLY) { throw new IllegalArgumentException(SR.PRIMARY_ONLY_COMMAND); } this.setCurrentLocation(StorageLocation.PRIMARY); this.setLocationMode(LocationMode.PRIMARY_ONLY); break; case SECONDARY_ONLY: if (this.getLocationMode() == LocationMode.PRIMARY_ONLY) { throw new IllegalArgumentException(SR.SECONDARY_ONLY_COMMAND); } this.setCurrentLocation(StorageLocation.SECONDARY); this.setLocationMode(LocationMode.SECONDARY_ONLY); break; } this.getResult().setTargetLocation(this.currentLocation); }
@SuppressWarnings("incomplete-switch") public void validateLocation() { if (this.getStorageUri() != null) { if (!this.getStorageUri().validateLocationMode(this.locationMode)) { throw new UnsupportedOperationException(SR.STORAGE_URI_MISSING_LOCATION); } } // If the command only allows for a specific location, we should target // that location no matter what the retry policy says. switch (this.getRequestLocationMode()) { case PRIMARY_ONLY: if (this.getLocationMode() == LocationMode.SECONDARY_ONLY) { throw new IllegalArgumentException(SR.PRIMARY_ONLY_COMMAND); } this.setCurrentLocation(StorageLocation.PRIMARY); this.setLocationMode(LocationMode.PRIMARY_ONLY); break; case SECONDARY_ONLY: if (this.getLocationMode() == LocationMode.PRIMARY_ONLY) { throw new IllegalArgumentException(SR.SECONDARY_ONLY_COMMAND); } this.setCurrentLocation(StorageLocation.SECONDARY); this.setLocationMode(LocationMode.SECONDARY_ONLY); break; } this.getResult().setTargetLocation(this.currentLocation); }
Logger.info(opContext, LogConstants.INIT_LOCATION, task.getCurrentLocation(), task.getLocationMode());
Logger.info(opContext, LogConstants.INIT_LOCATION, task.getCurrentLocation(), task.getLocationMode());
translatedException == null ? null : translatedException.getMessage()); task.setCurrentLocation(getNextLocation(task.getCurrentLocation(), task.getLocationMode())); Logger.info(opContext, LogConstants.NEXT_LOCATION, task.getCurrentLocation(), task.getLocationMode()); task.getCurrentLocation(), task.getLocationMode()); Logger.info(opContext, LogConstants.RETRY_INFO, task.getCurrentLocation(), task.getLocationMode());
translatedException == null ? null : translatedException.getMessage()); task.setCurrentLocation(getNextLocation(task.getCurrentLocation(), task.getLocationMode())); Logger.info(opContext, LogConstants.NEXT_LOCATION, task.getCurrentLocation(), task.getLocationMode()); task.getCurrentLocation(), task.getLocationMode()); Logger.info(opContext, LogConstants.RETRY_INFO, task.getCurrentLocation(), task.getLocationMode());