Skip to content
New issue

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

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

Already on GitHub? # to your account

[Issue #819] revise jdk version check for reflect constructor #821

Merged
merged 1 commit into from
Jan 3, 2025
Merged
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
revise.
  • Loading branch information
bianhq committed Jan 3, 2025
commit 49943a6d1f500a1c4d8fd6c7bea5d60ad2d28f52
Original file line number Diff line number Diff line change
@@ -86,25 +86,25 @@ public class DirectIoLib
{
if (JavaVersion <= 11)
{
// this is from sun.nio.ch.Util.initDBBRConstructor
// This is from sun.nio.ch.Util.initDBBRConstructor.
Class<?> cl = Class.forName("java.nio.DirectByteBufferR");
directByteBufferRConstructor = cl.getDeclaredConstructor(
int.class, long.class, FileDescriptor.class, Runnable.class);
}
else if (JavaVersion <= 17)
else if (JavaVersion < 21)
{
/* the creator of DirectByteBufferR is changed after java 11 and is not compatible with java 8.
/* The creator of DirectByteBufferR is changed after java 11 and is not compatible with java 8.
* Therefore, we use DirectByteBuffer to create direct read only buffer.
*/
Class<?> cl = Class.forName("java.nio.DirectByteBuffer");
directByteBufferRConstructor = cl.getDeclaredConstructor(
long.class, int.class);
directByteBufferRConstructor = cl.getDeclaredConstructor(long.class, int.class);
}
else
{
/* the creator of DirectByteBuffer is changed in java 21+.
*/
Class<?> cl = Class.forName("java.nio.DirectByteBuffer");
directByteBufferRConstructor = cl.getDeclaredConstructor(
long.class, long.class);
directByteBufferRConstructor = cl.getDeclaredConstructor(long.class, long.class);
}
directByteBufferRConstructor.setAccessible(true);

5 changes: 3 additions & 2 deletions pixels-daemon/pom.xml
Original file line number Diff line number Diff line change
@@ -197,9 +197,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.plugin.compile.version}</version>
<configuration>
<source>11</source>
<target>11</target>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
Original file line number Diff line number Diff line change
@@ -19,9 +19,6 @@
*/
package io.pixelsdb.pixels.daemon.scaling.policy;

import java.io.IOException;
import java.io.InputStreamReader;

import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.pixelsdb.pixels.common.utils.ConfigFactory;
@@ -31,6 +28,8 @@
import org.apache.logging.log4j.Logger;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class AIASPolicy extends Policy
@@ -49,7 +48,8 @@ private void scaling(double[] cpuTimes, double[] memUsages)
log.info("INFO: expend to "+ WorkerNum1 + " or " + WorkerNum2);
}

public boolean transDump(long timestamp){
public boolean transDump(long timestamp)
{
String host = ConfigFactory.Instance().getProperty("trans.server.host");
int port = Integer.parseInt(ConfigFactory.Instance().getProperty("trans.server.port"));
ManagedChannel channel = ManagedChannelBuilder.forAddress(host,port)
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.useIncrementalCompilation>true</maven.compiler.useIncrementalCompilation>
<maven.plugin.source.version>3.1.0</maven.plugin.source.version>
<maven.plugin.compile.version>3.8.1</maven.plugin.compile.version>
<maven.plugin.shade.version>3.2.2</maven.plugin.shade.version>
<maven.plugin.assembly.version>3.5.0</maven.plugin.assembly.version>
<maven.plugin.deploy.version>3.1.0</maven.plugin.deploy.version>