diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8796767aca7c5..f1ba760c79aa8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,16 +1,20 @@ If you intend to contribute to the project, please make sure you've followed the instructions provided in the [Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/). ## Project Setup -The Azure Storage development team uses Eclipse so instructions will be tailored to that preference. However, any preferred IDE or other toolset should be usable. +The Azure Storage development team uses Intellij. However, any preferred IDE or other toolset should be usable. ### Install * Java SE 6+ -* [Eclipse](https://eclipse.org/downloads/) -* [Maven plugin for Eclipse](http://www.eclipse.org/m2e/index.html). Some Eclipse packages (ex Eclipse IDE for Java Developers) may come with this plugin already installed. * [Maven](https://maven.apache.org/install.html) * Clone the source code from GitHub -### Open Solution -Open the project from Eclipse using File->Import->Maven->Existing Maven Projects and navigating to the azure-storage-java folder. Select the listed pom. This imports the source and the test files and downloads the required dependencies via Maven. If you'd like to import the samples, follow the same procedure but navigate to the azure-storage-java\microsoft-azure-storage-samples folder and select that pom. Both projects can be opened at the same time and will be shown in the Package Explorer. +#### IntelliJ Installation +* [IntelliJ](https://www.jetbrains.com/idea/download) +* [Importing project from Maven for IntelliJ](https://www.jetbrains.com/help/idea//2017.1/importing-project-from-maven-model.html) + +#### Eclipse Installation +* [Eclipse](https://eclipse.org/downloads/) +* [Maven plugin for Eclipse](http://www.eclipse.org/m2e/index.html). Some Eclipse packages (ex Eclipse IDE for Java Developers) may come with this plugin already installed. +* Open the project from Eclipse using File->Import->Maven->Existing Maven Projects and navigating to the azure-storage-java folder. Select the listed pom. This imports the source and the test files and downloads the required dependencies via Maven. If you'd like to import the samples, follow the same procedure but navigate to the azure-storage-java\microsoft-azure-storage-samples folder and select that pom. Both projects can be opened at the same time and will be shown in the Package Explorer. ## Tests @@ -38,7 +42,7 @@ The following are the minimum requirements for any pull request that must be met * Thoroughly test your feature ### Branching Policy -Changes should be based on the **dev** branch, not master as master is considered publicly released code. If after discussion with us breaking changes are considered for the library, we will create a **dev_breaking** branch based on dev which can be used to store these changes until the next breaking release. Each breaking change should be recorded in [BreakingChanges.md](BreakingChanges.md). +Changes should be based on the **dev** branch for non-breaking changes and **dev_breaking** for breaking changes. Do not submit pull requests against master as master is considered publicly released code. Each breaking change should be recorded in [BreakingChanges.md](BreakingChanges.md). ### Adding Features for Java 6+ We strive to release each new feature in a backward compatible manner. Therefore, we ask that all contributions be written to work in Java 6, 7 and 8. diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/ServicePropertiesHandler.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/ServicePropertiesHandler.java index 44ce349675219..ec370d5df2ef9 100644 --- a/microsoft-azure-storage/src/com/microsoft/azure/storage/ServicePropertiesHandler.java +++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/ServicePropertiesHandler.java @@ -58,7 +58,7 @@ public static ServiceProperties readServicePropertiesFromStream(final InputStrea IOException, ParserConfigurationException { SAXParser saxParser = Utility.getSAXParser(); ServicePropertiesHandler handler = new ServicePropertiesHandler(); - handler.props.setCors(null); + handler.props.setLogging(null); handler.props.setHourMetrics(null); handler.props.setMinuteMetrics(null); handler.props.setCors(null); diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobOutputStreamInternal.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobOutputStreamInternal.java index 44fde57d3f7a1..0d3854373d764 100644 --- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobOutputStreamInternal.java +++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobOutputStreamInternal.java @@ -27,13 +27,8 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorCompletionService; -import java.util.concurrent.Future; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicInteger; import com.microsoft.azure.storage.AccessCondition; import com.microsoft.azure.storage.Constants; @@ -51,6 +46,29 @@ */ final class BlobOutputStreamInternal extends BlobOutputStream { + private static class BlobOutputStreamThreadFactory implements ThreadFactory { + private final ThreadGroup group; + private final AtomicInteger threadNumber = new AtomicInteger(1); + private final String namePrefix; + + BlobOutputStreamThreadFactory() { + SecurityManager s = System.getSecurityManager(); + group = (s != null) ? s.getThreadGroup() : + Thread.currentThread().getThreadGroup(); + namePrefix = "azure-storage-bloboutputstream-thread-"; + } + + public Thread newThread(Runnable r) { + Thread t = new Thread(group, r, + namePrefix + threadNumber.getAndIncrement(), + 0); + t.setDaemon(true); + if (t.getPriority() != Thread.NORM_PRIORITY) + t.setPriority(Thread.NORM_PRIORITY); + return t; + } + } + /** * Holds the {@link AccessCondition} object that represents the access conditions for the blob. */ @@ -171,9 +189,10 @@ private BlobOutputStreamInternal(final CloudBlob parentBlob, final AccessConditi this.threadExecutor = new ThreadPoolExecutor( this.options.getConcurrentRequestCount(), this.options.getConcurrentRequestCount(), - 10, + 10, TimeUnit.SECONDS, - new LinkedBlockingQueue()); + new LinkedBlockingQueue(), + new BlobOutputStreamThreadFactory()); this.completionService = new ExecutorCompletionService(this.threadExecutor); } diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/PremiumPageBlobTier.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/PremiumPageBlobTier.java index 590a66c334f77..ffcc51670a58f 100644 --- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/PremiumPageBlobTier.java +++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/PremiumPageBlobTier.java @@ -77,32 +77,35 @@ public enum PremiumPageBlobTier { * * @return A PremiumPageBlobTier value that represents the premium page blob tier. */ - protected static PremiumPageBlobTier parse(final String premiumBlobTierString) { + protected static PremiumPageBlobTier parse(String premiumBlobTierString) { + if (Utility.isNullOrEmpty(premiumBlobTierString)) { return UNKNOWN; } - else if ("p4".equals(premiumBlobTierString.toLowerCase(Locale.US))) { + + premiumBlobTierString = premiumBlobTierString.toLowerCase(Locale.US); + if ("p4".equals(premiumBlobTierString)) { return P4; } - else if ("p6".equals(premiumBlobTierString.toLowerCase(Locale.US))) { + else if ("p6".equals(premiumBlobTierString)) { return P6; } - else if ("p10".equals(premiumBlobTierString.toLowerCase(Locale.US))) { + else if ("p10".equals(premiumBlobTierString)) { return P10; } - else if ("p20".equals(premiumBlobTierString.toLowerCase(Locale.US))) { + else if ("p20".equals(premiumBlobTierString)) { return P20; } - else if ("p30".equals(premiumBlobTierString.toLowerCase(Locale.US))) { + else if ("p30".equals(premiumBlobTierString)) { return P30; } - else if ("p40".equals(premiumBlobTierString.toLowerCase(Locale.US))) { + else if ("p40".equals(premiumBlobTierString)) { return P40; } - else if ("p50".equals(premiumBlobTierString.toLowerCase(Locale.US))) { + else if ("p50".equals(premiumBlobTierString)) { return P50; } - else if ("p60".equals(premiumBlobTierString.toLowerCase(Locale.US))) { + else if ("p60".equals(premiumBlobTierString)) { return P60; } else {