Revision: 543550f8642e
Author:   Jean Deruelle <[email protected]>
Date:     Fri Feb  1 05:40:23 2013
Log:      Update Issue 14

Different implementation

http://code.google.com/p/commscale/source/detail?r=543550f8642e&repo=commons

Added:
/congestion/src/main/java/org/mobicents/commons/congestion/CPUProcessCongestionMonitor.java
Deleted:
/annotations/target/classes/org/mobicents/commons/annotations/Experimental.class /annotations/target/classes/org/mobicents/commons/annotations/Immutable.class /annotations/target/classes/org/mobicents/commons/annotations/NotThreadSafe.class /annotations/target/classes/org/mobicents/commons/annotations/ThreadSafe.class
 /annotations/target/commons-annotations-1.0.0-SNAPSHOT.jar
 /annotations/target/maven-archiver/pom.properties
/concurrent/target/classes/org/mobicents/commons/util/concurrent/RevolvingCounter.class
 /concurrent/target/commons-concurrent-1.0.0-SNAPSHOT.jar
 /concurrent/target/maven-archiver/pom.properties
/congestion/src/main/java/org/mobicents/commons/congestion/CPUCongestionMonitor.java
 /fsm/target/classes/org/mobicents/commons/event/Event.class
 /fsm/target/classes/org/mobicents/commons/event/EventBus$Builder.class
 /fsm/target/classes/org/mobicents/commons/event/EventBus$Dispatcher.class
 /fsm/target/classes/org/mobicents/commons/event/EventBus.class
 /fsm/target/classes/org/mobicents/commons/event/EventHandler.class
 /fsm/target/classes/org/mobicents/commons/fsm/Action.class
 /fsm/target/classes/org/mobicents/commons/fsm/Condition.class
 /fsm/target/classes/org/mobicents/commons/fsm/FiniteStateMachine.class
/fsm/target/classes/org/mobicents/commons/fsm/FiniteStateMachineException.class
 /fsm/target/classes/org/mobicents/commons/fsm/State.class
 /fsm/target/classes/org/mobicents/commons/fsm/Transition.class
/fsm/target/classes/org/mobicents/commons/fsm/TransitionFailedException.class /fsm/target/classes/org/mobicents/commons/fsm/TransitionNotFoundException.class
 /fsm/target/commons-fsm-1.0.0-SNAPSHOT.jar
 /fsm/target/maven-archiver/pom.properties
Modified:
 /congestion/.classpath
 /congestion/pom.xml

=======================================
--- /dev/null
+++ /congestion/src/main/java/org/mobicents/commons/congestion/CPUProcessCongestionMonitor.java Fri Feb 1 05:40:23 2013
@@ -0,0 +1,192 @@
+/*
+ * TeleStax, Open Source Cloud Communications.
+ * Copyright 2012 and individual contributors by the @authors tag.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.commons.congestion;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+
+import javolution.util.FastList;
+
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author [email protected]
+ *
+ */
+public class CPUProcessCongestionMonitor implements CongestionMonitor {
+ private static final Logger logger = Logger.getLogger(CPUProcessCongestionMonitor.class);
+
+       private static final String SOURCE = "CPU";
+
+ private final FastList<CongestionListener> listeners = new FastList<CongestionListener>();
+
+       private OperatingSystemMXBean osMBean;
+       private int  availableProcessors;
+    private long lastSystemTime      = 0;
+    private long lastProcessCpuTime  = 0;
+
+       private volatile double percentageOfCPUUsed;
+
+       private volatile boolean cpuTooHigh = false;
+
+       private double backToNormalCPUThreshold;
+
+       private double cpuThreshold;
+
+       public CPUProcessCongestionMonitor() {
+               osMBean = ManagementFactory.getOperatingSystemMXBean();
+               availableProcessors = osMBean.getAvailableProcessors();
+               baselineCounters();
+       }
+
+       /**
+        * @param backToNormalPercentageOfCPUUsed
+        *            the backToNormalPercentageOfCPUUsed to set
+        */
+       public void setBackToNormalCPUThreshold(double 
backToNormalCPUThreshold) {
+               this.backToNormalCPUThreshold = backToNormalCPUThreshold;
+               if (logger.isInfoEnabled()) {
+ logger.info("Back To Normal CPU threshold set to " + backToNormalCPUThreshold + "%");
+               }
+       }
+
+       /**
+        * @return the backToNormalPercentageOfCPUThreshold
+        */
+       public double getBackToNormalCPUThreshold() {
+               return backToNormalCPUThreshold;
+       }
+
+       /**
+        * @param cpuThreshold
+        *            the cpuThreshold to set
+        */
+       public void setCPUThreshold(double cpuThreshold) {
+               this.cpuThreshold = cpuThreshold;
+               if (logger.isInfoEnabled()) {
+                       logger.info("CPU threshold set to " + this.cpuThreshold + 
"%");
+               }
+       }
+
+       /**
+        * @return the cpuThreshold
+        */
+       public double getCPUThreshold() {
+               return cpuThreshold;
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see org.mobicents.commons.congestion.CongestionMonitor#monitor()
+        */
+       @Override
+       public void monitor() {
+               if(osMBean == null) {
+                       return;
+               }
+
+               percentageOfCPUUsed = getCpuUsage();
+               if(logger.isDebugEnabled()) {
+                       logger.debug("CPU Process Load Average = " + 
percentageOfCPUUsed);
+               }
+               if (this.cpuTooHigh) {
+                       if (this.percentageOfCPUUsed < 
this.backToNormalCPUThreshold) {
+ logger.warn("CPU used: " + percentageOfCPUUsed + "% < to the back to normal CPU threshold : " + this.backToNormalCPUThreshold);
+                               this.cpuTooHigh = false;
+
+                               // Lets notify the listeners
+ for (FastList.Node<CongestionListener> n = listeners.head(), end = listeners.tail(); (n = n.getNext()) != end;) {
+                                       CongestionListener listener = 
n.getValue();
+                                       listener.onCongestionFinish(SOURCE);
+                               }
+                       }
+               } else {
+                       if (this.percentageOfCPUUsed > cpuThreshold) {
+ logger.warn("CPU used: " + percentageOfCPUUsed + "% > to the CPU threshold : " + this.cpuThreshold);
+                               this.cpuTooHigh = true;
+
+                               // Lets notify the listeners
+ for (FastList.Node<CongestionListener> n = listeners.head(), end = listeners.tail(); (n = n.getNext()) != end;) {
+                                       CongestionListener listener = 
n.getValue();
+                                       listener.onCongestionStart(SOURCE);
+                               }
+                       }
+               }
+
+       }
+
+
+       public synchronized double getCpuUsage() {
+               long systemTime = System.nanoTime();
+               long processCpuTime = 0;
+
+               if (osMBean instanceof OperatingSystemMXBean) {
+                       processCpuTime = 
((com.sun.management.OperatingSystemMXBean) osMBean)
+                                       .getProcessCpuTime();
+               }
+
+               double cpuUsage = (double) (processCpuTime - lastProcessCpuTime)
+                               / (systemTime - lastSystemTime);
+
+               lastSystemTime = systemTime;
+               lastProcessCpuTime = processCpuTime;
+
+               return cpuUsage / availableProcessors;
+       }
+
+       private void baselineCounters() {
+               lastSystemTime = System.nanoTime();
+
+               if (osMBean instanceof OperatingSystemMXBean) {
+ lastProcessCpuTime = ((com.sun.management.OperatingSystemMXBean) osMBean)
+                                       .getProcessCpuTime();
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+ * @see org.mobicents.commons.congestion.CongestionMonitor#addCongestionListener(org.mobicents.commons.congestion.CongestionListener)
+        */
+       @Override
+       public void addCongestionListener(CongestionListener listener) {
+               this.listeners.add(listener);
+       }
+
+       /*
+        * (non-Javadoc)
+ * @see org.mobicents.commons.congestion.CongestionMonitor#removeCongestionListener(org.mobicents.commons.congestion.CongestionListener)
+        */
+       @Override
+       public void removeCongestionListener(CongestionListener listener) {
+               this.listeners.remove(listener);
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see org.mobicents.commons.congestion.CongestionMonitor#getSource()
+        */
+       @Override
+       public String getSource() {
+               return SOURCE;
+       }
+
+}
=======================================
--- /annotations/target/classes/org/mobicents/commons/annotations/Experimental.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /annotations/target/classes/org/mobicents/commons/annotations/Immutable.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /annotations/target/classes/org/mobicents/commons/annotations/NotThreadSafe.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /annotations/target/classes/org/mobicents/commons/annotations/ThreadSafe.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /annotations/target/commons-annotations-1.0.0-SNAPSHOT.jar Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,105 +0,0 @@
-PK - ?B META-INF/PK - ?B  Ë l È META-INF/MANIFEST.MF ’ËnÂ0 E÷‘ò þ€Ú$P¨ê -ÐJ¥" Úme’!¸ø Ù ¿¯Ã# ©E]ÙžñÜ{f4 S| ÖáO0–kEQL¢0è›tÅ7`šðTÀ®´èœ ƒ¡ æ Ã=Eý‚¥+@ Û€BƒRe |A™s ƒ’
-wøõ
-ìôÎðk¶®¬z$úê<„Áó®ÐÆá)K×, дɉÔ
-ž‚r–¤ZJ­,aJiÇœç±a0’
- éó‡ žs'þ*¤§ ß ¸
- ‰ðlÒŸÎ^Þæa0×ZP4P ŽIÜ­¦sì O˜ôŽÉÙ
-
- .¨ Ãåã}LÑʹ‚¶ZÛíö‚Õ“ÿ¤2mð(£h  fŽíîÐH¥¤f¸¦&
-uÅ;fÖ%:ãK ^!ît {Ýø>ŠÚ½¦‰ä´ µP»N +2
-W¼¹*+Ò–8ælKä
-Àm “•“¢.} › ^¸ƒb3!ê÷ˆ  E
-–h©
-j“
-2¾5æµêêÙ^.´w8 ø » ?PK - ?B org/PK - ?B org/mobicents/PK - ?B org/mobicents/commons/PK - ?B " org/mobicents/commons/annotations/PK - ?B¸8ü]ö ” 2 org/mobicents/commons/annotations/ThreadSafe.class
- ÏJÃ@ Æ¿­m£õOëQD  =‰‹gORêIhI¢ ž6ë ·lv%Ù új
-|  Jœx0
-  ÌÎ,ó›o˜ùüzÿ p
-à   Æ & £Ä×¥¦[cI`œ¾–¤ž õB—+µV Gqí‚)èÁT&³t㜠* ï* “»†‘V¹\ªß‚LU™S¸  ¬•­Yõ¼››[*È
-tóF
-÷ÓÇå\ଛ )0Ê “Ó ¥·Fo -&‹ûxÆ¢ ¾Ìeá3£™¨¤öEÁ
-üi®d»¸À¤Õ_d+ÒAà´sd{ ©€@ }
- õÐÿy  r<æ,âÚö  a #ì6?Â
-ö¿ PK - ?BM¬ˆ - ° 1 org/mobicents/commons/annotations/Immutable.class
- MKÃ@ †ßíWlÕZõäA Á^  Ïž‚¦P¨4¤Q O›°„-û!ͦпæÁ à  '
-Z öÝaæygØùúþø p‡Ó £ Ç N -W­r9QZ2
-§ÆT^dZÞ.ÅZ0œ%•õÊÈ U*ʆÖ:/¼r¶d8ŸÕ
-× \l
-< «Bú{†îZ芚^5s‘–FZŸnÞ%Á ô5ŽÈ3™F³G†~
-&áS”F      Ãe³?‘žì ‘{ü  ;­ò
- ½Åü9y A7nUpã2• QòÜ CŸúc.ùv -£]ûy¶”¹g¸hœ¸[И ¡E· ú´ÐùÕ.zô^S Pmï -m‰> µì×r€Ã:/1ÄÑ PK - ?BMÕýù ¦ 4 org/mobicents/commons/annotations/Experimental.class - ÏJÃ@ Æ¿ m¢õ_ë̓X<ôØÅ³'± JJ ñ´ CزɖdSì«yð | (qâÁö pag‡™ß7 ;_ß Ÿ ®q à4À0ÀH`°°M•ѽ6$0
-ßWTé‚J§Ìt©ÖJà<nJÇ¥ ]ëÔÐmYZ§œ¶e-pñØ2Ò¨2—ê¯! Uåän úke ž{ÕÍ
-†Z«d³"†{Éë< ðŸÂä!š     Œ»E19ÖpÆ’É?ÈÜ  m ô Ñs|ÇÓ§¶ÊeaS 1QËÌ  ÿdG\ËÝ
- -· Qº¤Ì \všn 3 ðøî¡= -z¿± Ÿß1g ÷ößà 0hÃ!ŽÚ á '?PK - ?B§õÏ'ö š 5 org/mobicents/commons/annotations/NotThreadSafe.class
- ÍJÃ@ ÇÿSÛFëWõ&"Ї
-]<{ ©'±% ‚xÚÄ1nÙìJ²)ôÕ<ø >”8ñ`   Ì ó› f>>ßÞ œc/ÂN„Ý CÂ`æë2ãkc™° ëCòR²~šég>›ë
-&
-ĵ
-¦à{S™Ôò¥s>è`¼« G7
-£¬v¹Ò? •è2çpAè-´­eði;7¶\°
-Éò• î& Ó1ᤠ 9 *‘ £  ©·&[
-ØŸMîâ+ ª|™«Â§& ¢R™/
-9àWs¥þÜN ®VLÒ9g pܺuõ   Ð ]C#
-t¿m }ñ‡ ER[ 160Àf“1¶°ý PK - ?B META-INF/maven/PK - ?B % META-INF/maven/org.mobicents.commons/PK - ?B 9 META-INF/maven/org.mobicents.commons/commons-annotations/PK - * ?B½wæ‚ U @ META-INF/maven/org.mobicents.commons/commons-annotations/pom.xml “MO 1 †Ïð+ ñJ Ä ©› /š€ `Œ×Ú
-auû‘¶|Åøß vY`Q o;3ÏtÞy'Ë­3ï(Cg§Jío»« ì @‰
-j&¬ +dÆ-a>›Â
-ë³~·"G;_
-éív˶ÃÄ]÷û x™N Ô¨D¯Ð> -±ÛnQÃȧìÄH -£ÿ1­ó ±óy•ì%ŽQÜÍÚ-®LŽå3:Oïg©Ä¡‘k d
-C
- oñ¥3kû gô&Sæµ TðL ¥Œö
-êrD
-
-Å›  ÂC½W=ÄᬠÉÍaÖ Îï-
-ÇóÅýì‰C ŒÃ’LØà\„UÆ X£ 9Ë¡Q ±pTÛþUƒÐÚ„ä§¿ µP˜Më­:wUGg| Þ‘ b׮̢ٞܖd [ ³,1Z â0/E‰À!’ÉEg,Ò<ôi! ~¯Œü`õ–C6àð#›6:ë¤8G‹:G-ë§Ž‰}
-›Gª lܦảhžåt—«ÏKY_ ã´¸—¤0
-èé¸ÕwÔ -aga žöŠÿRö -PK - ?B | sY~ † G META-INF/maven/org.mobicents.commons/commons-annotations/pom.properties-ÊË
-Â0 @Ñ}¾b ë†Äú€B "â |@ó Ó6Ö,2#É´àß«àöž[
-<ù„â èÞpÁÙ“*Üs‚3 T ì¦^­ë¥ ÝÞÁÂØJÍ>åÀÔXm´)ÛëöÞ
-oN ‰§×ih8 :r zO’uÏ12e
-I {ù ÿT" -Jøñ PK - ?B íA META-INF/PK - ?B  Ë l È ¤ ' META-INF/MANIFEST.MFPK - ?B ýAÅ org/PK - ?B ýAç org/mobicents/PK - ?B ýA org/mobicents/commons/PK - ?B " ýAG org/mobicents/commons/annotations/PK - ?B¸8ü]ö ” 2 ´ ‡ org/mobicents/commons/annotations/ThreadSafe.classPK - ?BM¬ˆ - ° 1 ´ Í org/mobicents/commons/annotations/Immutable.classPK - ?BMÕýù ¦ 4 ´ & org/mobicents/commons/annotations/Experimental.classPK - ?B§õÏ'ö š 5 ´ x org/mobicents/commons/annotations/NotThreadSafe.classPK - ?B ÿÿÁ META-INF/maven/PK - ?B % ÿÿî META-INF/maven/org.mobicents.commons/PK - ?B 9 ÿÿ1 META-INF/maven/org.mobicents.commons/commons-annotations/PK - * ?B½wæ‚ U @ ´ ˆ META-INF/maven/org.mobicents.commons/commons-annotations/pom.xmlPK - ?B |sY~ † G ´ h
-  META-INF/maven/org.mobicents.commons/commons-annotations/pom.propertiesPK    
      Ù   K
- ======================================= --- /annotations/target/maven-archiver/pom.properties Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,5 +0,0 @@
-#Generated by Maven
-#Thu Jan 31 17:56:40 CET 2013
-version=1.0.0-SNAPSHOT
-groupId=org.mobicents.commons
-artifactId=commons-annotations
=======================================
--- /concurrent/target/classes/org/mobicents/commons/util/concurrent/RevolvingCounter.class Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,47 +0,0 @@
-Êþº¾   1 ?
-   (
-   )      *       +  ,
-   )      -
-   .  /
-        )         0
-   1
- 2 3
-   4
-   1
- 2 5 6 7 -initialValue J limit count (Ljava/util/concurrent/atomic/AtomicLong; lock !Ljava/util/concurrent/locks/Lock; <init> (J)V Code LineNumberTable LocalVariableTable this 8Lorg/mobicents/commons/util/concurrent/RevolvingCounter; (JJ)V getAndIncrement ()J result getCount -SourceFile RevolvingCounter.java
-   !
-   8
- - &java/util/concurrent/atomic/AtomicLong - - 9 (java/util/concurrent/locks/ReentrantLock - - " # :
- ; <
- = #
- > 8 6org/mobicents/commons/util/concurrent/RevolvingCounter java/lang/Object ()V set java/util/concurrent/locks/Lock tryLock ()Z get unlock 1 - ? * · ± - - # $ - ! - ƒ -*· * µ *!µ *» Y· µ *´ ¶ *» Y· -µ -± - - ' ( ) * + ! , , - - - - - " # - Ç c*´ ¶ -@ *´ ”› S*´ -¹ - š §ÿô*´ ¶ *´ ”› *´ @*´ *´ -a¶ § *¶ @*´ -¹ § N*´ -¹ -¿ ­ I U U V U - & 0 1 2 4 / 5 4 6 D 8 I ; a = - c [ $ % # - 2 *´ ¶ ­ - A - - & '
=======================================
--- /concurrent/target/commons-concurrent-1.0.0-SNAPSHOT.jar Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,89 +0,0 @@
-PK - ?B META-INF/PK - ?B!Ÿ?!q É META-INF/MANIFEST.MF}’ËnÂ0 E÷‘ò þ€Ú$P¨ê -ÐJ¥" Úme’!¸ø Ù ¿¯Ã# ºrœÉ {æf ¦ø ¬Ãß`,׊¢˜DaÐ7éŠoÀ4¯§ v¥EçB - -0 -ì)ê ,] JØ ”* à eÎU -J.Üá«_`§{†ß³ueÕ#ÑOç)
-^w
-6 OYºf9P¤MN¤^ð ”³$ÕRjeIé¸ð •–ÆøB Œd!@úGæ<$žs'î‰ééÄÿè/3  žMúÓÙÛÇ<
-æZ
-Š *Ã1‰»U@Ç!ñ„Io˜œÍÐðhâÏ»&_ŸcŠVÎ ´ÕÚn· ¤žû ’Ê´Á£Œ¢9 ˜9¶{@#•’ á š4Ð î˜Y—èŒ/9ø 
q§ûÜëÆ QôÔkfHN+P7j×¥qEfáŠ7WeEÚ Çšm‰¼ ¸Mb²rRÔÒ °©á
-;tl ¢~“X•
-*´DKmP›ì ñ£1ß«VÏör¡½Ã1ßÛÛpù#Ãà PK - ?B org/PK - ?B org/mobicents/PK - ?B org/mobicents/commons/PK - ?B org/mobicents/commons/util/PK - ?B & org/mobicents/commons/util/concurrent/PK - ?B?þq É þ < org/mobicents/commons/util/concurrent/RevolvingCounter.class S]OÓP ~ ûè • ¢(c¢0 £€€SP È‚ ‰zUJ3‹]›t-‰×þ ¯ô pÅ
-‰@ÔD/Mü=^«Ï9] Q£Æ4y¿Îûñ¼Ï9ýòíýG SXÌ¢ Å,º0ÚJ«$؆ñ,Rq¤,­
-F ­qdRF¦Ú0  Òš‘
-”;«aNÃM ÝñœÐ1ÝmÓ l ±& r º R[~äQ «{æ¾iD¡ã –ïYQ Ø^h˜¡_w,cY©ªïÕæ ’®o= (ü¾B
-6Œ*%SÓ
-rò]Ö ×F·©Vü] ÈU
-Ï^ ê;vðÐÜq éb Ä 8Òo “áS§!P©úAͨû;ŽÅ - «×}¯ñËä
-{ßw÷
-¯¶"W² ÎO ×ÔÜ\Í —½ÝUÏ
-ìº-÷M GÉB:° ‘K7Ä•˜‰ì¦  –}ß‘ z~n:!—Öq   )*:Σ[G º †ÿ A
-½¸ ã úÉú (ܰi ¦ J.uôᢎ« Òp[Ç< tÜÁ Ž»¨ Ìý A -j¾kz5ãÁΞmÅÄ °Dæ ÿË
-
-hað<¶X÷˜²&ëÒ‘'“øœ;ù  $%y¢Õ%©¢n‘$(Ÿ{©
-A:û)/Ó[ä3NPk¥Öü        Ä Up
-2K
-
-! k  Õ«|
-y
- Ê’í
-jVh6{ÁV)êré -¥ü ¥Â ’¥ H=:AúˆSÞBË #ÃP+CÙ#´ -`S`„ ‹ò‡C;JD<ÆöãüÊ
-Æ B[>
-QVÛ
-eI@    Ú¼º& Ï„“¤¶äÜcèKy É—¯±IÝö ç ^!}ðýk|ÞÞ<í£N,ɘ4²&   ó1rKq]‡À rë§NùSþ K
-b [
-·
-m¥ãµ†¹
-0‰Œº¤ifÍÀÀ,å
-î¡Âšy˜|bg,[Íõ2xBöc–¯Ÿ.5Í
-¹p¦ úðtRZÅ—U'=Îivâ/£²F~ PK - ?B META-INF/maven/PK - ?B % META-INF/maven/org.mobicents.commons/PK - ?B 8 META-INF/maven/org.mobicents.commons/commons-concurrent/PK - F ?Bj¯Ð w O ? META-INF/maven/org.mobicents.commons/commons-concurrent/pom.xml•SËN 1 -<w¿¢ZqmÜRNUX q ©¥•Š × 5íÂæ¡$} ñï8i· ( œVöŒíñ8Ë­3o(C{­jí¯óy v  Ä 5 VÈ92ãf0 àŠuY7ß2 k_íÙ«ÕŠ­ú‰wÙíöày4œR¡ Jû ´Ä<kQÁÀ§ìÐH *£ÿ0­ý cíËm²“xŒâ¼ÈZ\™ ë'tžú âp’ˈd
-C
-ˆÞâ3g ö¾,¨'S楒 x& RF{ -
-©Â
-êUÈ@á ïl q8‚"s¹›Õ‹ó;Ó‡›ÉônüÈ¡ÉGŽÃšLXâD„yÁ X£ 9Ëá  ±°W› Õ  –
-wF ×Ba1j–jßn
-è{(H ¢.\]D«=y-É.63fVc4 ,ÄQ^Š Cd& ±HãЧuPø 2ò 5;öY à lÚ稒â -ê µlZí › þçDgý Z› Þ›ÿ~¨Ã¥.>vÿA£ôóôZp"ê(L¢ÓN±ºø PK - ?B -ß¿Q} - F META-INF/maven/org.mobicents.commons/commons-concurrent/pom.properties-ÊK
-Â0  Ð}N1ÐuCbý@¡
- ñ ~ ¹@šÆšEfd’ ¼½]¸}¼êäѳÍ~„á
-7;{ •y ¸Z„FƒÞµ›m»Vp8 X)݈Ùs
-„ –Jªº¿ïŸýùaÄÄT>—±#žd¤!8 9IG1 &a9‡—uy    ª
-¡+ÌK ?PK - ?B íA META-INF/PK - ?B!Ÿ?!q É ¤ ' META-INF/MANIFEST.MFPK - ?B ýAÊ org/PK - ?B ýAì org/mobicents/PK - ?B ýA org/mobicents/commons/PK - ?B ýAL org/mobicents/commons/util/PK - ?B & ýA - org/mobicents/commons/util/concurrent/PK - ?B?þq É þ < ´ É org/mobicents/commons/util/concurrent/RevolvingCounter.classPK - ?B ÿÿì META-INF/maven/PK - ?B % ÿÿ META-INF/maven/org.mobicents.commons/PK - ?B 8 ÿÿ\ META-INF/maven/org.mobicents.commons/commons-concurrent/PK - F ?Bj¯Ð w O ? ´ ² META-INF/maven/org.mobicents.commons/commons-concurrent/pom.xmlPK - ?B -ß¿Q} - F ´ † META-INF/maven/org.mobicents.commons/commons-concurrent/pom.propertiesPK - - g ======================================= --- /concurrent/target/maven-archiver/pom.properties Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,5 +0,0 @@
-#Generated by Maven
-#Thu Jan 31 17:56:40 CET 2013
-version=1.0.0-SNAPSHOT
-groupId=org.mobicents.commons
-artifactId=commons-concurrent
=======================================
--- /congestion/src/main/java/org/mobicents/commons/congestion/CPUCongestionMonitor.java Fri Feb 1 03:31:46 2013
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * TeleStax, Open Source Cloud Communications.
- * Copyright 2012 and individual contributors by the @authors tag.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.mobicents.commons.congestion;
-
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.lang.management.OperatingSystemMXBean;
-
-import javax.management.MBeanServerConnection;
-
-import javolution.util.FastList;
-
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author [email protected]
- *
- */
-public class CPUCongestionMonitor implements CongestionMonitor {
- private static final Logger logger = Logger.getLogger(CPUCongestionMonitor.class);
-
-       private static final String SOURCE = "CPU";
-
- private final FastList<CongestionListener> listeners = new FastList<CongestionListener>();
-
-       private OperatingSystemMXBean osMBean;
-       private volatile double percentageOfCPUUsed;
-
-       private volatile boolean cpuTooHigh = false;
-
-       private int backToNormalCPUThreshold;
-
-       private int cpuThreshold;
-
-       public CPUCongestionMonitor() {
-               MBeanServerConnection mbsc = 
ManagementFactory.getPlatformMBeanServer();
-
-               try {
-                       osMBean = ManagementFactory.newPlatformMXBeanProxy(
- mbsc, ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, OperatingSystemMXBean.class);
-               } catch (IOException e) {
- logger.error("Couldn't get the java.lang:type=OperatingSystem MBean", e);
-               }
-       }
-
-       /**
-        * @param backToNormalPercentageOfMemoryUsed
-        *            the backToNormalPercentageOfMemoryUsed to set
-        */
-       public void setBackToNormalCPUThreshold(int backToNormalCPUThreshold) {
-               this.backToNormalCPUThreshold = backToNormalCPUThreshold;
-               if (logger.isInfoEnabled()) {
- logger.info("Back To Normal CPU threshold set to " + backToNormalCPUThreshold + "%");
-               }
-       }
-
-       /**
-        * @return the backToNormalPercentageOfCPUThreshold
-        */
-       public int getBackToNormalCPUThreshold() {
-               return backToNormalCPUThreshold;
-       }
-
-       /**
-        * @param cpuThreshold
-        *            the cpuThreshold to set
-        */
-       public void setCPUThreshold(int cpuThreshold) {
-               this.cpuThreshold = cpuThreshold;
-               if (logger.isInfoEnabled()) {
-                       logger.info("CPU threshold set to " + this.cpuThreshold + 
"%");
-               }
-       }
-
-       /**
-        * @return the cpuThreshold
-        */
-       public int getCPUThreshold() {
-               return cpuThreshold;
-       }
-
-       /*
-        * (non-Javadoc)
-        * @see org.mobicents.commons.congestion.CongestionMonitor#monitor()
-        */
-       @Override
-       public void monitor() {
-               if(osMBean == null) {
-                       return;
-               }
-
-               percentageOfCPUUsed = osMBean.getSystemLoadAverage();
-               if(logger.isTraceEnabled()) {
-                       logger.trace("System Load Average = " + 
percentageOfCPUUsed);
-               }
-               if (this.cpuTooHigh) {
-                       if (this.percentageOfCPUUsed < 
this.backToNormalCPUThreshold) {
- logger.warn("Memory used: " + percentageOfCPUUsed + "% < to the back to normal CPU threshold : " + this.backToNormalCPUThreshold);
-                               this.cpuTooHigh = false;
-
-                               // Lets notify the listeners
- for (FastList.Node<CongestionListener> n = listeners.head(), end = listeners.tail(); (n = n.getNext()) != end;) {
-                                       CongestionListener listener = 
n.getValue();
-                                       listener.onCongestionFinish(SOURCE);
-                               }
-                       }
-               } else {
-                       if (this.percentageOfCPUUsed > cpuThreshold) {
- logger.warn("Memory used: " + percentageOfCPUUsed + "% > to the CPU threshold : " + this.cpuThreshold);
-                               this.cpuTooHigh = true;
-
-                               // Lets notify the listeners
- for (FastList.Node<CongestionListener> n = listeners.head(), end = listeners.tail(); (n = n.getNext()) != end;) {
-                                       CongestionListener listener = 
n.getValue();
-                                       listener.onCongestionStart(SOURCE);
-                               }
-                       }
-               }
-
-       }
-
-       /*
-        * (non-Javadoc)
- * @see org.mobicents.commons.congestion.CongestionMonitor#addCongestionListener(org.mobicents.commons.congestion.CongestionListener)
-        */
-       @Override
-       public void addCongestionListener(CongestionListener listener) {
-               this.listeners.add(listener);
-       }
-
-       /*
-        * (non-Javadoc)
- * @see org.mobicents.commons.congestion.CongestionMonitor#removeCongestionListener(org.mobicents.commons.congestion.CongestionListener)
-        */
-       @Override
-       public void removeCongestionListener(CongestionListener listener) {
-               this.listeners.remove(listener);
-       }
-
-       /*
-        * (non-Javadoc)
-        * @see org.mobicents.commons.congestion.CongestionMonitor#getSource()
-        */
-       @Override
-       public String getSource() {
-               return SOURCE;
-       }
-
-}
=======================================
--- /fsm/target/classes/org/mobicents/commons/event/Event.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/classes/org/mobicents/commons/event/EventBus$Builder.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/classes/org/mobicents/commons/event/EventBus$Dispatcher.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/classes/org/mobicents/commons/event/EventBus.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/classes/org/mobicents/commons/event/EventHandler.class Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,5 +0,0 @@
-Êþº¾ 1 - - accept &(Lorg/mobicents/commons/event/Event;)Z Signature )(Lorg/mobicents/commons/event/Event<*>;)Z handle &(Lorg/mobicents/commons/event/Event;)V )(Lorg/mobicents/commons/event/Event<*>;)V -SourceFile EventHandler.java (org/mobicents/commons/event/EventHandler java/lang/Object - ======================================= --- /fsm/target/classes/org/mobicents/commons/fsm/Action.class Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,5 +0,0 @@
-Êþº¾ 1 - - execute G(Lorg/mobicents/commons/event/Event;Lorg/mobicents/commons/fsm/State;)V Signature b<T:Ljava/lang/Object;>(Lorg/mobicents/commons/event/Event<TT;>;Lorg/mobicents/commons/fsm/State;)V -SourceFile -Action.java org/mobicents/commons/fsm/Action java/lang/Object ======================================= --- /fsm/target/classes/org/mobicents/commons/fsm/Condition.class Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,4 +0,0 @@
-Êþº¾ 1 - - accept L(Lorg/mobicents/commons/event/Event;Lorg/mobicents/commons/fsm/Transition;)Z Signature g<T:Ljava/lang/Object;>(Lorg/mobicents/commons/event/Event<TT;>;Lorg/mobicents/commons/fsm/Transition;)Z -SourceFile Condition.java #org/mobicents/commons/fsm/Condition java/lang/Object ======================================= --- /fsm/target/classes/org/mobicents/commons/fsm/FiniteStateMachine.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/classes/org/mobicents/commons/fsm/FiniteStateMachineException.class Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,22 +0,0 @@
-Êþº¾ 1 - - - serialVersionUID J -ConstantValue <init> (Ljava/lang/String;)V Code LineNumberTable LocalVariableTable this 7Lorg/mobicents/commons/fsm/FiniteStateMachineException; message Ljava/lang/String; *(Ljava/lang/String;Ljava/lang/Throwable;)V cause Ljava/lang/Throwable; -SourceFile FiniteStateMachineException.java - - - - - 5org/mobicents/commons/fsm/FiniteStateMachineException java/lang/Exception ! - - - > *+· ± - - - - - - I *+,· ± - - ! ======================================= --- /fsm/target/classes/org/mobicents/commons/fsm/State.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/classes/org/mobicents/commons/fsm/Transition.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/classes/org/mobicents/commons/fsm/TransitionFailedException.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/classes/org/mobicents/commons/fsm/TransitionNotFoundException.class Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/commons-fsm-1.0.0-SNAPSHOT.jar  Thu Jan 31 08:56:44 2013
+++ /dev/null   
Binary file, no diff available.
=======================================
--- /fsm/target/maven-archiver/pom.properties   Thu Jan 31 08:56:44 2013
+++ /dev/null
@@ -1,5 +0,0 @@
-#Generated by Maven
-#Thu Jan 31 17:56:41 CET 2013
-version=1.0.0-SNAPSHOT
-groupId=org.mobicents.commons
-artifactId=commons-fsm
=======================================
--- /congestion/.classpath      Thu Jan 31 08:56:44 2013
+++ /congestion/.classpath      Fri Feb  1 05:40:23 2013
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="var" path="M2_REPO/javolution/javolution/5.5.1/javolution-5.5.1.jar"/> - <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.5.5/slf4j-log4j12-1.5.5.jar"/> - <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar"/> - <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar"/> - <classpathentry kind="var" path="M2_REPO/junit/junit/4.8.2/junit-4.8.2.jar"/>
+       <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="var" path="M2_REPO/javolution/javolution/5.5.1/javolution-5.5.1.jar"/> + <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.5.5/slf4j-log4j12-1.5.5.jar"/> + <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar"/> + <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar"/> + <classpathentry kind="var" path="M2_REPO/junit/junit/4.8.2/junit-4.8.2.jar"/>
+       <classpathentry kind="output" path="target/classes"/>
 </classpath>
=======================================
--- /congestion/pom.xml Thu Jan 31 08:56:44 2013
+++ /congestion/pom.xml Fri Feb  1 05:40:23 2013
@@ -17,7 +17,7 @@
                        <groupId>javolution</groupId>
                        <artifactId>javolution</artifactId>
                        <version>${javolution.version}</version>
-               </dependency>
+               </dependency>
        </dependencies>

 </project>

--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to