com.clustercontrol.monitor.run.factory.RunMonitor.java Source code

Java tutorial

Introduction

Here is the source code for com.clustercontrol.monitor.run.factory.RunMonitor.java

Source

/*
    
Copyright (C) 2006 NTT DATA Corporation
    
This program is free software; you can redistribute it and/or
Modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, version 2.
    
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the GNU General Public License for more details.
    
 */

package com.clustercontrol.monitor.run.factory;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.Future;
import java.util.concurrent.Semaphore;

import javax.persistence.EntityExistsException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.clustercontrol.bean.HinemosModuleConstant;
import com.clustercontrol.bean.PriorityConstant;
import com.clustercontrol.calendar.session.CalendarControllerBean;
import com.clustercontrol.collect.bean.Sample;
import com.clustercontrol.collect.util.CollectDataUtil;
import com.clustercontrol.fault.CalendarNotFound;
import com.clustercontrol.fault.FacilityNotFound;
import com.clustercontrol.fault.HinemosUnknown;
import com.clustercontrol.fault.InvalidRole;
import com.clustercontrol.fault.MonitorNotFound;
import com.clustercontrol.hub.bean.StringSample;
import com.clustercontrol.hub.util.CollectStringDataUtil;
import com.clustercontrol.monitor.run.bean.MonitorRunResultInfo;
import com.clustercontrol.monitor.run.bean.MonitorTypeConstant;
import com.clustercontrol.monitor.run.model.MonitorInfo;
import com.clustercontrol.monitor.run.model.MonitorJudgementInfo;
import com.clustercontrol.monitor.run.util.MonitorExecuteTask;
import com.clustercontrol.monitor.run.util.NodeMonitorPollerController;
import com.clustercontrol.monitor.run.util.NodeToMonitorCache;
import com.clustercontrol.monitor.run.util.ParallelExecution;
import com.clustercontrol.monitor.run.util.QueryUtil;
import com.clustercontrol.notify.bean.OutputBasicInfo;
import com.clustercontrol.notify.model.NotifyRelationInfo;
import com.clustercontrol.notify.session.NotifyControllerBean;
import com.clustercontrol.performance.bean.CollectedDataErrorTypeConstant;
import com.clustercontrol.repository.model.NodeInfo;
import com.clustercontrol.repository.session.RepositoryControllerBean;
import com.clustercontrol.util.HinemosTime;
import com.clustercontrol.util.MessageConstant;
import com.clustercontrol.util.apllog.AplLogger;

/**
 * ?<BR>
 * <p>
 * ???????????
 *
 * @version 4.0.0
 * @since 2.0.0
 */
abstract public class RunMonitor {

    /** ? */
    private static Log m_log = LogFactory.getLog(RunMonitor.class);

    /** ? */
    private static final String MESSAGE_INFO = MessageConstant.MESSAGE_PRIORITY_SCOPE_INFO.getMessage();
    /** ? */
    private static final String MESSAGE_WARNING = MessageConstant.MESSAGE_PRIORITY_SCOPE_WARNING.getMessage();
    /** ?? */
    private static final String MESSAGE_CRITICAL = MessageConstant.MESSAGE_PRIORITY_SCOPE_CRITICAL.getMessage();
    /** ?? */
    private static final String MESSAGE_UNKNOWN = MessageConstant.UNKNOWN.getMessage();

    /** ??? */
    protected MonitorInfo m_monitor;

    /** ID */
    protected String m_monitorTypeId;

    /** ID */
    protected String m_monitorId;

    /** ID */
    private String m_notifyGroupId;

    /** ID */
    protected String m_facilityId;

    /**
     * ?????
     * ????(-1)????
     * setMonitorInfo???????????
     *
     * @see #setMonitorInfo(String, String)
     */
    protected int m_failurePriority = PriorityConstant.TYPE_FAILURE;

    /** ? */
    protected int m_runInterval;

    /**  */
    protected Date m_now;

    /**  ?? */
    protected long m_scopeDate;

    /**  ?? */
    protected long m_nodeDate;

    /** ?? */
    protected int m_monitorBlock;

    /**  */
    protected boolean m_isNode;

    /**  */
    protected volatile Map<String, NodeInfo> nodeInfo;

    /** ???? */
    protected HashMap<Integer, ArrayList<String>> m_priorityMap;

    /** ????? */
    protected boolean m_isInCalendarTerm;

    /** ??????? */
    protected boolean m_isInNextCalendarTerm;

    /** ??????true????false:??? */
    protected boolean m_isMonitorJob = false;

    /** ?? */
    protected MonitorRunResultInfo m_monitorRunResultInfo;

    /** ??? */
    protected Object m_curData = null;

    /** ???? */
    protected Object m_prvData = null;

    /**
     * 
     * <p>
     * <dl>
     *  <dt></dt>
     *  <dd>??{@link com.clustercontrol.monitor.run.bean.TruthConstant}</dd>
     *  <dd>??{@link com.clustercontrol.bean.PriorityConstant}</dd>
     *  <dd>?{@link com.clustercontrol.monitor.run.ejb.entity.MonitorStringValueInfoBean#getOrder_no()}</dd>
     * </dl>
     */
    protected TreeMap<Integer, MonitorJudgementInfo> m_judgementInfoList;

    /** ? */
    protected double m_value;

    /**
     * ???????
     * ????????
     * ??????
     *
     * @param monitorTypeId ID
     * @param monitorId ID
     * @param facilityId ID
     * @param prvData ???
     * @throws FacilityNotFound
     * @throws MonitorNotFound
     * @throws InvalidRole
     * @throws HinemosUnknown
     *
     * @see #runMonitorInfo()
     */
    public MonitorRunResultInfo runMonitor(String monitorTypeId, String monitorId, String facilityId,
            Object prvData) throws FacilityNotFound, MonitorNotFound, InvalidRole, HinemosUnknown {

        this.initialize(monitorTypeId);

        m_isMonitorJob = true;
        m_facilityId = facilityId;
        m_monitorTypeId = monitorTypeId;
        m_monitorId = monitorId;
        m_prvData = prvData;

        boolean isSuccess = false;

        try {
            // 
            isSuccess = runMonitorInfo();
        } finally {
            if (!isSuccess) {
                String[] args = { m_monitorTypeId, "" };
                AplLogger.put(PriorityConstant.TYPE_WARNING, HinemosModuleConstant.MONITOR,
                        MessageConstant.MESSAGE_SYS_012_MON, args);
            }
            // ?
            this.terminate();

        }
        // ???
        return m_monitorRunResultInfo;
    }

    /**
     * ???????
     * ????????
     *
     * @param monitorTypeId ID
     * @param monitorId ID
     * @throws FacilityNotFound
     * @throws MonitorNotFound
     * @throws InvalidRole
     * @throws HinemosUnknown
     *
     * @see #runMonitorInfo()
     */
    public void runMonitor(String monitorTypeId, String monitorId)
            throws FacilityNotFound, MonitorNotFound, InvalidRole, HinemosUnknown {

        this.initialize(monitorTypeId);

        m_monitorTypeId = monitorTypeId;
        m_monitorId = monitorId;

        boolean isSuccess = false;

        try {
            // 
            isSuccess = runMonitorInfo();
        } finally {
            if (!isSuccess) {
                String[] args = { m_monitorTypeId, m_monitorId };
                AplLogger.put(PriorityConstant.TYPE_WARNING, HinemosModuleConstant.MONITOR,
                        MessageConstant.MESSAGE_SYS_012_MON, args);
            }
            // ?
            this.terminate();
        }
    }

    /**
     * ????
     * <p>
     * <ol>
     * <li>????????{@link #setMonitorInfo(String, String)}</li>
     * <li>?????????{@link #setJudgementInfo()}</li>
     * <li>??????????{@link #setCheckInfo()}</li>
     * <li>???????? {@link #collect(String)}</li>
     * <li>???????? {@link #getCheckResult(boolean)}</li>
     * <li>?????????{@link #getPriority(int)}</li>
     * <li>????{@link #notify(boolean, String, int, Date)}</li>
     * </ol>
     *
     * @return ??????</code> true </code>
     * @throws FacilityNotFound
     * @throws MonitorNotFound
     * @throws InvalidRole
     * @throws EntityExistsException
     * @throws HinemosUnknown
     *
     * @see #setMonitorInfo(String, String)
     * @see #setJudgementInfo()
     * @see #setCheckInfo()
     * @see #collect(String)
     * @see #getCheckResult(boolean)
     * @see #getPriority(int)
     * @see #notify(boolean, String, int, Date)
     */
    protected boolean runMonitorInfo()
            throws FacilityNotFound, MonitorNotFound, InvalidRole, EntityExistsException, HinemosUnknown {

        m_now = HinemosTime.getDateInstance();

        m_priorityMap = new HashMap<Integer, ArrayList<String>>();
        m_priorityMap.put(Integer.valueOf(PriorityConstant.TYPE_INFO), new ArrayList<String>());
        m_priorityMap.put(Integer.valueOf(PriorityConstant.TYPE_WARNING), new ArrayList<String>());
        m_priorityMap.put(Integer.valueOf(PriorityConstant.TYPE_CRITICAL), new ArrayList<String>());
        m_priorityMap.put(Integer.valueOf(PriorityConstant.TYPE_UNKNOWN), new ArrayList<String>());
        List<Sample> sampleList = new ArrayList<Sample>();
        List<StringSample> collectedSamples = new ArrayList<>();

        try {
            // 
            boolean run = this.setMonitorInfo(m_monitorTypeId, m_monitorId);
            if (!run) {
                // ?
                return true;
            }

            // 
            setJudgementInfo();

            // ??
            setCheckInfo();

            ArrayList<String> facilityList = null;
            ExecutorCompletionService<MonitorRunResultInfo> ecs = new ExecutorCompletionService<MonitorRunResultInfo>(
                    ParallelExecution.instance().getExecutorService());
            int taskCount = 0;

            if (!m_isMonitorJob) {
                // ??
                // ID?????
                // /?true?????ID??
                facilityList = new RepositoryControllerBean().getExecTargetFacilityIdList(m_facilityId,
                        m_monitor.getOwnerRoleId());
                if (facilityList.size() == 0) {
                    return true;
                }

                m_isNode = new RepositoryControllerBean().isNode(m_facilityId);

                // ???????
                nodeInfo = new HashMap<String, NodeInfo>();
                for (String facilityId : facilityList) {
                    try {
                        synchronized (this) {
                            nodeInfo.put(facilityId, new RepositoryControllerBean().getNode(facilityId));
                        }
                    } catch (FacilityNotFound e) {
                        // ???
                    }
                }

                m_log.debug("monitor start : monitorTypeId : " + m_monitorTypeId + ", monitorId : " + m_monitorId);

                /**
                 * ?
                 */
                // ID???????
                Iterator<String> itr = facilityList.iterator();
                while (itr.hasNext()) {
                    String facilityId = itr.next();
                    if (facilityId != null && !"".equals(facilityId)) {

                        // ???RunMonitor????
                        // ?????????????
                        RunMonitor runMonitor = this.createMonitorInstance();

                        // ?????
                        runMonitor.m_monitorTypeId = this.m_monitorTypeId;
                        runMonitor.m_monitorId = this.m_monitorId;
                        runMonitor.m_now = this.m_now;
                        runMonitor.m_priorityMap = this.m_priorityMap;
                        runMonitor.setMonitorInfo(runMonitor.m_monitorTypeId, runMonitor.m_monitorId);
                        runMonitor.setJudgementInfo();
                        runMonitor.setCheckInfo();
                        runMonitor.nodeInfo = this.nodeInfo;

                        ecs.submit(new MonitorExecuteTask(runMonitor, facilityId));
                        taskCount++;

                        if (m_log.isDebugEnabled()) {
                            m_log.debug("starting monitor result : monitorId = " + m_monitorId + ", facilityId = "
                                    + facilityId);
                        }
                    } else {
                        facilityList.remove(facilityId);
                    }
                }

            } else {
                // ??
                // ID?????
                // /?true?????ID??
                facilityList = new RepositoryControllerBean().getExecTargetFacilityIdList(m_facilityId,
                        m_monitor.getOwnerRoleId());
                if (facilityList.size() != 1 || !facilityList.get(0).equals(m_facilityId)) {
                    return true;
                }

                m_isNode = true;

                // ???????
                nodeInfo = new HashMap<String, NodeInfo>();
                try {
                    synchronized (this) {
                        nodeInfo.put(m_facilityId, new RepositoryControllerBean().getNode(m_facilityId));
                    }
                } catch (FacilityNotFound e) {
                    // ???
                }
                m_log.debug("monitor start : monitorTypeId : " + m_monitorTypeId + ", monitorId : " + m_monitorId);

                /**
                 * ?
                 */
                // ???RunMonitor????
                // ?????????????
                RunMonitor runMonitor = this.createMonitorInstance();

                // ?????
                runMonitor.m_isMonitorJob = this.m_isMonitorJob;
                runMonitor.m_monitorTypeId = this.m_monitorTypeId;
                runMonitor.m_monitorId = this.m_monitorId;
                runMonitor.m_now = this.m_now;
                runMonitor.m_priorityMap = this.m_priorityMap;
                runMonitor.setMonitorInfo(runMonitor.m_monitorTypeId, runMonitor.m_monitorId);
                runMonitor.setJudgementInfo();
                runMonitor.setCheckInfo();
                runMonitor.nodeInfo = this.nodeInfo;
                runMonitor.m_prvData = this.m_prvData;

                ecs.submit(new MonitorExecuteTask(runMonitor, m_facilityId));
                taskCount++;

                if (m_log.isDebugEnabled()) {
                    m_log.debug("starting monitor result : monitorId = " + m_monitorId + ", facilityId = "
                            + m_facilityId);
                }
            }

            /**
             * ??
             */
            MonitorRunResultInfo result = new MonitorRunResultInfo(); // ??

            m_log.debug("total start : monitorTypeId : " + m_monitorTypeId + ", monitorId : " + m_monitorId);

            // ???
            StringSample strSample = null;
            Sample sample = null;
            if (m_monitor.getCollectorFlg()) {
                //? - 
                if (m_monitor.getMonitorType() == MonitorTypeConstant.TYPE_STRING
                        || m_monitor.getMonitorType() == MonitorTypeConstant.TYPE_TRAP) {
                    strSample = new StringSample(HinemosTime.getDateInstance(), m_monitor.getMonitorId());
                }
                //? - 
                else {
                    sample = new Sample(HinemosTime.getDateInstance(), m_monitor.getMonitorId());
                }
            }

            for (int i = 0; i < taskCount; i++) {
                Future<MonitorRunResultInfo> future = ecs.take();
                result = future.get(); // ??

                String facilityId = result.getFacilityId();
                m_nodeDate = result.getNodeDate();

                if (m_log.isDebugEnabled()) {
                    m_log.debug("finished monitor : monitorId = " + m_monitorId + ", facilityId = " + facilityId);
                }

                //??????????
                if (m_monitor.getMonitorType() == MonitorTypeConstant.TYPE_STRING
                        || m_monitor.getMonitorType() == MonitorTypeConstant.TYPE_TRAP) {
                    if (strSample != null) {
                        strSample.set(facilityId, m_monitor.getMonitorTypeId(), result.getMessageOrg());
                    }
                }

                if (!m_isMonitorJob) {
                    // ???
                    if (result.getProcessType().booleanValue()) {
                        // ?
                        notify(true, facilityId, result.getCheckResult(), new Date(m_nodeDate), result);
                        // ???
                        if (sample != null) {
                            int errorType = -1;
                            if (result.isCollectorResult()) {
                                errorType = CollectedDataErrorTypeConstant.NOT_ERROR;
                            } else {
                                errorType = CollectedDataErrorTypeConstant.UNKNOWN;
                            }
                            sample.set(facilityId, m_monitor.getItemName(), result.getValue(), errorType);
                        }
                    }
                } else {
                    m_monitorRunResultInfo = new MonitorRunResultInfo();
                    m_monitorRunResultInfo.setPriority(result.getPriority());
                    m_monitorRunResultInfo.setCheckResult(result.getCheckResult());
                    m_monitorRunResultInfo.setNodeDate(m_nodeDate);
                    m_monitorRunResultInfo
                            .setMessageOrg(makeJobOrgMessage(result.getMessageOrg(), result.getMessage()));
                    m_monitorRunResultInfo.setCurData(result.getCurData());
                }
            }

            // ?????
            if (m_monitor.getMonitorType() == MonitorTypeConstant.TYPE_STRING
                    || m_monitor.getMonitorType() == MonitorTypeConstant.TYPE_TRAP) {
                //? - ?????
                if (strSample != null) {
                    collectedSamples.add(strSample);
                }
                if (!collectedSamples.isEmpty()) {
                    CollectStringDataUtil.store(collectedSamples);
                }
            } else {
                if (sample != null) {
                    sampleList.add(sample);
                }
                if (!sampleList.isEmpty()) {
                    CollectDataUtil.put(sampleList);
                }
            }

            m_log.debug("monitor end : monitorTypeId : " + m_monitorTypeId + ", monitorId : " + m_monitorId);

            return true;

        } catch (FacilityNotFound e) {
            throw e;
        } catch (InterruptedException e) {
            m_log.info("runMonitorInfo() monitorTypeId = " + m_monitorTypeId + ", monitorId  = " + m_monitorId
                    + " : " + e.getClass().getSimpleName() + ", " + e.getMessage());
            return false;
        } catch (ExecutionException e) {
            m_log.info("runMonitorInfo() monitorTypeId = " + m_monitorTypeId + ", monitorId  = " + m_monitorId
                    + " : " + e.getClass().getSimpleName() + ", " + e.getMessage());
            return false;
        }
    }

    /**
     * ???????
     * ????????
     * 
     * ?????????????? runMonitorInfo ????
     * ??FacilityId??????????????????
     * ???ID???????runMonitorInfo??????
     *
     * @param monitorTypeId ID
     * @param facilityId ID
     * @throws FacilityNotFound
     * @throws MonitorNotFound
     * @throws InvalidRole
     * @throws HinemosUnknown
     *
     * @see #runMonitorInfo()
     */
    public void runMonitorAggregateByNode(String monitorTypeId, String facilityId)
            throws FacilityNotFound, MonitorNotFound, InvalidRole, HinemosUnknown {

        this.initialize(monitorTypeId);

        m_monitorTypeId = monitorTypeId;
        m_facilityId = facilityId;
        m_now = HinemosTime.getDateInstance();

        boolean isSuccess = false;

        try {
            // 
            isSuccess = runMonitorInfoAggregateByNode();
        } finally {
            if (!isSuccess) {
                String[] args = { m_monitorTypeId, facilityId };
                AplLogger.put(PriorityConstant.TYPE_WARNING, HinemosModuleConstant.MONITOR,
                        MessageConstant.MESSAGE_SYS_013_MON, args);
            }
            // ?
            this.terminate();
        }
    }

    /**
     * FacilityId????????
     * 
     * @return ??????</code> true </code>
     * @throws FacilityNotFound
     * @throws MonitorNotFound
     * @throws InvalidRole
     * @throws EntityExistsException
     * @throws HinemosUnknown
     *
     */
    private boolean runMonitorInfoAggregateByNode()
            throws FacilityNotFound, MonitorNotFound, InvalidRole, EntityExistsException, HinemosUnknown {

        if (!m_isMonitorJob) {
            // ?????????????????
            final RepositoryControllerBean repository = new RepositoryControllerBean();
            final NodeInfo targetNode = repository.getNode(m_facilityId);
            final Set<Integer> currentTask = NodeMonitorPollerController
                    .calcCurrentExecMonitorIntervals(targetNode);

            final Set<Integer> plannedTask = getPlannedTasksForNodeAggregateMonitor(m_monitorTypeId, m_facilityId);
            synchronized (plannedTask) {
                plannedTask.addAll(currentTask);
            }

            final NodeToMonitorCache node2monitor = NodeToMonitorCache.getInstance(m_monitorTypeId);
            final Semaphore execSingleThreadSemaphore = getSemaphoreForNodeAggregateMonitor(m_monitorTypeId,
                    m_facilityId);

            // ?try???????????1??????????
            // Semaphore??????????????????????
            // ?????????
            if (execSingleThreadSemaphore.tryAcquire() == false) {
                for (Map.Entry<Integer, Set<MonitorInfo>> entry : node2monitor
                        .getMonitorsWithCalendar(m_facilityId, currentTask).entrySet()) {

                    // ??????????
                    final Set<MonitorInfo> monitors = entry.getValue();
                    for (MonitorInfo monitor : monitors) {
                        String notifyGroupId = monitor.getNotifyGroupId();

                        // 
                        OutputBasicInfo notifyInfo = new OutputBasicInfo();
                        notifyInfo.setPluginId(m_monitorTypeId);
                        notifyInfo.setMonitorId(monitor.getMonitorId());
                        notifyInfo.setApplication(monitor.getApplication());

                        String facilityPath = new RepositoryControllerBean().getFacilityPath(m_facilityId, null);
                        notifyInfo.setFacilityId(m_facilityId);
                        notifyInfo.setScopeText(facilityPath);

                        // ????
                        int priority = PriorityConstant.TYPE_UNKNOWN;

                        String message = MessageConstant.MESSAGE_MONITOR_UNCOMPLETED.getMessage();
                        String messageOrg = MessageConstant.MESSAGE_MONITOR_UNCOMPLETED.getMessage();
                        notifyInfo.setPriority(priority);
                        notifyInfo.setMessage(message);
                        notifyInfo.setMessageOrg(messageOrg);
                        notifyInfo.setGenerationDate(m_now.getTime());

                        // for debug
                        if (m_log.isDebugEnabled()) {
                            m_log.debug("notify() priority = " + priority + " , message = " + message
                                    + " , messageOrg = " + messageOrg + ", generationDate = " + m_now);
                        }

                        // ?
                        if (m_log.isDebugEnabled()) {
                            m_log.debug("sending message" + " : priority=" + notifyInfo.getPriority()
                                    + " generationDate=" + notifyInfo.getGenerationDate() + " pluginId="
                                    + notifyInfo.getPluginId() + " monitorId=" + notifyInfo.getMonitorId()
                                    + " facilityId=" + notifyInfo.getFacilityId() + " subKey="
                                    + notifyInfo.getSubKey() + ")");
                        }

                        new NotifyControllerBean().notify(notifyInfo, notifyGroupId);
                    }
                }

                // ?????????????????????true?
                return true;
            }

            // ?????1??????Semaphore???
            try {
                // ???????????????
                Set<Integer> execTargetInterval = null;
                synchronized (plannedTask) {
                    execTargetInterval = new HashSet<>(plannedTask);
                    plannedTask.clear();
                }

                // ??????preCollect???????????????preCollect????????
                final Object preCollectData = preCollect(execTargetInterval);

                // ??????RunMonitor???runMonitorList???????
                final List<RunMonitor> runMonitorList = new ArrayList<>();
                Set<MonitorInfo> monitorInfos = new HashSet<>();
                for (Set<MonitorInfo> addMonitors : node2monitor
                        .getMonitorsWithCalendar(m_facilityId, execTargetInterval).values()) {
                    monitorInfos.addAll(addMonitors);
                }
                // ????????FacilityId????Map???????????1?????
                final Map<String, NodeInfo> nodeinfoMap = new HashMap<>();
                nodeinfoMap.put(m_facilityId, targetNode);
                for (final MonitorInfo monitorInfo : monitorInfos) {
                    // ID?runMonitor?????
                    RunMonitor runMonitor = this.createMonitorInstance();
                    runMonitor.m_monitorTypeId = m_monitorTypeId;
                    runMonitor.m_monitorId = monitorInfo.getMonitorId();
                    runMonitor.m_now = m_now;
                    if (runMonitor.setMonitorInfo(m_monitorTypeId, monitorInfo.getMonitorId())) {
                        runMonitorList.add(runMonitor);

                        // setMonitorInfo?????FacilityId???
                        // ??????????????????????
                        runMonitor.m_facilityId = m_facilityId;

                        // ????runMonitor?????runMonitorInfo??????
                        // TODO ?? m_priorityMap ???????????????????
                        runMonitor.setJudgementInfo();
                        runMonitor.nodeInfo = nodeinfoMap;
                        runMonitor.setCheckInfo();
                        runMonitor.m_isNode = true;
                    }
                }

                // ??????
                checkMultiMonitorInfoData(preCollectData, runMonitorList);
            } finally {
                execSingleThreadSemaphore.release();
            }
        } else {
            // ?????
            final Object preCollectData = preCollect(null);

            // ID?runMonitor?????
            setJudgementInfo();
            final RepositoryControllerBean repository = new RepositoryControllerBean();
            final NodeInfo targetNode = repository.getNode(m_facilityId);
            final Map<String, NodeInfo> nodeinfoMap = new HashMap<>();
            nodeinfoMap.put(m_facilityId, targetNode);
            nodeInfo = nodeinfoMap;
            setCheckInfo();
            m_isNode = true;

            // ??????
            checkMultiMonitorInfoData(preCollectData, Arrays.asList(this));
        }
        return true;
    }

    /**
     * ???????
     * ????????
     * ??????
     * 
     * ?????????????? runMonitorInfo ????
     * ??FacilityId??????????????????
     * ???ID???????runMonitorInfo??????
     *
     * @param monitorTypeId ID
     * @param monitorId ID
     * @param facilityId ID
     * @param prvData ???
     * @throws FacilityNotFound
     * @throws MonitorNotFound
     * @throws InvalidRole
     * @throws HinemosUnknown
     *
     * @see #runMonitorInfo()
     */
    public MonitorRunResultInfo runMonitorAggregateByNode(String monitorTypeId, String monitorId, String facilityId,
            Object prvData) throws FacilityNotFound, MonitorNotFound, InvalidRole, HinemosUnknown {

        this.initialize(monitorTypeId);

        m_isMonitorJob = true;
        m_monitorTypeId = monitorTypeId;
        m_monitorId = monitorId;
        m_facilityId = facilityId;
        m_now = HinemosTime.getDateInstance();
        m_prvData = prvData;

        // ?
        m_monitor = QueryUtil.getMonitorInfoPK_NONE(monitorId);

        boolean isSuccess = false;

        try {
            // 
            isSuccess = runMonitorInfoAggregateByNode();
        } finally {
            if (!isSuccess) {
                String[] args = { m_monitorTypeId, m_facilityId };
                AplLogger.put(PriorityConstant.TYPE_WARNING, HinemosModuleConstant.MONITOR,
                        MessageConstant.MESSAGE_SYS_013_MON, args);
            }
            // ?
            this.terminate();
        }
        // ???
        return m_monitorRunResultInfo;
    }

    /**
     * ?????????????
     * ?????????Set?
     * 
     * ????Set??????Set?synchronized?????????
     * 
     * @param monitorType
     * @param facilityId
     * @return
     */
    private static Set<Integer> getPlannedTasksForNodeAggregateMonitor(String monitorType, String facilityId) {
        // ?????????
        ConcurrentMap<String, Set<Integer>> node2task = plannedTaskForNodeAggregateMonitor.get(monitorType);
        if (node2task == null) {
            ConcurrentMap<String, Set<Integer>> newNode2task = new ConcurrentHashMap<>();
            node2task = plannedTaskForNodeAggregateMonitor.putIfAbsent(monitorType, newNode2task);
            if (node2task == null) {
                node2task = newNode2task;
            }
        }
        // ??????????????
        Set<Integer> tasks = node2task.get(facilityId);
        if (tasks == null) {
            Set<Integer> newTasks = new HashSet<>();
            tasks = node2task.putIfAbsent(facilityId, newTasks);
            if (tasks == null) {
                tasks = newTasks;
            }
        }
        return tasks;
    }

    private static final ConcurrentMap<String, ConcurrentMap<String, Set<Integer>>> plannedTaskForNodeAggregateMonitor = new ConcurrentHashMap<>();

    /**
     * ???1?????????Semaphore?
     * @param monitorType ??
     * @param facilityId ???FacilityId
     * @return
     */
    private static Semaphore getSemaphoreForNodeAggregateMonitor(String monitorType, String facilityId) {
        if (nodeSemaphore.containsKey(monitorType) == false) {
            nodeSemaphore.putIfAbsent(monitorType, new ConcurrentHashMap<String, Semaphore>());
        }
        final Semaphore semaphore = nodeSemaphore.get(monitorType).get(facilityId);
        if (semaphore != null) {
            return semaphore;
        }

        final Semaphore newSemaphore = new Semaphore(1);
        final Semaphore oldSemaphore = nodeSemaphore.get(monitorType).putIfAbsent(facilityId, newSemaphore);
        if (oldSemaphore != null) {
            return oldSemaphore;
        } else {
            return newSemaphore;
        }
    }

    /**
     * ???FacilityId?????Semaphore?
     */
    private static final ConcurrentMap<String, ConcurrentMap<String, Semaphore>> nodeSemaphore = new ConcurrentHashMap<>();

    /**
     * ????????
     * ????????
     * 
     * @param preCollectData
     * @param runMonitorList
     */
    protected void checkMultiMonitorInfoData(final Object preCollectData, final List<RunMonitor> runMonitorList) {
        // ???????????????????
        List<Sample> sampleList = new ArrayList<Sample>();
        for (final RunMonitor targetMonitor : runMonitorList) {
            final String facilityId = targetMonitor.m_facilityId;
            targetMonitor.preCollectData = preCollectData;
            try {
                // ????????????
                // ?????executor??Callable????????????????
                // ????runMonitor.collect???Callable?call????
                final MonitorRunResultInfo result = new MonitorExecuteTask(targetMonitor, m_facilityId).call();
                if (m_log.isDebugEnabled())
                    m_log.debug("runMonitorInfoAggregatedFacilityId() : finished RunMonitor.collect."
                            + " facilityId = " + facilityId + ", monitorTypeId = " + m_monitorTypeId
                            + ", monitorId = " + targetMonitor.m_monitorId);

                // ????
                if (result.getProcessType().booleanValue()) {
                    // ?
                    if (!m_isMonitorJob) {
                        targetMonitor.notify(true, facilityId, result.getCheckResult(),
                                new Date(result.getNodeDate()), result);
                    } else {
                        m_monitorRunResultInfo = new MonitorRunResultInfo();
                        m_monitorRunResultInfo.setNodeDate(m_nodeDate);
                        m_monitorRunResultInfo.setCurData(result.getCurData());
                        m_monitorRunResultInfo.setPriority(result.getPriority());
                        m_monitorRunResultInfo.setMessageOrg(makeJobOrgMessage(result.getMessage(), null));
                    }

                    // ??????
                    if (targetMonitor.m_monitor.getCollectorFlg().booleanValue()) {
                        int errorType = 0;
                        Sample sample = new Sample(HinemosTime.getDateInstance(),
                                targetMonitor.m_monitor.getMonitorId());
                        if (result.isCollectorResult()) {
                            errorType = CollectedDataErrorTypeConstant.NOT_ERROR;
                        } else {
                            errorType = CollectedDataErrorTypeConstant.UNKNOWN;
                        }
                        sample.set(facilityId, targetMonitor.getMonitorInfo().getItemName(), result.getValue(),
                                errorType);
                        sampleList.add(sample);
                    }
                }
                if (m_log.isDebugEnabled())
                    m_log.debug("runMonitorInfoAggregatedFacilityId() : finished notify and store perf data."
                            + " facilityId = " + facilityId + ", monitorTypeId = " + targetMonitor.m_monitorTypeId
                            + ", monitorId = " + targetMonitor.m_monitorId);
            } catch (Exception e) {
                m_log.warn(
                        "runMonitorInfoAggregatedFacilityId() : facilityId = " + facilityId + ", monitorTypeId = "
                                + targetMonitor.m_monitorTypeId + ", monitorId  = " + targetMonitor.m_monitorId,
                        e);
            }
        }
        if (!sampleList.isEmpty()) {
            CollectDataUtil.put(sampleList);
        }
    }

    /**
     * ???????????????????
     * ??????????????
     * 
     * ???????????
     * 
     * @return
     * @throws HinemosUnknown 
     * @throws FacilityNotFound 
     */
    protected Object preCollect(Set<Integer> execMonitorIntervals) throws HinemosUnknown, FacilityNotFound {
        // ??????
        return null;
    }

    protected Object preCollectData;

    /**
     * ???
     * <p>
     * ???????
     * ?????????
     */
    protected abstract void setJudgementInfo();

    /**
     * ?????
     * <p>
     * ???????
     * ??????????
     *
     * @throws MonitorNotFound
     */
    protected abstract void setCheckInfo() throws MonitorNotFound;

    /**
     * ????????
     * <p>
     * ???????
     * ???ID??????
     * ?????????
     *
     * @param facilityId ?ID
     * @return ???????</code> true </code>
     * @throws FacilityNotFound
     * @throws HinemosUnknown
     */
    public abstract boolean collect(String facilityId) throws FacilityNotFound, HinemosUnknown;

    /**
     * ???CallableTask?????????
     * ????RunMonitor???????????
     * ?????????
     * ?????????????????????
     *
     * ??????????????RunMonitor??????
     * ????????????????
     * ???????????????????
     *
     * ?????????????????CallableTask???????
     *
     * @see com.clustercontrol.monitor.run.factory.RunMonitor#runMonitorInfo()
     * @see com.clustercontrol.monitor.run.factory.RunMonitorNumericValueType
     * @see com.clustercontrol.monitor.run.factory.RunMonitorStringValueType
     * @see com.clustercontrol.monitor.run.factory.RunMonitorTruthValueType
     * @see com.clustercontrol.monitor.run.util.MonitorExecuteTask
     *
     * @return
     * @throws HinemosUnknown
     */
    protected abstract RunMonitor createMonitorInstance() throws HinemosUnknown;

    /**
     * ????
     * <p>
     * ???????
     * {@link #collect(String)}???????
     * ????????
     * <p>
     * <dl>
     *  <dt>??</dt>
     *  <dd>??{@link com.clustercontrol.monitor.run.bean.TruthConstant}</dd>
     *  <dd>??{@link com.clustercontrol.bean.PriorityConstant}</dd>
     *  <dd>?{@link com.clustercontrol.monitor.run.ejb.entity.MonitorStringValueInfoBean#getOrder_no()}</dd>
     * </dl>
     *
     * @param ret ???????</code> true </code>
     * @return ?
     */
    public abstract int getCheckResult(boolean ret);

    /**
     * ?????
     * <p>
     * ???????????????
     *
     * @param key ?????
     * @return ??
     * @since 2.0.0
     */
    public int getPriority(int key) {

        MonitorJudgementInfo info = m_judgementInfoList.get(key);
        if (info != null) {
            return info.getPriority();
        } else {
            return m_failurePriority;
        }
    }

    /**
     * ID???
     *
     * @return ID
     * @since 2.1.0
     */
    public String getNotifyGroupId() {
        return m_notifyGroupId;
    }

    /**
     * ???
     * 
     * ??????
     */
    public void setMessage(String message) {
        // Do nothing
    }

    /**
     * ???
     * <p>
     * ?????????????
     *
     * @param key ?????
     * @return 
     * @since 2.0.0
     */
    public String getMessage(int key) {

        MonitorJudgementInfo info = m_judgementInfoList.get(Integer.valueOf(key));
        if (info != null) {
            if (info.getMessage() != null) {
                return info.getMessage();
            }
        }
        return "";
    }

    /**
     * ???
     * <p>
     * ???????
     *
     * @param key ?????
     * @return 
     * @since 2.0.0
     */
    public abstract String getMessageOrg(int key);

    /**
     * ???
     * <p>
     * ??????????
     *
     * @param priority ??
     * @return 
     */
    protected String getMessageForScope(int priority) {

        if (priority == PriorityConstant.TYPE_INFO) {
            return MESSAGE_INFO;
        } else if (priority == PriorityConstant.TYPE_WARNING) {
            return MESSAGE_WARNING;
        } else if (priority == PriorityConstant.TYPE_CRITICAL) {
            return MESSAGE_CRITICAL;
        } else {
            return MESSAGE_UNKNOWN;
        }
    }

    /**
     * ???
     * <p>
     * ????????????
     *
     * <dl>
     *  <dt>:X, :X, ?:X, ?:X</dt>
     *  <dt>:</dt>
     *     <dd>NODE1</dd>
     *   <dd>NODE2</dd>
     *  <dt>:</dt>
     *   <dd>NODE3</dd>
     *  <dt>?:</dt>
     *     <dd>NODE4</dd>
     *  <dt>?:</dt>
     *   <dd>NODE5</dd>
     * </dl>
     *
     * @param priority ??
     * @return 
     */
    protected String getMessageOrgForScope(int priority) {

        ArrayList<String> info = m_priorityMap.get(Integer.valueOf(PriorityConstant.TYPE_INFO));
        ArrayList<String> warning = m_priorityMap.get(Integer.valueOf(PriorityConstant.TYPE_WARNING));
        ArrayList<String> critical = m_priorityMap.get(Integer.valueOf(PriorityConstant.TYPE_CRITICAL));
        ArrayList<String> unknown = m_priorityMap.get(Integer.valueOf(PriorityConstant.TYPE_UNKNOWN));

        // ???
        StringBuffer summary = new StringBuffer();
        summary.append(
                MessageConstant.INFO.getMessage() + ":" + info.size() + MessageConstant.RECORD.getMessage() + ", ");
        summary.append(MessageConstant.WARNING.getMessage() + ":" + warning.size()
                + MessageConstant.RECORD.getMessage() + ", ");
        summary.append(MessageConstant.CRITICAL.getMessage() + ":" + critical.size()
                + MessageConstant.RECORD.getMessage() + ", ");
        summary.append(
                MessageConstant.UNKNOWN.getMessage() + ":" + unknown.size() + MessageConstant.RECORD.getMessage());

        // ?????
        StringBuffer detail = new StringBuffer();
        detail.append(getItemListString("\n" + MessageConstant.INFO.getMessage(), info));
        detail.append(getItemListString("\n" + MessageConstant.WARNING.getMessage(), warning));
        detail.append(getItemListString("\n" + MessageConstant.CRITICAL.getMessage(), critical));
        detail.append(getItemListString("\n" + MessageConstant.UNKNOWN.getMessage(), unknown));
        return summary.toString() + detail.toString();
    }

    /**
     * ??????
     *
     * @return ???
     * @since 3.0.0
     */
    public long getNodeDate() {
        return m_nodeDate;
    }

    /**
     * ???
     *
     * @return 
     * @since 4.0.0
     */
    public double getValue() {
        return m_value;
    }

    /**
     * ?????
     *
     * @return ???
     * @since 4.0.0
     */
    public Object getCurData() {
        return m_curData;
    }

    /**
     * ???
     * <p>
     * ?????????????<BR>
     * ID?????????????<BR>
     * ID???????????????{@link com.clustercontrol.calendar.session.CalendarControllerBean#isRun(java.lang.String, java.util.Date)}?????????
     *
     * @param monitorTypeId ID
     * @param monitorId ID
     * @return ???</code> true </code>
     * @throws MonitorNotFound
     * @throws HinemosUnknown
     *
     * @since 2.0.0
     *
     * @see com.clustercontrol.calendar.session.CalendarControllerBean#isRun(java.lang.String, java.util.Date)
     */
    protected boolean setMonitorInfo(String monitorTypeId, String monitorId)
            throws MonitorNotFound, HinemosUnknown {
        m_isInCalendarTerm = true;
        m_isInNextCalendarTerm = false;

        // ?
        m_monitor = QueryUtil.getMonitorInfoPK_NONE(monitorId);

        if (!m_isMonitorJob) {
            // ??

            // ?
            List<NotifyRelationInfo> notifyRelationList = new NotifyControllerBean()
                    .getNotifyRelation(m_monitor.getNotifyGroupId());
            m_notifyGroupId = m_monitor.getNotifyGroupId();
            m_monitor.setNotifyRelationList(notifyRelationList);
            if (m_notifyGroupId == null || "".equals(m_notifyGroupId)) {
                if (m_monitor.getMonitorType().intValue() != MonitorTypeConstant.TYPE_STRING) {
                    // ???????
                    return false;
                }
            }

            // ?
            m_runInterval = m_monitor.getRunInterval().intValue();

            // ID
            String calendarId = m_monitor.getCalendarId();
            if (calendarId != null && !"".equals(calendarId)) {
                // ?????
                try {
                    CalendarControllerBean calendar = new CalendarControllerBean();
                    if (!calendar.isRun(calendarId, m_now == null ? null : m_now.getTime()).booleanValue()) {
                        // ???????
                        m_log.debug("setMonitorInfo() monitorTypeId = " + m_monitorTypeId + ", monitorId = "
                                + m_monitorId + ", calenderId = " + calendarId
                                + ". The monitor is not executed because of non-operating day.");
                        m_isInCalendarTerm = false;

                        // ????
                        if (calendar
                                .isRun(calendarId,
                                        m_now == null ? null : (m_now.getTime() + (m_runInterval * 1000)))
                                .booleanValue()) {
                            m_log.debug("setMonitorInfo() : monitorTypeId:" + m_monitorTypeId + ",monitorId:"
                                    + m_monitorId + ",calenderId:" + calendarId + ". Next term is operating day.");
                            m_isInNextCalendarTerm = true;
                        }

                        return false;
                    }
                } catch (InvalidRole e) {
                    // ??ID??????????
                    // ?????????
                    // ADMINISTRATORS???????????????
                    return false;
                } catch (CalendarNotFound e) {
                    // ??ID???????????
                    return false;
                }
            }
            // ID
            m_facilityId = m_monitor.getFacilityId();
        }

        // ????
        m_failurePriority = m_monitor.getFailurePriority().intValue();

        return true;
    }

    /**
     * ?????
     * <p>
     * ????????????
     * <ol>
     * <li>ID???<code>null</code>????????</li>
     * <li>????{@link com.clustercontrol.monitor.message.LogOutputNotifyInfo }????
     * ????????????????
     * </li>
     * <li>??????</li>
     * </ol>
     *
     * @param isNode ???</code> true </code>
     * @param facilityId ?ID
     * @param result ?
     * @param generationDate ??
     * @throws HinemosUnknown
     * @since 2.0.0
     *
     * @see com.clustercontrol.monitor.message.LogOutputNotifyInfo
     * @see com.clustercontrol.repository.session.RepositoryControllerBean#getFacilityPath(java.lang.String, java.lang.String)
     * @see #getNotifyRelationInfos()
     * @see #getPriority(int)
     * @see #getMessage(int)
     * @see #getMessageOrg(int)
     * @see #getJobRunInfo(int)
     * @see #getMessageForScope(int)
     * @see #getMessageOrgForScope(int)
     * @see #getJobRunInfoForScope(int)
     */
    protected void notify(boolean isNode, String facilityId, int result, Date generationDate)
            throws HinemosUnknown {
        // for debug
        if (m_log.isDebugEnabled()) {
            m_log.debug("notify() isNode = " + isNode + ", facilityId = " + facilityId + ", result = " + result
                    + ", generationDate = " + generationDate.toString());
        }

        // ??????
        if (!m_monitor.getMonitorFlg()) {
            m_log.debug("notify() isNode = " + isNode + ", facilityId = " + facilityId + ", result = " + result
                    + ", generationDate = " + generationDate.toString() + ", monitorFlg is false");
            return;
        }

        // ID???????????
        String notifyGroupId = getNotifyGroupId();
        List<NotifyRelationInfo> notifyRelationList = m_monitor.getNotifyRelationList();
        if (notifyRelationList == null || notifyRelationList.size() == 0) {
            return;
        }

        // 
        OutputBasicInfo notifyInfo = new OutputBasicInfo();
        notifyInfo.setPluginId(m_monitorTypeId);
        notifyInfo.setMonitorId(m_monitorId);
        notifyInfo.setApplication(m_monitor.getApplication());

        String facilityPath = new RepositoryControllerBean().getFacilityPath(facilityId, null);
        notifyInfo.setFacilityId(facilityId);
        notifyInfo.setScopeText(facilityPath);

        int priority = -1;
        String message = "";
        String messageOrg = "";

        if (isNode) {
            // ??
            priority = getPriority(result);
            message = getMessage(result);
            messageOrg = getMessageOrg(result);
        } else {
            // ??
            priority = result;
            message = getMessageForScope(result);
            messageOrg = getMessageOrgForScope(result);
        }
        notifyInfo.setPriority(priority);
        notifyInfo.setMessage(message);
        notifyInfo.setMessageOrg(messageOrg);
        if (generationDate != null) {
            notifyInfo.setGenerationDate(generationDate.getTime());
        }
        // for debug
        if (m_log.isDebugEnabled()) {
            m_log.debug("notify() priority = " + priority + " , message = " + message + " , messageOrg = "
                    + messageOrg + ", generationDate = " + generationDate);
        }

        // ?
        if (m_log.isDebugEnabled()) {
            m_log.debug("sending message" + " : priority=" + notifyInfo.getPriority() + " generationDate="
                    + notifyInfo.getGenerationDate() + " pluginId=" + notifyInfo.getPluginId() + " monitorId="
                    + notifyInfo.getMonitorId() + " facilityId=" + notifyInfo.getFacilityId() + " subKey="
                    + notifyInfo.getSubKey() + ")");
        }

        new NotifyControllerBean().notify(notifyInfo, notifyGroupId);
    }

    /**
     * ?????(?)
     * <p>
     * ????????????
     * <ol>
     * <li>ID???<code>null</code>????????</li>
     * <li>????{@link com.clustercontrol.monitor.message.LogOutputNotifyInfo }????
     * ????????????????
     * </li>
     * <li>??????</li>
     * </ol>
     *
     * @param isNode ???</code> true </code>
     * @param facilityId ?ID
     * @param result ?
     * @param generationDate ??
     * @param resultList ?
     * @throws HinemosUnknown
     * @since 2.0.0
     *
     * @see com.clustercontrol.monitor.message.LogOutputNotifyInfo
     * @see com.clustercontrol.repository.session.RepositoryControllerBean#getFacilityPath(java.lang.String, java.lang.String)
     * @see #getNotifyRelationInfos()
     * @see #getPriority(int)
     * @see #getMessage(int)
     * @see #getMessageOrg(int)
     * @see #getJobRunInfo(int)
     * @see #getMessageForScope(int)
     * @see #getMessageOrgForScope(int)
     * @see #getJobRunInfoForScope(int)
     */
    protected void notify(boolean isNode, String facilityId, int result, Date generationDate,
            MonitorRunResultInfo resultInfo) throws HinemosUnknown {

        // for debug
        if (m_log.isDebugEnabled()) {
            m_log.debug("notify() isNode = " + isNode + ", facilityId = " + facilityId + ", result = " + result
                    + ", generationDate = " + generationDate.toString() + ", resultInfo = "
                    + resultInfo.getMessage());
        }

        boolean monitorFlg = false;

        monitorFlg = m_monitor.getMonitorFlg();

        // ??????
        if (!monitorFlg) {
            m_log.debug("notify() isNode = " + isNode + ", facilityId = " + facilityId + ", result = " + result
                    + ", generationDate = " + generationDate.toString() + ", resultInfo = "
                    + resultInfo.getMessage() + ", monitorFlg is false");
            return;
        }

        // ID???????????
        String notifyGroupId = resultInfo.getNotifyGroupId();
        if (notifyGroupId == null || "".equals(notifyGroupId)) {
            return;
        }

        // 
        OutputBasicInfo notifyInfo = new OutputBasicInfo();
        notifyInfo.setPluginId(m_monitorTypeId);
        notifyInfo.setMonitorId(m_monitorId);
        notifyInfo.setApplication(m_monitor.getApplication());

        String facilityPath = new RepositoryControllerBean().getFacilityPath(facilityId, null);
        notifyInfo.setFacilityId(facilityId);
        notifyInfo.setScopeText(facilityPath);

        int priority = -1;
        String message = "";
        String messageOrg = "";

        if (isNode) {
            // ??
            priority = resultInfo.getPriority();
            message = resultInfo.getMessage();
            messageOrg = resultInfo.getMessageOrg();
        } else {
            // ??
            priority = result;
            message = getMessageForScope(result);
            messageOrg = getMessageOrgForScope(result);
        }
        notifyInfo.setPriority(priority);
        // ?
        if (resultInfo.getDisplayName() != null && !"".equals(resultInfo.getDisplayName())) {
            // ???????????????
            notifyInfo.setSubKey(resultInfo.getDisplayName());
        } else if (resultInfo.getPatternText() != null) {
            // ?????????????
            notifyInfo.setSubKey(resultInfo.getPatternText());
        }
        notifyInfo.setMessage(message);
        notifyInfo.setMessageOrg(messageOrg);
        if (generationDate != null) {
            notifyInfo.setGenerationDate(generationDate.getTime());
        }
        // for debug
        if (m_log.isDebugEnabled()) {
            m_log.debug("notify() priority = " + priority + " , message = " + message + " , messageOrg = "
                    + messageOrg + ", generationDate = " + generationDate);
        }

        // ?
        if (m_log.isDebugEnabled()) {
            m_log.debug("sending message" + " : priority=" + notifyInfo.getPriority() + " generationDate="
                    + notifyInfo.getGenerationDate() + " pluginId=" + notifyInfo.getPluginId() + " monitorId="
                    + notifyInfo.getMonitorId() + " facilityId=" + notifyInfo.getFacilityId() + " subKey="
                    + notifyInfo.getSubKey() + ")");
        }
        new NotifyControllerBean().notify(notifyInfo, notifyGroupId);
    }

    /**
     * ???????
     * <p>
     * <ol>
     * <li>???ID???????</li>
     * <li>????????????????</li>
     *
     * @param priority ??
     * @param facilityId ??
     * @throws HinemosUnknown
     */
    protected void setPriorityMap(Integer priority, String facilityId) throws HinemosUnknown {

        ArrayList<String> list = m_priorityMap.get(priority);
        if (list != null) {

            // ???
            String facilityName = new RepositoryControllerBean().getFacilityPath(facilityId, null);

            list.add(facilityName);
            m_priorityMap.put(priority, list);
        }
    }

    /**
     * ????
     *
     * <dl>
     *  <dt>??:</dt>
     *     <dd>[0]</dd>
     *   <dd>[1]</dd>
     *   <dd>[2]</dd>
     *   <dd> </dd>
     * </dl>
     *
     * @param item ??
     * @param list 
     * @return ?
     */
    private String getItemListString(String item, ArrayList<String> list) {

        int length = list.size();
        if (length > 0) {
            StringBuffer result = new StringBuffer();
            result.append(item + ":" + "\n");
            for (int i = 0; i < length; i++) {
                result.append("\t" + list.get(i));
                if (i < length - 1) {
                    result.append("\n");
                }
            }
            return result.toString();
        } else {
            return "";
        }
    }

    /**
     * ??????
     *
     * ?run????call???????
     * run??terminattecall??????????
     *
     */
    private void initialize(String monitorTypeId) {
    }

    /**
     * ?????
     *
     */
    private void terminate() {
    }

    public MonitorInfo getMonitorInfo() {
        return m_monitor;
    }

    /**
     * ??
     * 
     * @param orgMsg ?
     * @param msg ?
     * @return ?
     */
    protected String makeJobOrgMessage(String orgMsg, String msg) {
        return "";
    }
}