Monitor() { this(new MonInternals()); }
public void reset() { if (monData.enabled) { synchronized (monData) { monData.reset(); } } }
/** same as stop above but subtracts out the active that was calculated at the last start */ public void skip() { decrementThisActive(); decrementActivity(); }
public Monitor stop() { if (monData.enabled) { synchronized (monData) { // moved into stop section to support skip. i.e. shouldn't affect avgactive or maxactive if skip is called. // before this was done in start which occurred before skip. if (active >= monData.maxActive) { monData.maxActive = active; if (monData.hasListener(Listeners.MAXACTIVE_LISTENER_INDEX) && active>1) monData.getListener(Listeners.MAXACTIVE_LISTENER_INDEX).processEvent(this); } // being as avgactive needs hits to calculate we don't calculate totalActive till stop is called // hits are tallied in add as it is common behavior to all monitors. monData.stop(active); } } return this; }
/** Introduced as a way to add listeners that allows for lazy initialization saving a fair amount of memory. Note * a future enhancement would be to delete the Listeners object when all listeners are removed. * * @since 2.71 */ public void addListener(String listenerTypeName, JAMonListener listener) { synchronized (monData) { Listeners listeners; if (monData.hasListeners()) listeners=monData.getListeners(); else listeners=monData.createListeners(); listeners.getListenerType(listenerTypeName).addListener(listener); } }
public TimeMon2() { super(new MonKeyImp("timer","ms."),new MonInternals()); monData.setActivityStats(new ActivityStats()); monData.isTimeMonitor=true; }
monData.updateActivity(); if (monData.hasListener(Listeners.MIN_LISTENER_INDEX)) monData.getListener(Listeners.MIN_LISTENER_INDEX).processEvent(this); if (monData.hasListener(Listeners.MAX_LISTENER_INDEX)) monData.getListener(Listeners.MAX_LISTENER_INDEX).processEvent(this); if (monData.hasListener(Listeners.VALUE_LISTENER_INDEX)) monData.getListener(Listeners.VALUE_LISTENER_INDEX).processEvent(this);
public boolean hasListeners() { synchronized (monData) { return monData.hasListeners(); } }
public double getActive() { if (monData.enabled) { synchronized (monData) { return monData.getThisActiveCount(); } } else return 0; }
Listeners getListeners() { return monData.getListeners(); }
/** Returns true if this listenertype ('max', 'min', 'value', 'maxactive') has any listeners at all * * @param listenerTypeName * @return boolean */ public boolean hasListeners(String listenerTypeName) { synchronized (monData) { if (!monData.hasListeners()) return false; ListenerType type=getListenerType(listenerTypeName); if (type==null) return false; else return type.hasListeners(); } }
public JAMonDetailValue getJAMonDetailRow() { if (monData.enabled) { synchronized (monData) { return new JAMonDetailValue(getMonKey(), monData.lastValue, monData.getThisActiveCount(), monData.lastAccess); } } else return JAMonDetailValue.NULL_VALUE; }
Monitor() { this(new MonInternals()); }
public void stop(double active) { totalActive += active;// allows us to track the average active for THIS instance. decrementThisActive(); decrementActivity(); }
public void reset() { if (monData.enabled) { synchronized (monData) { monData.reset(); } } }
/** Introduced as a way to check for listeners that allows for lazy initialization saving a fair amount of memory. Note * a future enhancement would be to delete the Listeners object when all listeners are removed. * * @since 2.71 */ public boolean hasListener(String listenerTypeName, String listenerName) { synchronized (monData) { if (!monData.hasListeners()) return false; ListenerType type=getListenerType(listenerTypeName); if (type==null) return false; else return type.hasListener(listenerName); } }
public TimeMon2() { super(new MonKeyImp("timer","ms."),new MonInternals()); monData.activityStats=new ActivityStats(); monData.isTimeMonitor=true; }
/** Introduced as a way to remove listeners that allows for lazy initialization saving a fair amount of memory. Note * a future enhancement would be to delete the Listeners object when all listeners are removed. * * @since 2.71 * */ public void removeListener(String listenerTypeName, String listenerName) { synchronized (monData) { if (!monData.hasListeners()) // return if there is nothing to remove return; ListenerType type=getListenerType(listenerTypeName); if (type!=null) type.removeListener(listenerName); } }