You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Denis Magda (JIRA)" <ji...@apache.org> on 2015/11/13 13:20:11 UTC

[jira] [Commented] (IGNITE-1900) Ignite JMX problem with Spring Boot

    [ https://issues.apache.org/jira/browse/IGNITE-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15003919#comment-15003919 ] 

Denis Magda commented on IGNITE-1900:
-------------------------------------

I've applied your patch on my side and got {{ClassCastException}}. I'm using the latest sources from the master branch.

{noformat}
Exception in thread "main" java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Set
	at org.apache.ignite.internal.IgniteKernal.getUserAttributesFormatted(IgniteKernal.java:571)
	at org.gridgain.fsb.ServerTest.main(ServerTest.java:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
{noformat}

Code that I executed {{((IgniteKernal)ignite).getUserAttributesFormatted();}}.

Please follow this steps and then re-submit the pull-request:

1) Fix {{ClassCastException}}. It's absolutely correct to return {{Set}} from {{getUserAttributesFormatted()}}. Re-implement IgniteKernal's implementation by removing usage of {{F.transform}} function. Just create a set and prefill it with data.

2) Add tests that will validate that the functions modified by you return what is expected from them. You can add the tests into {{GridMBeanSelfTest}}.

3) When everything is fixed resubmit the pull-request and move this ticket to "PATCH_AVAILABLE" state. This will trigger our TeamCity to check your patch against all the tests we have in Ignite.
Full info on how to contribute using pull-request is located here: https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-1.CreateGitHubpull-request

BTW, look though our coding guidelines (https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines). Now I don't see any issues related to the guidelines, just in order to prevent them in the future.

> Ignite JMX problem with Spring Boot
> -----------------------------------
>
>                 Key: IGNITE-1900
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1900
>             Project: Ignite
>          Issue Type: Bug
>          Components: 1.4
>    Affects Versions: ignite-1.4
>            Reporter: wmz7year
>
> I use Ignite with Spring Boot.
> When start application,Spring Boot will register JMX info.
> In IgniteMXBean interface,There is two method getUserAttributesFormatted and getLifecycleBeansFormatted return Collection<String>
> But In JMX DefaultMXBeanMappingFactory.makeParameterizedTypeMapping method will get method return type.
> {noformat}
>  final Type rawType = objType.getRawType();
>         if (rawType instanceof Class<?>) {
>             Class<?> c = (Class<?>) rawType;
>             if (c == List.class || c == Set.class || c == SortedSet.class) {
>                 Type[] actuals = objType.getActualTypeArguments();
>                 assert(actuals.length == 1);
>                 if (c == SortedSet.class)
>                     mustBeComparable(c, actuals[0]);
>                 return makeArrayOrCollectionMapping(objType, actuals[0], factory);
>             } else {
>                 boolean sortedMap = (c == SortedMap.class);
>                 if (c == Map.class || sortedMap) {
>                     Type[] actuals = objType.getActualTypeArguments();
>                     assert(actuals.length == 2);
>                     if (sortedMap)
>                         mustBeComparable(c, actuals[0]);
>                     return makeTabularMapping(objType, sortedMap,
>                             actuals[0], actuals[1], factory);
>                 }
>             }
>         }
> {noformat}
> The Collection<String> will not match any type for this although IgniteKernal return type is Set or List.
> I think IgniteMXBean interface should change Collection to Set and List



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)