Change version

This commit is contained in:
Andrea Cavalli 2023-01-24 16:06:39 +01:00
parent cd30267633
commit c43992ba08
11 changed files with 61 additions and 23 deletions

View File

@ -64,10 +64,10 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{_sysconfdir}/sysconfig/scylla-jmx %config(noreplace) %{_sysconfdir}/sysconfig/scylla-jmx
%{_unitdir}/scylla-jmx.service %{_unitdir}/scylla-jmx.service
/opt/scylladb/jmx/scylla-jmx /opt/scylladb/jmx/scylla-jmx
/opt/scylladb/jmx/scylla-jmx-1.0.jar /opt/scylladb/jmx/scylla-jmx-1.1.jar
/opt/scylladb/jmx/symlinks/scylla-jmx /opt/scylladb/jmx/symlinks/scylla-jmx
%{_prefix}/lib/scylla/jmx/scylla-jmx %{_prefix}/lib/scylla/jmx/scylla-jmx
%{_prefix}/lib/scylla/jmx/scylla-jmx-1.0.jar %{_prefix}/lib/scylla/jmx/scylla-jmx-1.1.jar
%{_prefix}/lib/scylla/jmx/symlinks/scylla-jmx %{_prefix}/lib/scylla/jmx/symlinks/scylla-jmx
%changelog %changelog

View File

@ -89,12 +89,10 @@ if ! $packaging; then
has_java=false has_java=false
if [ -x /usr/bin/java ]; then if [ -x /usr/bin/java ]; then
javaver=$(/usr/bin/java -version 2>&1|head -n1|cut -f 3 -d " ") javaver=$(/usr/bin/java -version 2>&1|head -n1|cut -f 3 -d " ")
if [[ "$javaver" =~ ^\"1.8.0 || "$javaver" =~ ^\"11.0. ]]; then has_java=true
has_java=true
fi
fi fi
if ! $has_java; then if ! $has_java; then
echo "Please install openjdk-8 or openjdk-11 before running install.sh." echo "Please install openjdk-8, openjdk-11, or openjdk-17 before running install.sh."
exit 1 exit 1
fi fi
fi fi
@ -152,12 +150,12 @@ WorkingDirectory=$rprefix
EOS EOS
fi fi
install -m644 scylla-jmx-1.0.jar "$rprefix/jmx" install -m644 scylla-jmx-1.1.jar "$rprefix/jmx"
install -m755 scylla-jmx "$rprefix/jmx" install -m755 scylla-jmx "$rprefix/jmx"
ln -sf /usr/bin/java "$rprefix/jmx/symlinks/scylla-jmx" ln -sf /usr/bin/java "$rprefix/jmx/symlinks/scylla-jmx"
if ! $nonroot; then if ! $nonroot; then
install -m755 -d "$rusr"/lib/scylla/jmx/symlinks install -m755 -d "$rusr"/lib/scylla/jmx/symlinks
ln -srf "$rprefix"/jmx/scylla-jmx-1.0.jar "$rusr"/lib/scylla/jmx/ ln -srf "$rprefix"/jmx/scylla-jmx-1.1.jar "$rusr"/lib/scylla/jmx/
ln -srf "$rprefix"/jmx/scylla-jmx "$rusr"/lib/scylla/jmx/ ln -srf "$rprefix"/jmx/scylla-jmx "$rusr"/lib/scylla/jmx/
ln -sf /usr/bin/java "$rusr"/lib/scylla/jmx/symlinks/scylla-jmx ln -sf /usr/bin/java "$rusr"/lib/scylla/jmx/symlinks/scylla-jmx
fi fi

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>scylla-jmx</artifactId> <artifactId>scylla-jmx</artifactId>
<version>1.0</version> <version>1.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<parent> <parent>
@ -35,8 +35,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version> <version>3.10.1</version>
<configuration> <configuration>
<source>17</source> <source>11</source>
<target>17</target> <target>11</target>
<compilerArgs> <compilerArgs>
<arg>--add-exports</arg> <arg>--add-exports</arg>
<arg>java.management/com.sun.jmx.mbeanserver=scylla.jmx</arg> <arg>java.management/com.sun.jmx.mbeanserver=scylla.jmx</arg>

View File

@ -57,7 +57,7 @@ ar.reloc_add('build/SCYLLA-VERSION-FILE', arcname='SCYLLA-VERSION-FILE')
ar.reloc_add('build/SCYLLA-PRODUCT-FILE', arcname='SCYLLA-PRODUCT-FILE') ar.reloc_add('build/SCYLLA-PRODUCT-FILE', arcname='SCYLLA-PRODUCT-FILE')
ar.reloc_add('dist') ar.reloc_add('dist')
ar.reloc_add('install.sh') ar.reloc_add('install.sh')
ar.reloc_add('target/scylla-jmx-1.0.jar', arcname='scylla-jmx-1.0.jar') ar.reloc_add('target/scylla-jmx-1.1.jar', arcname='scylla-jmx-1.1.jar')
ar.reloc_add('scripts/scylla-jmx', arcname='scylla-jmx') ar.reloc_add('scripts/scylla-jmx', arcname='scylla-jmx')
ar.reloc_add('README.md') ar.reloc_add('README.md')
ar.reloc_add('NOTICE') ar.reloc_add('NOTICE')

View File

@ -131,11 +131,13 @@ else
fi fi
fi fi
exec "$LOCATION_SCRIPTS"/symlinks/scylla-jmx $DEBUG \ "$LOCATION_SCRIPTS"/symlinks/scylla-jmx $DEBUG \
$API_PORT $API_ADDR $CONF_FILE -Xmx256m -XX:+UseSerialGC \ $API_PORT $API_ADDR $CONF_FILE -Xmx256m -XX:+UseSerialGC \
-XX:+HeapDumpOnOutOfMemoryError \ -XX:+HeapDumpOnOutOfMemoryError \
$JMX_AUTH $JMX_SSL $JMX_ADDR $JMX_LOCAL \ $JMX_AUTH $JMX_SSL $JMX_ADDR $JMX_LOCAL \
--add-exports java.management/com.sun.jmx.mbeanserver=scylla.jmx \
--add-exports java.management/com.sun.jmx.interceptor=scylla.jmx \
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMX_PORT \ -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMX_PORT \
-Djava.rmi.server.hostname=$HOSTNAME -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT \ -Djava.rmi.server.hostname=$HOSTNAME -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT \
-Djavax.management.builder.initial=com.scylladb.jmx.utils.APIBuilder \ -Djavax.management.builder.initial=com.scylladb.jmx.utils.APIBuilder \
$PROPERTIES -jar $LOCATION/scylla-jmx-1.0.jar $PROPERTIES -jar $LOCATION/scylla-jmx-1.1.jar

View File

@ -21,6 +21,11 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
<version>1.1.1</version>
</dependency>
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
@ -41,6 +46,11 @@
<artifactId>jersey-client</artifactId> <artifactId>jersey-client</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>3.1.0</version>
</dependency>
<dependency> <dependency>
<groupId>jakarta.json</groupId> <groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId> <artifactId>jakarta.json-api</artifactId>
@ -80,7 +90,7 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version> <version>3.10.1</version>
<configuration> <configuration>
<release>17</release> <release>11</release>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -102,7 +102,12 @@ public class APIClient {
} }
} }
} }
return webTarget.request(MediaType.APPLICATION_JSON); try {
return webTarget.request(MediaType.APPLICATION_JSON);
} catch (Exception ex) {
ex.printStackTrace();
throw ex;
}
} }
public Invocation.Builder get(String path) { public Invocation.Builder get(String path) {

View File

@ -1,6 +1,7 @@
module scylla.apiclient { module scylla.apiclient {
exports com.scylladb.jmx.api; exports com.scylladb.jmx.api;
exports com.scylladb.jmx.api.utils; exports com.scylladb.jmx.api.utils;
requires org.eclipse.parsson;
requires jakarta.ws.rs; requires jakarta.ws.rs;
requires com.fasterxml.jackson.jakarta.rs.json; requires com.fasterxml.jackson.jakarta.rs.json;
requires jersey.client; requires jersey.client;
@ -10,4 +11,5 @@ module scylla.apiclient {
requires org.yaml.snakeyaml; requires org.yaml.snakeyaml;
requires com.google.common; requires com.google.common;
requires jersey.common; requires jersey.common;
requires jersey.hk2;
} }

View File

@ -27,12 +27,27 @@ import com.scylladb.jmx.api.APIConfig;
import com.scylladb.jmx.metrics.APIMBean; import com.scylladb.jmx.metrics.APIMBean;
public class Main { public class Main {
// todo: command line options. Make us an agent class (also)
private static final APIConfig config = new APIConfig(); private static APIConfig config;
public static final APIClient client = new APIClient(config); private static APIClient client;
public static synchronized APIConfig getApiConfig() {
if (config == null) {
config = new APIConfig();
}
return config;
}
public static synchronized APIClient getApiClient() {
if (client == null) {
client = new APIClient(getApiConfig());
}
return client;
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
System.out.println("Connecting to " + config.getBaseUrl()); System.out.printf("Java %s%n", System.getProperty("java.version"));
System.out.printf("Connecting to %s%n", getApiConfig().getBaseUrl());
System.out.println("Starting the JMX server"); System.out.println("Starting the JMX server");
MBeanServer server = getPlatformMBeanServer(); MBeanServer server = getPlatformMBeanServer();
@ -40,7 +55,7 @@ public class Main {
CommitLog.class, Gossiper.class, EndpointSnitchInfo.class, FailureDetector.class, CacheService.class, CommitLog.class, Gossiper.class, EndpointSnitchInfo.class, FailureDetector.class, CacheService.class,
CompactionManager.class, GCInspector.class, StreamManager.class)) { CompactionManager.class, GCInspector.class, StreamManager.class)) {
Constructor<? extends APIMBean> c = clazz.getDeclaredConstructor(APIClient.class); Constructor<? extends APIMBean> c = clazz.getDeclaredConstructor(APIClient.class);
APIMBean m = c.newInstance(client); APIMBean m = c.newInstance(getApiClient());
server.registerMBean(m, null); server.registerMBean(m, null);
} }

View File

@ -3,7 +3,7 @@ package com.scylladb.jmx.utils;
* Copyright 2016 ScyllaDB * Copyright 2016 ScyllaDB
*/ */
import static com.scylladb.jmx.main.Main.client; import static com.scylladb.jmx.main.Main.getApiClient;
import static com.sun.jmx.mbeanserver.Util.wildmatch; import static com.sun.jmx.mbeanserver.Util.wildmatch;
import static java.util.logging.Level.SEVERE; import static java.util.logging.Level.SEVERE;
import static javax.management.MBeanServerDelegate.DELEGATE_NAME; import static javax.management.MBeanServerDelegate.DELEGATE_NAME;
@ -491,6 +491,6 @@ public class APIBuilder extends MBeanServerBuilder {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return new APIMBeanServer(client, nested); return new APIMBeanServer(getApiClient(), nested);
} }
} }

View File

@ -1,4 +1,10 @@
module scylla.jmx { module scylla.jmx {
opens com.scylladb.jmx.utils;
exports com.scylladb.jmx.utils;
opens com.scylladb.jmx.main;
exports com.scylladb.jmx.main;
opens com.scylladb.jmx.metrics;
exports com.scylladb.jmx.metrics;
requires java.logging; requires java.logging;
requires java.management; requires java.management;
requires scylla.apiclient; requires scylla.apiclient;