Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make changes to support java 8 compatibility #35

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<modelVersion>4.0.0</modelVersion>

<groupId>io.appform.ranger</groupId>
<artifactId>ranger</artifactId>
<artifactId>ranger-jre8</artifactId>
<packaging>pom</packaging>
<version>1.0-RC16</version>
<name>Ranger</name>
<version>1.0-JAVA8-SNAPSHOT</version>
<name>Ranger JRE 8</name>
<url>https://github.com/appform-io/ranger</url>
<description>Service Discovery for Java</description>
<inceptionYear>2015</inceptionYear>
Expand Down Expand Up @@ -88,7 +88,7 @@

<maven.compiler.version>3.8.0</maven.compiler.version>
<java.version>17</java.version>
<java.release.version>11</java.release.version>
<java.release.version>${java.version}</java.release.version>
<lombok.version>1.18.22</lombok.version>
<annotations.version>3.0.1u2</annotations.version>

Expand Down
14 changes: 9 additions & 5 deletions ranger-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ranger</artifactId>
<artifactId>ranger-jre8</artifactId>
<groupId>io.appform.ranger</groupId>
<version>1.0-RC16</version>
<version>1.0-JAVA8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ranger-client</artifactId>
<artifactId>ranger-client-jre8</artifactId>

<properties>
<java.release.version>8</java.release.version>
</properties>

<dependencies>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-core</artifactId>
<artifactId>ranger-core-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-core</artifactId>
<artifactId>ranger-core-jre8</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.appform.ranger.core.utils.RangerTestUtils;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import lombok.var;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.appform.ranger.client.utils.CriteriaUtils;
import io.appform.ranger.core.units.TestNodeData;
import lombok.val;
import lombok.var;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ServiceFinder<TestNodeData, ListBasedServiceRegistry<TestNodeData>> build
val finder = new TestSimpleUnshardedServiceFinder<TestNodeData>()
.withNamespace(service.getNamespace())
.withServiceName(service.getServiceName())
.withDeserializer(new Deserializer<>() {
.withDeserializer(new Deserializer<TestNodeData>() {
})
.build();
finder.start();
Expand Down
7 changes: 4 additions & 3 deletions ranger-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ranger</artifactId>
<artifactId>ranger-jre8</artifactId>
<groupId>io.appform.ranger</groupId>
<version>1.0-RC16</version>
<version>1.0-JAVA8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ranger-core</artifactId>
<artifactId>ranger-core-jre8</artifactId>

<properties>
<httpclient.version>4.5.13</httpclient.version>
<java.release.version>8</java.release.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.appform.ranger.core.finder.serviceregistry;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ListMultimap;
import io.appform.ranger.core.model.Service;
Expand Down Expand Up @@ -45,7 +46,7 @@ public ListMultimap<T, ServiceNode<T>> nodes() {
@Override
public List<ServiceNode<T>> nodeList() {
val nodeList = nodes.get();
return null == nodeList ? List.of() : new ArrayList<>(nodeList.values());
return null == nodeList ? ImmutableList.of() : new ArrayList<>(nodeList.values());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Slf4j
@SuppressWarnings("unused")
public class PingCheckMonitor extends IsolatedHealthMonitor<HealthcheckStatus> {

private final HttpRequest httpRequest;
private final String host;
private final ExecutorService executorService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"iterations" : 4,
"threads" : 1,
"forks" : 3,
"mean_ops" : 644166.1778513143
"mean_ops" : 824698.9263293864
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"iterations" : 4,
"threads" : 1,
"forks" : 3,
"mean_ops" : 502644.4941310657
"mean_ops" : 662657.5355695277
}
11 changes: 6 additions & 5 deletions ranger-discovery-bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ranger</artifactId>
<artifactId>ranger-jre8</artifactId>
<groupId>io.appform.ranger</groupId>
<version>1.0-RC16</version>
<version>1.0-JAVA8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ranger-discovery-bundle</artifactId>
<artifactId>ranger-discovery-bundle-jre8</artifactId>

<properties>
<dns.cache.manipulator.version>1.8.1</dns.cache.manipulator.version>
<failsafe.version>3.2.4</failsafe.version>
<java.release.version>8</java.release.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -52,12 +53,12 @@
</dependency>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-zk-client</artifactId>
<artifactId>ranger-zk-client-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-server-common</artifactId>
<artifactId>ranger-server-common-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public JavaHashCodeBasedKeyPartitioner(int maxPartitions) {

@Override
public int partition(Id id) {
var hashCode = id.getId().hashCode();
int hashCode = id.getId().hashCode();
hashCode *= hashCode < 0 ? -1 : 1;
return hashCode % maxPartitions;
}
Expand Down
16 changes: 10 additions & 6 deletions ranger-http-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ranger</artifactId>
<artifactId>ranger-jre8</artifactId>
<groupId>io.appform.ranger</groupId>
<version>1.0-RC16</version>
<version>1.0-JAVA8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ranger-http-client</artifactId>

<artifactId>ranger-http-client-jre8</artifactId>

<properties>
<java.release.version>8</java.release.version>
</properties>

<dependencies>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-http</artifactId>
<artifactId>ranger-http-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-client</artifactId>
<artifactId>ranger-client-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
10 changes: 7 additions & 3 deletions ranger-http-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ranger</artifactId>
<artifactId>ranger-jre8</artifactId>
<groupId>io.appform.ranger</groupId>
<version>1.0-RC16</version>
<version>1.0-JAVA8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ranger-http-model</artifactId>
<artifactId>ranger-http-model-jre8</artifactId>

<properties>
<java.release.version>8</java.release.version>
</properties>
</project>
13 changes: 7 additions & 6 deletions ranger-http-server-bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,33 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ranger</artifactId>
<artifactId>ranger-jre8</artifactId>
<groupId>io.appform.ranger</groupId>
<version>1.0-RC16</version>
<version>1.0-JAVA8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ranger-http-server-bundle</artifactId>
<artifactId>ranger-http-server-bundle-jre8</artifactId>

<properties>
<dropwizard.version>2.1.10</dropwizard.version>
<java.release.version>8</java.release.version>
</properties>

<dependencies>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-http-client</artifactId>
<artifactId>ranger-http-client-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-server-bundle</artifactId>
<artifactId>ranger-server-bundle-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-server-common</artifactId>
<artifactId>ranger-server-common-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

import com.codahale.metrics.health.HealthCheck;
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.collect.ImmutableList;
import io.appform.ranger.client.RangerHubClient;
import io.appform.ranger.client.http.UnshardedRangerHttpHubClient;
import io.appform.ranger.common.server.ShardInfo;
import io.appform.ranger.core.finder.serviceregistry.ListBasedServiceRegistry;
import io.appform.ranger.http.model.ServiceNodesResponse;
import io.appform.ranger.http.server.bundle.config.RangerHttpConfiguration;
import io.appform.ranger.http.server.bundle.healthcheck.RangerHttpHealthCheck;
import io.appform.ranger.server.bundle.RangerServerBundle;
Expand Down Expand Up @@ -52,7 +54,8 @@ protected List<RangerHubClient<ShardInfo, ListBasedServiceRegistry<ShardInfo>>>
.nodeRefreshTimeMs(rangerConfiguration.getNodeRefreshTimeMs())
.deserializer(data -> {
try {
return getMapper().readValue(data, new TypeReference<>() {
return getMapper().readValue(data,
new TypeReference<ServiceNodesResponse<ShardInfo>>() {
});
} catch (IOException e) {
log.warn("Error parsing node data with value {}", new String(data));
Expand All @@ -63,6 +66,6 @@ protected List<RangerHubClient<ShardInfo, ListBasedServiceRegistry<ShardInfo>>>
}

protected List<HealthCheck> withHealthChecks(U configuration) {
return List.of(new RangerHttpHealthCheck());
return ImmutableList.of(new RangerHttpHealthCheck());
}
}
8 changes: 4 additions & 4 deletions ranger-http-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ranger</artifactId>
<artifactId>ranger-jre8</artifactId>
<groupId>io.appform.ranger</groupId>
<version>1.0-RC16</version>
<version>1.0-JAVA8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ranger-http-server</artifactId>
<artifactId>ranger-http-server-jre8</artifactId>

<dependencies>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-http-server-bundle</artifactId>
<artifactId>ranger-http-server-bundle-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void main(String[] args) throws Exception {

@Override
public void initialize(Bootstrap<HttpAppConfiguration> bootstrap) {
bootstrap.addBundle(new HttpServerBundle<>() {
bootstrap.addBundle(new HttpServerBundle<HttpAppConfiguration>() {
@Override
protected RangerHttpConfiguration getRangerConfiguration(HttpAppConfiguration configuration) {
return configuration.getRangerConfiguration();
Expand Down
16 changes: 10 additions & 6 deletions ranger-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ranger</artifactId>
<artifactId>ranger-jre8</artifactId>
<groupId>io.appform.ranger</groupId>
<version>1.0-RC16</version>
<version>1.0-JAVA8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ranger-http</artifactId>
<artifactId>ranger-http-jre8</artifactId>

<properties>
<java.release.version>8</java.release.version>
</properties>

<dependencies>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-core</artifactId>
<artifactId>ranger-core-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-http-model</artifactId>
<artifactId>ranger-http-model-jre8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand All @@ -41,7 +45,7 @@
</dependency>
<dependency>
<groupId>io.appform.ranger</groupId>
<artifactId>ranger-core</artifactId>
<artifactId>ranger-core-jre8</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
Expand Down
Loading