Let AzurePersistence set default request timeouts
*/
package org.apache.jackrabbit.oak.segment.azure;
-import com.microsoft.azure.storage.*;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.Paths;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.concurrent.TimeUnit;
+
+import com.microsoft.azure.storage.OperationContext;
+import com.microsoft.azure.storage.RequestCompletedEvent;
+import com.microsoft.azure.storage.StorageEvent;
+import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.blob.BlobListingDetails;
+import com.microsoft.azure.storage.blob.BlobRequestOptions;
import com.microsoft.azure.storage.blob.CloudAppendBlob;
import com.microsoft.azure.storage.blob.CloudBlobDirectory;
import com.microsoft.azure.storage.blob.CloudBlockBlob;
import com.microsoft.azure.storage.blob.ListBlobItem;
+import org.apache.jackrabbit.oak.segment.spi.monitor.FileStoreMonitor;
+import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitor;
import org.apache.jackrabbit.oak.segment.spi.monitor.RemoteStoreMonitor;
import org.apache.jackrabbit.oak.segment.spi.persistence.GCJournalFile;
import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFile;
@@ -29,26 +42,25 @@ import org.apache.jackrabbit.oak.segment.spi.persistence.ManifestFile;
import org.apache.jackrabbit.oak.segment.spi.persistence.RepositoryLock;
import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveManager;
import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentNodeStorePersistence;
-import org.apache.jackrabbit.oak.segment.spi.monitor.FileStoreMonitor;
-import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.nio.file.Paths;
-import java.util.Date;
-import java.util.EnumSet;
-import java.util.concurrent.TimeUnit;
-
public class AzurePersistence implements SegmentNodeStorePersistence {
private static final Logger log = LoggerFactory.getLogger(AzurePersistence.class);
private final CloudBlobDirectory segmentstoreDirectory;
- public AzurePersistence(CloudBlobDirectory segmentstoreDirectory) {
- this.segmentstoreDirectory = segmentstoreDirectory;
+ public AzurePersistence(CloudBlobDirectory segmentStoreDirectory) {
+ this.segmentstoreDirectory = segmentStoreDirectory;
+
+ BlobRequestOptions defaultRequestOptions = segmentStoreDirectory.getServiceClient().getDefaultRequestOptions();
+ if (defaultRequestOptions.getMaximumExecutionTimeInMs() == null) {
+ defaultRequestOptions.setMaximumExecutionTimeInMs((int) TimeUnit.SECONDS.toMillis(30));
+ }
+ if (defaultRequestOptions.getTimeoutIntervalInMs() == null) {
+ defaultRequestOptions.setTimeoutIntervalInMs((int) TimeUnit.SECONDS.toMillis(1));
+ }
}
@Override
