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>
From Amnon:
"This series adopt the yammer Metric library to use with out API. The
library it self is taken as is by adding it to the Maven dependency. The
required adaptation is that information will not be added in push to the
library Metric, instead, when required, the specific Metric would use
the APIClient to fetch information from the system using the API.
This approach would mean that there will be little adaptation when code
would be passed from origin."
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Conflicts:
pom.xml
This adds the functionality that is used by the JMX from Origin.
The following files where import: FileUtils.java Pair.java
SnapshotDetailsTabularData.java, un needed functionality was removed to
minimize the dependency and they were placed in a util directory.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This adds the dependency for the yammer counter library and for the
google collection that are used with it.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
The urchin files (Client and Main) where moved to:
com.cloudius.urchin.api and com.cloudius.urchin.main respectively.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
This adds the java project that expose the system MBean.
The Main would start any required classes and would wait forever.
The mvn creates jar with main and set the classpath accordingly.
To start do:
java -jar target/urchin-mbean-1.0.jar
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>