Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.logging.common.jmx;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.StandardMBean;
import com.kdgregory.logging.aws.internal.AbstractWriterStatistics;
import com.kdgregory.logging.common.util.InternalLogger;
/**
* This class manages the relationships between the writer statistics beans
* and the JMX server(s) where they should be registered. Servers and beans
* may be added or removed in any order; this class ensures that beans will
* be registered with any new servers, and any new beans will be registered
* with all existing servers.
*
* This works by using a "marker bean" that is registered with an MBean server
* and also with the singleton instance of this class. Statistics beans are
* added to the singleton instance by their appender. Either type of addition
* is a trigger to ensure that the statistics beans are registered with all
* known servers.
*
* The object name used to register the marker bean is retained, and used as
* the base for the object name(s) used to register the statistics bean(s):
* the stats bean name will append ",appender=X", where X is the appender name.
*
* Subclasses are expected to manage the singleton instance.
*/
public abstract class AbstractJMXManager
{
// all members are marked protected so that they can be inspected by tests
protected InternalLogger logger;
protected Map