-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #670 from xingwu1/autorest
Fix bugs in the createtasks function
- Loading branch information
Showing
15 changed files
with
402 additions
and
4,592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...batch/src/main/java/com/microsoft/azure/batch/interceptor/BatchClientParallelOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
|
||
package com.microsoft.azure.batch.interceptor; | ||
|
||
import com.microsoft.azure.batch.BatchClientBehavior; | ||
|
||
public class BatchClientParallelOptions extends BatchClientBehavior { | ||
|
||
private int maxDegreeOfParallelism; | ||
|
||
/// <summary> | ||
/// Gets or sets the maximum number of concurrent tasks enabled by this <see cref="BatchClientParallelOptions"/> instance. | ||
/// The default value is 1. | ||
/// </summary> | ||
public int getMaxDegreeOfParallelism() { | ||
return this.maxDegreeOfParallelism; | ||
} | ||
|
||
public void setMaxDegreeOfParallelism(int maxDegreeOfParallelism) { | ||
if (maxDegreeOfParallelism > 0) { | ||
this.maxDegreeOfParallelism = maxDegreeOfParallelism; | ||
} | ||
else { | ||
throw new IllegalArgumentException("maxDegreeOfParallelism"); | ||
} | ||
} | ||
|
||
public BatchClientParallelOptions() { | ||
this.maxDegreeOfParallelism = 1; | ||
} | ||
|
||
public BatchClientParallelOptions(int maxDegreeOfParallelism) { | ||
this.maxDegreeOfParallelism = maxDegreeOfParallelism; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...e-batch/src/main/java/com/microsoft/azure/batch/interceptor/ServerTimeoutInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
|
||
package com.microsoft.azure.batch.interceptor; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
public class ServerTimeoutInterceptor extends RequestInterceptor { | ||
|
||
private final int serverTimeout; | ||
|
||
public ServerTimeoutInterceptor(int timeout) { | ||
this.serverTimeout = timeout; | ||
this.setHandler(new BatchRequestInterceptHandler() { | ||
@Override | ||
public void modify(Object request) { | ||
Class<?> c = request.getClass(); | ||
try { | ||
Method timeoutMethod = c.getMethod("setTimeout", new Class[]{Integer.class}); | ||
if (timeoutMethod != null) { | ||
timeoutMethod.invoke(request, serverTimeout); | ||
} | ||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) { | ||
} | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.