Package org.glassfish.admin.monitor.StatsProviderRegistry

Examples of org.glassfish.admin.monitor.StatsProviderRegistry.StatsProviderRegistryElement


    }

    public void unregister(Object statsProvider) {
        // Unregisters the statsProvider
        try {
            StatsProviderRegistryElement spre = statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);
            if (spre == null) {
                logger.log(Level.INFO, invalidStatsProvider,
                        new Object[]{statsProvider.getClass().getName()});
                return;
            }

            // get the Parent node and delete all children nodes (only that we know of)
            String parentNodePath = spre.getParentTreeNodePath();
            List<String> childNodeNames = spre.getChildTreeNodeNames();
            TreeNode rootNode = mrdr.get(instanceName);
            if ((rootNode != null) && (parentNodePath != null)) {
                // This has to return one node
                List<TreeNode> nodeList = rootNode.getNodes(parentNodePath, false, true);
                if (nodeList.size() > 0) {
                    TreeNode parentNode = nodeList.get(0);
                    //Remove each of the child nodes
                    Collection<TreeNode> childNodes = parentNode.getChildNodes();
                    for (TreeNode childNode : childNodes) {
                        if (childNodeNames.contains(childNode.getName())) {
                            parentNode.removeChild(childNode);
                        }
                    }
                    if (!parentNode.hasChildNodes())
                        removeParentNode(parentNode);
                }
            }

            //get the handles and unregister the listeners from Flashlight
            Collection<ProbeClientMethodHandle> handles = spre.getHandles();
            if (handles != null) {
                for (ProbeClientMethodHandle handle : handles) {
                    // handle.remove????? Mahesh?
                    //TODO IMPLEMENTATION
                    //For now disable the handle => remove the client from invokerlist
                    handle.disable();
                }
            }

            //unregister the statsProvider from Gmbal
            if (spre.getManagedObjectManager() != null)
                unregisterGmbal(spre);

            //Unregister from the MonitoringDataTreeRegistry and the map entries
            statsProviderRegistry.unregisterStatsProvider(statsProvider);
        }
View Full Code Here


        }
    }

    public void setHandlesForStatsProviders(Object statsProvider, Collection<ProbeClientMethodHandle> handles) {
        // save the handles also against statsProvider so you can unregister when statsProvider is unregistered
        StatsProviderRegistryElement spre =
                this.statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);
        spre.setHandles(handles);
    }
View Full Code Here

         standard reset methods on Statistic classes*/
        for (Method m : statsProvider.getClass().getMethods()) {
            ManagedAttribute ma = m.getAnnotation(ManagedAttribute.class);
            Reset resetMeth = m.getAnnotation(Reset.class);
            if (resetMeth != null) {
                StatsProviderRegistryElement spre = this.statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);
                spre.setResetMethod(m);
            }
            if (ma != null) {
                String methodName = m.getName();
                String id = ma.id();
                if ((id == null) || id.isEmpty()) { // if id not specified, derive from method name
View Full Code Here

    private Collection<ProbeClientMethodHandle> registerStatsProviderToFlashlight(Object statsProvider) {
        //register the statsProvider with Flashlight
        Collection<ProbeClientMethodHandle> handles = null;
        //System.out.println("****** Registering the StatsProvider (" + statsProvider.getClass().getName() + ") with flashlight");
        StatsProviderRegistryElement spre =
                this.statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);
        if (spre != null) {
            handles = pcm.registerListener(statsProvider, spre.getInvokerId());
        }
        else {
            handles = pcm.registerListener(statsProvider);
        }
        //System.out.println("********* handles = " + handles);
View Full Code Here

TOP

Related Classes of org.glassfish.admin.monitor.StatsProviderRegistry.StatsProviderRegistryElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.