Skip to content

Commit 0f9b248

Browse files
authored
Reworked Java PoolAndResourceFile sample (#297)
- Refactored to reduce complexity and line count - Submit 5 tasks instead of 1 by default - Improved output - Updated dependencies - Added jenv's .java-version to .gitignore
1 parent fe3f0c1 commit 0f9b248

File tree

5 files changed

+237
-230
lines changed

5 files changed

+237
-230
lines changed

Java/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ local.properties
3838
target
3939
.idea
4040
*.iml
41+
.java-version
4142

4243
# Mac OS #
4344
.DS_Store
@@ -47,4 +48,5 @@ target
4748
Thumbs.db
4849

4950
# reduced pom files should not be included
50-
dependency-reduced-pom.xml
51+
dependency-reduced-pom.xml
52+

Java/PoolAndResourceFile/README.md

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,17 @@ services: Batch
33
platforms: java
44
---
55

6-
#Getting Started with Batch - Create Pool - in Java
6+
## Description
7+
When run, this sample will:
78

8-
9-
Azure Batch sample for managing pool -
10-
- Create IaaS pool
11-
- Wait the VMs to be ready
12-
- Submit a simple job with task associated with resource file
13-
- Upload file to Azure storage
14-
- Generate the SAS url for the file
15-
- Associate the resource with task
16-
- Wait the task to finish
17-
- Delete the job and the pool
18-
9+
- Create an Azure Batch pool with a single dedicated node
10+
- Wait for the nodes to be ready
11+
- Create a storage container and upload a resource file to it
12+
- Submit a job with 5 tasks associated with the resource file
13+
- Wait for all tasks to finish
14+
- Delete the job, the pool and the storage container
1915

2016
## Running this Sample
21-
2217
To run this sample:
2318

2419
Set the following environment variables:
@@ -34,10 +29,4 @@ Clone repo and compile the code:
3429

3530
cd azure-batch-samples/Java/PoolAndResourceFile
3631

37-
mvn clean compile exec:java
38-
39-
## More information
40-
41-
[http://azure.com/java](http://azure.com/java)
42-
43-
If you don't have a Microsoft Azure subscription you can get a FREE trial account [here](http://go.microsoft.com/fwlink/?LinkId=330212)
32+
mvn clean compile exec:java

Java/PoolAndResourceFile/pom.xml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@
1717
<dependency>
1818
<groupId>com.microsoft.azure</groupId>
1919
<artifactId>azure-batch</artifactId>
20-
<version>7.0.0</version>
20+
<version>9.0.0</version>
2121
</dependency>
2222
<dependency>
2323
<groupId>com.microsoft.rest</groupId>
2424
<artifactId>client-runtime</artifactId>
25-
<version>1.6.4</version>
25+
<version>1.7.12</version>
2626
</dependency>
2727
<dependency>
2828
<groupId>com.microsoft.azure</groupId>
2929
<artifactId>azure-client-runtime</artifactId>
30-
<version>1.6.4</version>
30+
<version>1.7.12</version>
3131
</dependency>
3232
<dependency>
3333
<groupId>commons-codec</groupId>
3434
<artifactId>commons-codec</artifactId>
35-
<version>1.11</version>
35+
<version>1.15</version>
3636
</dependency>
3737
<dependency>
3838
<groupId>com.microsoft.azure</groupId>
3939
<artifactId>azure-storage</artifactId>
40-
<version>8.0.0</version>
40+
<version>8.6.6</version>
4141
</dependency>
4242
</dependencies>
4343

@@ -47,13 +47,13 @@
4747
<!-- Build an executable JAR -->
4848
<groupId>org.apache.maven.plugins</groupId>
4949
<artifactId>maven-jar-plugin</artifactId>
50-
<version>2.4</version>
50+
<version>3.2.0</version>
5151
<configuration>
5252
<archive>
5353
<manifest>
5454
<addClasspath>true</addClasspath>
5555
<classpathPrefix>lib/</classpathPrefix>
56-
<mainClass>Helloworld</mainClass>
56+
<mainClass>PoolAndResourceFile</mainClass>
5757
</manifest>
5858
</archive>
5959
</configuration>
@@ -77,7 +77,7 @@
7777
<plugin>
7878
<groupId>org.codehaus.mojo</groupId>
7979
<artifactId>exec-maven-plugin</artifactId>
80-
<version>1.2.1</version>
80+
<version>3.0.0</version>
8181
<executions>
8282
<execution>
8383
<goals>
@@ -89,6 +89,14 @@
8989
<mainClass>PoolAndResourceFile</mainClass>
9090
</configuration>
9191
</plugin>
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-compiler-plugin</artifactId>
95+
<configuration>
96+
<source>8</source>
97+
<target>8</target>
98+
</configuration>
99+
</plugin>
92100

93101

94102
</plugins>

0 commit comments

Comments
 (0)