You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@edgent.apache.org by ddebrunner <gi...@git.apache.org> on 2016/04/01 23:46:04 UTC

[GitHub] incubator-quarks pull request: QUARKS-106 Replace getControls() wi...

GitHub user ddebrunner opened a pull request:

    https://github.com/apache/incubator-quarks/pull/66

    QUARKS-106 Replace getControls() with getControl()

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ddebrunner/incubator-quarks jsoncontrol-quarks-106

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-quarks/pull/66.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #66
    
----
commit e5652cec07e6d278ee6ec7ad55be4320ba5f4d54
Author: Dan Debrunner <dj...@debrunners.com>
Date:   2016-04-01T21:05:54Z

    QUARKS-106 Replace getControls() with getControl()

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quarks pull request: QUARKS-106 Replace getControls() wi...

Posted by vdogaru <gi...@git.apache.org>.
Github user vdogaru commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/66#discussion_r58276005
  
    --- Diff: runtime/jmxcontrol/src/main/java/quarks/runtime/jmxcontrol/JMXControlService.java ---
    @@ -127,29 +126,40 @@ public void unregister(String controlId) {
     	}
     
         @Override
    -    public <T> Set<T> getControls(Class<T> controlInterface) {
    +    public <T> T  getControl(String type, String alias, Class<T> controlInterface) {
             try {
                 MBeanServer mBeanServer = getMbs();
    -            Set<ObjectName> names = getObjectNamesForInterface(controlInterface.getName());
    +            Set<ObjectName> names = getObjectNamesForInterface(type, alias, controlInterface.getName());
    +            
    +            if (names.isEmpty())
    +                return null;
    +            if (names.size() != 1)
    +                throw new RuntimeException("Alias " + alias + " not unique for type " + type);
    --- End diff --
    
    I'm thinking that I would expect JMXControlService.register to throw an exception if I register two controls with the same type and alias (according to the ControlService docs?) Instead, I get an exception later, when I query?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quarks pull request: QUARKS-106 Replace getControls() wi...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-quarks/pull/66


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quarks pull request: QUARKS-106 Replace getControls() wi...

Posted by ddebrunner <gi...@git.apache.org>.
Github user ddebrunner commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/66#discussion_r58276512
  
    --- Diff: runtime/jmxcontrol/src/main/java/quarks/runtime/jmxcontrol/JMXControlService.java ---
    @@ -127,29 +126,40 @@ public void unregister(String controlId) {
     	}
     
         @Override
    -    public <T> Set<T> getControls(Class<T> controlInterface) {
    +    public <T> T  getControl(String type, String alias, Class<T> controlInterface) {
             try {
                 MBeanServer mBeanServer = getMbs();
    -            Set<ObjectName> names = getObjectNamesForInterface(controlInterface.getName());
    +            Set<ObjectName> names = getObjectNamesForInterface(type, alias, controlInterface.getName());
    +            
    +            if (names.isEmpty())
    +                return null;
    +            if (names.size() != 1)
    +                throw new RuntimeException("Alias " + alias + " not unique for type " + type);
    --- End diff --
    
    I'm just changing getControls() in this pull request. It only expects a single MBean registered, so if it finds more it complains.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---