Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit b5543a4

Browse files
Merge pull request #3163 from dotnet-maestro-bot/merge/release/2.2-to-master
[automated] Merge branch 'release/2.2' => 'master'
2 parents a9d2cf0 + 95ccb1e commit b5543a4

File tree

22 files changed

+210
-51
lines changed

22 files changed

+210
-51
lines changed

.vsts-pipelines/builds/ci-internal.yml

+2-21
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,9 @@ resources:
99
name: aspnet-BuildTools
1010
ref: refs/heads/master
1111

12-
phases:
13-
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
12+
jobs:
13+
- template: .azure/templates/project-ci.yml@buildtools
1414
parameters:
15-
agentOs: Windows
16-
beforeBuild:
17-
- task: NodeTool@0
18-
displayName: Use Node 8.x
19-
inputs:
20-
versionSpec: 8.x
21-
22-
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
23-
parameters:
24-
agentOs: macOS
25-
beforeBuild:
26-
- task: NodeTool@0
27-
displayName: Use Node 8.x
28-
inputs:
29-
versionSpec: 8.x
30-
31-
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
32-
parameters:
33-
agentOs: Linux
3415
beforeBuild:
3516
- task: NodeTool@0
3617
displayName: Use Node 8.x

.vsts-pipelines/builds/ci-public.yml

+2-21
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,9 @@ resources:
1111
name: aspnet/BuildTools
1212
ref: refs/heads/master
1313

14-
phases:
15-
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
14+
jobs:
15+
- template: .azure/templates/project-ci.yml@buildtools
1616
parameters:
17-
agentOs: Windows
18-
beforeBuild:
19-
- task: NodeTool@0
20-
displayName: Use Node 8.x
21-
inputs:
22-
versionSpec: 8.x
23-
24-
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
25-
parameters:
26-
agentOs: macOS
27-
beforeBuild:
28-
- task: NodeTool@0
29-
displayName: Use Node 8.x
30-
inputs:
31-
versionSpec: 8.x
32-
33-
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
34-
parameters:
35-
agentOs: Linux
3617
beforeBuild:
3718
- task: NodeTool@0
3819
displayName: Use Node 8.x

clients/java/signalr/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ dependencies {
3838
testImplementation 'org.junit.jupiter:junit-jupiter-api'
3939
testCompile 'org.junit.jupiter:junit-jupiter-params'
4040
testRuntime 'org.junit.jupiter:junit-jupiter-engine'
41+
testCompile 'org.slf4j:slf4j-jdk14:1.7.25'
4142
implementation 'com.google.code.gson:gson'
4243
implementation 'com.squareup.okhttp3:okhttp'
4344
implementation 'io.reactivex.rxjava2:rxjava'

clients/java/signalr/src/main/java/com/microsoft/signalr/Action.java

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
package com.microsoft.signalr;
55

6+
/**
7+
* A callback that takes no parameters.
8+
*/
69
@FunctionalInterface
710
public interface Action {
811
void invoke();

clients/java/signalr/src/main/java/com/microsoft/signalr/Action1.java

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
package com.microsoft.signalr;
55

6+
/**
7+
* A callback that takes one parameter.
8+
*
9+
* @param <T1> The type of the first parameter to the callback.
10+
*/
611
@FunctionalInterface
712
public interface Action1<T1> {
813
void invoke(T1 param1);

clients/java/signalr/src/main/java/com/microsoft/signalr/Action2.java

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
package com.microsoft.signalr;
55

6+
/**
7+
* A callback that takes two parameters.
8+
*
9+
* @param <T1> The type of the first parameter to the callback.
10+
* @param <T2> The type of the second parameter to the callback.
11+
*/
612
@FunctionalInterface
713
public interface Action2<T1, T2> {
814
void invoke(T1 param1, T2 param2);

clients/java/signalr/src/main/java/com/microsoft/signalr/Action3.java

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
package com.microsoft.signalr;
55

6+
/**
7+
* A callback that takes three parameters.
8+
*
9+
* @param <T1> The type of the first parameter to the callback.
10+
* @param <T2> The type of the second parameter to the callback.
11+
* @param <T3> The type of the third parameter to the callback.
12+
*/
613
@FunctionalInterface
714
public interface Action3<T1, T2, T3> {
815
void invoke(T1 param1, T2 param2, T3 param3);

clients/java/signalr/src/main/java/com/microsoft/signalr/Action4.java

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33

44
package com.microsoft.signalr;
55

6+
/**
7+
* A callback that takes four parameters.
8+
*
9+
* @param <T1> The type of the first parameter to the callback.
10+
* @param <T2> The type of the second parameter to the callback.
11+
* @param <T3> The type of the third parameter to the callback.
12+
* @param <T4> The type of the fourth parameter to the callback.
13+
*/
614
@FunctionalInterface
715
public interface Action4<T1, T2, T3, T4> {
816
void invoke(T1 param1, T2 param2, T3 param3, T4 param4);

clients/java/signalr/src/main/java/com/microsoft/signalr/Action5.java

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33

44
package com.microsoft.signalr;
55

6+
/**
7+
* A callback that takes five parameter.
8+
*
9+
* @param <T1> The type of the first parameter to the callback.
10+
* @param <T2> The type of the second parameter to the callback.
11+
* @param <T3> The type of the third parameter to the callback.
12+
* @param <T4> The type of the fourth parameter to the callback.
13+
* @param <T5> The type of the fifth parameter to the callback.
14+
*/
615
@FunctionalInterface
716
public interface Action5<T1, T2, T3, T4, T5> {
817
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5);

clients/java/signalr/src/main/java/com/microsoft/signalr/Action6.java

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33

44
package com.microsoft.signalr;
55

6+
/**
7+
* A callback that takes six parameters.
8+
*
9+
* @param <T1> The type of the first parameter to the callback.
10+
* @param <T2> The type of the second parameter to the callback.
11+
* @param <T3> The type of the third parameter to the callback.
12+
* @param <T4> The type of the fourth parameter to the callback.
13+
* @param <T5> The type of the fifth parameter to the callback.
14+
* @param <T6> The type of the sixth parameter to the callback.
15+
*/
616
@FunctionalInterface
717
public interface Action6<T1, T2, T3, T4, T5, T6> {
818
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6);

clients/java/signalr/src/main/java/com/microsoft/signalr/Action7.java

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33

44
package com.microsoft.signalr;
55

6+
/**
7+
* A callback that takes seven parameters.
8+
*
9+
* @param <T1> The type of the first parameter to the callback.
10+
* @param <T2> The type of the second parameter to the callback.
11+
* @param <T3> The type of the third parameter to the callback.
12+
* @param <T4> The type of the fourth parameter to the callback.
13+
* @param <T5> The type of the fifth parameter to the callback.
14+
* @param <T6> The type of the sixth parameter to the callback.
15+
* @param <T7> The type of the seventh parameter to the callback.
16+
*/
617
@FunctionalInterface
718
public interface Action7<T1, T2, T3, T4, T5, T6, T7> {
819
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7);

clients/java/signalr/src/main/java/com/microsoft/signalr/Action8.java

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33

44
package com.microsoft.signalr;
55

6+
/**
7+
* A callback that takes eight parameters.
8+
*
9+
* @param <T1> The type of the first parameter to the callback.
10+
* @param <T2> The type of the second parameter to the callback.
11+
* @param <T3> The type of the third parameter to the callback.
12+
* @param <T4> The type of the fourth parameter to the callback.
13+
* @param <T5> The type of the fifth parameter to the callback.
14+
* @param <T6> The type of the sixth parameter to the callback.
15+
* @param <T7> The type of the seventh parameter to the callback.
16+
* @param <T8> The type of the eighth parameter to the callback.
17+
*/
618
@FunctionalInterface
719
public interface Action8<T1, T2, T3, T4, T5, T6, T7, T8> {
820
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7, T8 param8);

clients/java/signalr/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java

+54-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
import io.reactivex.Single;
1111

12+
/**
13+
* A builder for configuring {@link HubConnection} instances.
14+
*/
1215
public class HttpHubConnectionBuilder {
1316
private final String url;
1417
private Transport transport;
@@ -22,36 +25,80 @@ public class HttpHubConnectionBuilder {
2225
this.url = url;
2326
}
2427

25-
public HttpHubConnectionBuilder withTransport(Transport transport) {
28+
/**
29+
* Sets the transport to be used by the {@link HubConnection}.
30+
*
31+
* @param transport The transport to be used.
32+
* @return This instance of the HttpHubConnectionBuilder.
33+
*/
34+
HttpHubConnectionBuilder withTransport(Transport transport) {
2635
this.transport = transport;
2736
return this;
2837
}
2938

30-
public HttpHubConnectionBuilder withHttpClient(HttpClient httpClient) {
39+
/**
40+
* Sets the {@link HttpClient} to be used by the {@link HubConnection}.
41+
*
42+
* @param httpClient The {@link HttpClient} to be used by the {@link HubConnection}.
43+
* @return This instance of the HttpHubConnectionBuilder.
44+
*/
45+
HttpHubConnectionBuilder withHttpClient(HttpClient httpClient) {
3146
this.httpClient = httpClient;
3247
return this;
3348
}
3449

50+
/**
51+
* Indicates to the {@link HubConnection} that it should skip the negotiate process.
52+
* Note: This option only works with the Websockets transport and the Azure SignalR Service require the negotiate step.
53+
*
54+
* @param skipNegotiate Boolean indicating if the {@link HubConnection} should skip the negotiate step.
55+
* @return This instance of the HttpHubConnectionBuilder.
56+
*/
3557
public HttpHubConnectionBuilder shouldSkipNegotiate(boolean skipNegotiate) {
3658
this.skipNegotiate = skipNegotiate;
3759
return this;
3860
}
3961

62+
/**
63+
* Sets the access token provider for the {@link HubConnection}.
64+
*
65+
* @param accessTokenProvider The access token provider to be used by the {@link HubConnection}.
66+
* @return This instance of the HttpHubConnectionBuilder.
67+
*/
4068
public HttpHubConnectionBuilder withAccessTokenProvider(Single<String> accessTokenProvider) {
4169
this.accessTokenProvider = accessTokenProvider;
4270
return this;
4371
}
4472

73+
/**
74+
* Sets the duration the {@link HubConnection} should wait for a Handshake Response from the server.
75+
*
76+
* @param timeout The duration that the {@link HubConnection} should wait for a Handshake Response from the server.
77+
* @return This instance of the HttpHubConnectionBuilder.
78+
*/
4579
public HttpHubConnectionBuilder withHandshakeResponseTimeout(Duration timeout) {
4680
this.handshakeResponseTimeout = timeout;
4781
return this;
4882
}
4983

84+
/**
85+
* Sets a collection of Headers for the {@link HubConnection} to send with every Http request.
86+
*
87+
* @param headers A Map representing the collection of Headers that the {@link HubConnection} should send.
88+
* @return This instance of the HttpHubConnectionBuilder.
89+
*/
5090
public HttpHubConnectionBuilder withHeaders(Map<String, String> headers) {
5191
this.headers = headers;
5292
return this;
5393
}
5494

95+
/**
96+
* Sets a single header for the {@link HubConnection} to send.
97+
*
98+
* @param name The name of the header to set.
99+
* @param value The value of the header to be set.
100+
* @return This instance of the HttpHubConnectionBuilder.
101+
*/
55102
public HttpHubConnectionBuilder withHeader(String name, String value) {
56103
if (headers == null) {
57104
this.headers = new HashMap<>();
@@ -60,6 +107,11 @@ public HttpHubConnectionBuilder withHeader(String name, String value) {
60107
return this;
61108
}
62109

110+
/**
111+
* Builds a new instance of {@link HubConnection}.
112+
*
113+
* @return A new instance of {@link HubConnection}.
114+
*/
63115
public HubConnection build() {
64116
return new HubConnection(url, transport, skipNegotiate, httpClient, accessTokenProvider, handshakeResponseTimeout, headers);
65117
}

clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java

+36
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,38 @@ public class HubConnection {
5555
private final Logger logger = LoggerFactory.getLogger(HubConnection.class);
5656

5757

58+
/**
59+
* Sets the server timeout interval for the connection.
60+
*
61+
* @param serverTimeout The server timeout duration.
62+
*/
5863
public void setServerTimeout(Duration serverTimeout) {
5964
this.serverTimeout = serverTimeout;
6065
}
6166

67+
/**
68+
* Gets the server timeout duration.
69+
*
70+
* @return The server timeout duration.
71+
*/
6272
public Duration getServerTimeout() {
6373
return this.serverTimeout;
6474
}
6575

76+
/**
77+
* Sets the keep alive interval duration.
78+
*
79+
* @param keepAliveInterval The interval at which the connection should send keep alive messages.
80+
*/
6681
public void setKeepAliveInterval(Duration keepAliveInterval) {
6782
this.keepAliveInterval = keepAliveInterval;
6883
}
6984

85+
/**
86+
* Gets the keep alive interval.
87+
*
88+
* @return The interval between keep alive messages.
89+
*/
7090
public Duration getKeepAliveInterval() {
7191
return this.keepAliveInterval;
7292
}
@@ -339,6 +359,7 @@ private CompletableFuture<String> startNegotiate(String url, int negotiateAttemp
339359

340360
/**
341361
* Stops a connection to the server.
362+
*
342363
* @param errorMessage An error message if the connected needs to be stopped because of an error.
343364
* @return A Completable that completes when the connection has been stopped.
344365
*/
@@ -364,6 +385,7 @@ private CompletableFuture<Void> stop(String errorMessage) {
364385

365386
/**
366387
* Stops a connection to the server.
388+
*
367389
* @return A Completable that completes when the connection has been stopped.
368390
*/
369391
public Completable stop() {
@@ -416,6 +438,15 @@ public void send(String method, Object... args) {
416438
sendHubMessage(invocationMessage);
417439
}
418440

441+
/**
442+
* Invokes a hub method on the server using the specified method name and arguments.
443+
*
444+
* @param returnType The expected return type.
445+
* @param method The name of the server method to invoke.
446+
* @param args The arguments used to invoke the server method.
447+
* @param <T> The expected return type.
448+
* @return A Single that yields the return value when the invocation has completed.
449+
*/
419450
@SuppressWarnings("unchecked")
420451
public <T> Single<T> invoke(Class<T> returnType, String method, Object... args) {
421452
String id = connectionState.getNextInvocationId();
@@ -478,6 +509,11 @@ public void remove(String name) {
478509
logger.trace("Removing handlers for client method: {}.", name);
479510
}
480511

512+
/**
513+
* Registers a callback to run when the connection is closed.
514+
*
515+
* @param callback A callback to run when the connection closes.
516+
*/
481517
public void onClosed(Consumer<Exception> callback) {
482518
if (onClosedCallbackList == null) {
483519
onClosedCallbackList = new ArrayList<>();

0 commit comments

Comments
 (0)