Skip to content

Commit

Permalink
Merge pull request Azure#94 from wastore/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jofriedm-msft committed Oct 6, 2017
2 parents 12d81c9 + 3ee9a87 commit dfd1842
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 25 deletions.
16 changes: 10 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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<Runnable>());
new LinkedBlockingQueue<Runnable>(),
new BlobOutputStreamThreadFactory());
this.completionService = new ExecutorCompletionService<Void>(this.threadExecutor);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,32 +77,35 @@ public enum PremiumPageBlobTier {
*
* @return A <code>PremiumPageBlobTier</code> 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 {
Expand Down

0 comments on commit dfd1842

Please sign in to comment.