649922fed8
The API returns errors with an HTTP code 400, 404 or 500 depending on the cause with a json object that contains the failure reason. The error message should be populate to the JMX calling client, translated to the appropriate exception. This patch adds the ability to detect API failure and throw a runtime exception with the returned message. It is up to the calling method what to do with the exception, if it would do nothing, the calling client would get a RuntimeException, depends on origin MBean definition, the caller can catch the exception and throw a specific kind. Note that any exception that is thrown must be known to the JMX client or it will not be able to process it. As a first step, this patch replaces the jersey client to the newer version under glassfish, which has an easy way of getting a Reply object, and check its status before returning the results. The only difference in the method that uses the APIClient is the use of MultivaluedHashMap. The following MBean implementation where changed ColumnFamily CompactionManager Gossiper EndpointSnitchInfo CacheService StorageProxy StorageService Signed-off-by: Amnon Heiman <amnon@scylladb.com>
93 lines
3.3 KiB
XML
93 lines
3.3 KiB
XML
<project xmlns="http://maven.apache.org/POM/4.0.0" 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">
|
|
<modelVersion>4.0.0</modelVersion>
|
|
|
|
<groupId>com.cloudius.urchin</groupId>
|
|
<artifactId>urchin-mbean</artifactId>
|
|
<version>1.0</version>
|
|
<packaging>jar</packaging>
|
|
|
|
<name>Urchin MBean</name>
|
|
|
|
<properties>
|
|
<maven.compiler.target>1.7</maven.compiler.target>
|
|
<maven.compiler.source>1.7</maven.compiler.source>
|
|
</properties>
|
|
|
|
<dependencies>
|
|
<dependency>
|
|
<groupId>org.glassfish.jersey.core</groupId>
|
|
<artifactId>jersey-common</artifactId>
|
|
<version>2.22.1</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>javax.ws.rs</groupId>
|
|
<artifactId>javax.ws.rs-api</artifactId>
|
|
<version>2.0.1</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>javax.ws.rs</groupId>
|
|
<artifactId>jsr311-api</artifactId>
|
|
<version>1.1.1</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.glassfish.jersey.core</groupId>
|
|
<artifactId>jersey-client</artifactId>
|
|
<version>2.22.1</version>
|
|
</dependency>
|
|
|
|
<dependency>
|
|
<groupId>junit</groupId>
|
|
<artifactId>junit</artifactId>
|
|
<version>4.8.2</version>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.glassfish</groupId>
|
|
<artifactId>javax.json</artifactId>
|
|
<version>1.0.4</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>com.google.guava</groupId>
|
|
<artifactId>guava</artifactId>
|
|
<version>18.0</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>com.yammer.metrics</groupId>
|
|
<artifactId>metrics-core</artifactId>
|
|
<version>2.2.0</version>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>com.google.collections</groupId>
|
|
<artifactId>google-collections</artifactId>
|
|
<version>1.0</version>
|
|
</dependency>
|
|
</dependencies>
|
|
<build>
|
|
<plugins>
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-shade-plugin</artifactId>
|
|
<version>2.4.1</version>
|
|
<executions>
|
|
<execution>
|
|
<phase>package</phase>
|
|
<goals>
|
|
<goal>shade</goal>
|
|
</goals>
|
|
<configuration>
|
|
<transformers>
|
|
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
|
<manifestEntries>
|
|
<Main-Class>com.cloudius.urchin.main.Main</Main-Class>
|
|
</manifestEntries>
|
|
</transformer>
|
|
</transformers>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</project>
|