Search in sources :

Example 1 with PluginPoint

use of org.glassfish.external.probe.provider.PluginPoint in project Payara by payara.

the class StatsProviderManagerDelegateImpl method enableStatsProvider.

private void enableStatsProvider(StatsProviderRegistryElement spre) {
    Object statsProvider = spre.getStatsProvider();
    if (logger.isLoggable(Level.FINE))
        logger.fine("Enabling the statsProvider - " + statsProvider.getClass().getName());
    // Check if we already have TreeNodes created
    if (spre.getParentTreeNodePath() == null) {
        /* Verify if PluginPoint exists, create one if it doesn't */
        PluginPoint pp = spre.getPluginPoint();
        String subTreePath = spre.getSubTreePath();
        TreeNode ppNode = getPluginPointNode(pp, serverNode);
        TreeNode parentNode = createSubTree(ppNode, subTreePath);
        List<String> childNodeNames = createTreeForStatsProvider(parentNode, statsProvider);
        spre.setParentTreeNodePath(parentNode.getCompletePathName());
        spre.setChildNodeNames(childNodeNames);
    } else {
        updateTreeNodes(spre, true);
    }
    /* Step 2. reset statistics (OFF --> LOW, OFF --> HIGH)*/
    resetStatistics(spre);
    /* Step 3. register the StatsProvider to the flashlight */
    if (spre.getHandles() == null) {
        // register with flashlight and save the handles
        Collection<ProbeClientMethodHandle> handles = registerStatsProviderToFlashlight(statsProvider);
        spre.setHandles(handles);
    } else {
        // Enable the Flashlight handles for this statsProvider
        for (ProbeClientMethodHandle handle : spre.getHandles()) {
            if (!handle.isEnabled())
                handle.enable();
        }
    }
    /* Step 4. gmbal registration */
    if (AMXReady && getMbeanEnabledValue()) {
        // Create mom root using the statsProvider
        String subTreePath = spre.getSubTreePath();
        ManagedObjectManager mom = spre.getManagedObjectManager();
        if (mom == null) {
            mom = registerGmbal(statsProvider, subTreePath);
            spre.setManagedObjectManager(mom);
        }
    }
    spre.setEnabled(true);
}
Also used : TreeNode(org.glassfish.flashlight.datatree.TreeNode) ManagedObjectManager(org.glassfish.gmbal.ManagedObjectManager) ProbeClientMethodHandle(org.glassfish.flashlight.client.ProbeClientMethodHandle) PluginPoint(org.glassfish.external.probe.provider.PluginPoint)

Aggregations

PluginPoint (org.glassfish.external.probe.provider.PluginPoint)1 ProbeClientMethodHandle (org.glassfish.flashlight.client.ProbeClientMethodHandle)1 TreeNode (org.glassfish.flashlight.datatree.TreeNode)1 ManagedObjectManager (org.glassfish.gmbal.ManagedObjectManager)1