Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #549 from Azure/legacy-dev
Browse files Browse the repository at this point in the history
Legacy dev
  • Loading branch information
rickle-msft authored Jun 24, 2020
2 parents cdd966e + 921b5cc commit 7a1f232
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 7 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2020.06.22 Version 8.6.5
* Fixed a race condition in XML parsing logic that in narrow situations could cause the parser to be initialized incorrectly resulting in an erroneously empty list result.

2020.05.04 Version 8.6.4
* Converted the httpsKeepAliveSocketFactory into a singleton for performance improvements.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To get the binaries of this library as distributed by Microsoft, ready for use w
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>8.6.4</version>
<version>8.6.5</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion microsoft-azure-storage-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>8.6.4</version>
<version>8.6.5</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>8.6.4</version>
<version>8.6.5</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@
import java.net.URISyntaxException;
import java.security.InvalidKeyException;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.parsers.SAXParser;

import com.microsoft.azure.storage.*;
import com.microsoft.azure.storage.core.Utility;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -541,6 +547,49 @@ public void testCloudBlobContainerListBlobs() throws StorageException, IOExcepti
assertTrue(blobNames.size() == 0);
}

@Test
@Category({DevFabricTests.class, DevStoreTests.class})
public void testSAXParserConcurrency() throws Exception {
final int totalCount = 200000;
final int numThreads = 200;
final AtomicInteger currentCount = new AtomicInteger(0);
final AtomicInteger pending = new AtomicInteger(0);
final AtomicInteger failureCount = new AtomicInteger(0);
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(numThreads);

do {
final int count = currentCount.incrementAndGet();
pending.incrementAndGet();
executor.execute(new Runnable() {
@Override
public void run() {
pending.decrementAndGet();
if (count > totalCount) {
return;
}
try {
SAXParser parser = Utility.getSAXParser();
if (!parser.isNamespaceAware()) {
failureCount.incrementAndGet();
}
assertEquals(true, parser.isNamespaceAware());
} catch (Exception e) {
fail(e.toString());
}
}
});

assertEquals(0, failureCount.get());

while (pending.get() > numThreads * 2) {
Thread.sleep(10);
}
} while (currentCount.get() < totalCount);
executor.shutdown();
executor.awaitTermination(1, TimeUnit.MINUTES);
executor.shutdownNow();
}

/**
* List the blobs in a container with a prefix
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ public static class HeaderConstants {
/**
* Specifies the value to use for UserAgent header.
*/
public static final String USER_AGENT_VERSION = "8.6.4";
public static final String USER_AGENT_VERSION = "8.6.5";

/**
* The default type for content-type and accept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ protected DateFormat initialValue() {
* Thread local for SAXParser.
*/
private static final ThreadLocal<SAXParser> saxParserThreadLocal = new ThreadLocal<SAXParser>() {
SAXParserFactory factory;
@Override public SAXParser initialValue() {
factory = SAXParserFactory.newInstance();
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
try {
return factory.newSAXParser();
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>8.6.4</version>
<version>8.6.5</version>
<packaging>jar</packaging>

<name>Microsoft Azure Storage Client SDK</name>
Expand Down

0 comments on commit 7a1f232

Please sign in to comment.