Skip to content

Commit

Permalink
Merge remote-tracking branch 'MSTR/master' into 1x.m6
Browse files Browse the repository at this point in the history
  • Loading branch information
jansupol committed Dec 21, 2023
2 parents a7d06f5 + 3a3cbb2 commit baddff9
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 14 deletions.
39 changes: 30 additions & 9 deletions client/src/main/java/org/glassfish/tyrus/client/ClientManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,31 +290,52 @@ public boolean evaluate() {
}

@Override
public Session connectToServer(Class annotatedEndpointClass, URI path) throws DeploymentException, IOException {
public Session connectToServer(final Class annotatedEndpointClass, final URI path) throws DeploymentException, IOException {
if (annotatedEndpointClass.getAnnotation(ClientEndpoint.class) == null) {
throw new DeploymentException(
String.format(
"Class argument in connectToServer(Class, URI) is to be annotated endpoint class. Class "
+ "%s does not have @ClientEndpoint", annotatedEndpointClass.getName()));
}
return tryCatchInterruptedExecutionEx(() -> connectToServer(annotatedEndpointClass, null, path.toString(), true));
return tryCatchInterruptedExecutionEx(new SupplierWithEx<Future<Session>, DeploymentException>() {
@Override
public Future<Session> get() throws DeploymentException {
return connectToServer(annotatedEndpointClass, null, path.toString(), true);
}
});
}

@Override
public Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointConfig cec, URI path) throws
DeploymentException, IOException {
return tryCatchInterruptedExecutionEx(() -> connectToServer(endpointClass, cec, path.toString(), true));
public Session connectToServer(final Class<? extends Endpoint> endpointClass,
final ClientEndpointConfig cec,
final URI path) throws DeploymentException, IOException {
return tryCatchInterruptedExecutionEx(new SupplierWithEx<Future<Session>, DeploymentException>() {
@Override
public Future<Session> get() throws DeploymentException {
return connectToServer(endpointClass, cec, path.toString(), true);
}
});
}

@Override
public Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, URI path) throws
public Session connectToServer(final Endpoint endpointInstance, final ClientEndpointConfig cec, final URI path) throws
DeploymentException, IOException {
return tryCatchInterruptedExecutionEx(() -> connectToServer(endpointInstance, cec, path.toString(), true));
return tryCatchInterruptedExecutionEx(new SupplierWithEx<Future<Session>, DeploymentException>() {
@Override
public Future<Session> get() throws DeploymentException {
return connectToServer(endpointInstance, cec, path.toString(), true);
}
});
}

@Override
public Session connectToServer(Object obj, URI path) throws DeploymentException, IOException {
return tryCatchInterruptedExecutionEx(() -> connectToServer(obj, null, path.toString(), true));
public Session connectToServer(final Object obj, final URI path) throws DeploymentException, IOException {
return tryCatchInterruptedExecutionEx(new SupplierWithEx<Future<Session>, DeploymentException>() {
@Override
public Future<Session> get() throws DeploymentException {
return connectToServer(obj, null, path.toString(), true);
}
});
}

private Session tryCatchInterruptedExecutionEx(SupplierWithEx<Future<Session>, DeploymentException> supplier)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -95,7 +95,7 @@ public static AnnotatedEndpoint fromClass(Class<?> annotatedClass, ComponentProv
boolean isServerEndpoint, int incomingBufferSize, ErrorCollector
collector, EndpointEventListener endpointEventListener) {
return fromClass(annotatedClass, componentProvider, isServerEndpoint, incomingBufferSize, collector,
endpointEventListener, Collections.emptySet());
endpointEventListener, (Set<Extension>) (Set) Collections.emptySet());
}

/**
Expand Down Expand Up @@ -132,7 +132,7 @@ public static AnnotatedEndpoint fromInstance(
Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint,
int incomingBufferSize, ErrorCollector collector) {
return fromInstance(annotatedInstance, componentProvider, isServerEndpoint, incomingBufferSize,
collector, Collections.emptySet());
collector, (Set<Extension>) (Set) Collections.emptySet());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -28,6 +28,7 @@
import jakarta.websocket.server.ServerEndpointConfig;

import org.glassfish.tyrus.core.collection.LazyValue;
import org.glassfish.tyrus.core.collection.Value;
import org.glassfish.tyrus.core.collection.Values;
import org.glassfish.tyrus.core.extension.ExtendedExtension;
import org.glassfish.tyrus.core.frame.Frame;
Expand All @@ -42,7 +43,12 @@ public class TyrusServerEndpointConfigurator extends ServerEndpointConfig.Config
private LazyValue<ComponentProviderService> componentProviderService;

public TyrusServerEndpointConfigurator() {
this.componentProviderService = Values.lazy(() -> ComponentProviderService.create());
this.componentProviderService = Values.lazy(new Value<ComponentProviderService>() {
@Override
public ComponentProviderService get() {
return ComponentProviderService.create();
}
});
}

@Override
Expand Down
7 changes: 7 additions & 0 deletions ext/client-java8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
<unpackBundle>true</unpackBundle>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
7 changes: 7 additions & 0 deletions tests/release-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
7 changes: 7 additions & 0 deletions tests/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
<unpackBundle>true</unpackBundle>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit baddff9

Please sign in to comment.