activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1082637 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
Date Thu, 17 Mar 2011 18:47:14 GMT
Author: chirino
Date: Thu Mar 17 18:47:14 2011
New Revision: 1082637

URL: http://svn.apache.org/viewvc?rev=1082637&view=rev
Log:
Looks like on ubuntu, ulimit is not a executable, but a shell command.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=1082637&r1=1082636&r2=1082637&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
Thu Mar 17 18:47:14 2011
@@ -267,7 +267,7 @@ class Broker() extends BaseService {
       connection_log = Log(log_category.connection.getOrElse(base_category+"connection"))
       console_log = Log(log_category.console.getOrElse(base_category+"console"))
 
-      log_ulimit
+      check_file_limit
 
       if( config.key_storage!=null ) {
         key_storage = new KeyStorage
@@ -353,30 +353,42 @@ class Broker() extends BaseService {
     tracker.callback(on_completed)
   }
 
-  private def log_ulimit = {
+  private def check_file_limit = {
     import ProcessSupport._
-    launch("ulimit", "-n") { case (rc, out, err) =>
-      if( rc==0 ) {
-        try {
-          val limit = new String(out).trim
-          console_log.info("OS is restricting our open file limit to: %s", limit)
-          if( limit!="unlimited" ) {
-            val l = limit.toInt
-
-            var min_limit = 500 // estimate.. perhaps could we do better?
-            config.connectors.foreach { connector=>
-              import OptionSupport._
-              min_limit += connector.connection_limit.getOrElse(10000)
-            }
-
-            if( l < min_limit ) {
-              console_log.warn("Please increase the process file limit using 'ulimit -n %d'
or configure lower the connection limits on the broker connectors.", min_limit)
-            }
-          }
-        } catch {
-          case _ =>
+
+    def process(out:Array[Byte]) = try {
+      val limit = new String(out).trim
+      console_log.info("OS is restricting the open file limit to: %s", limit)
+      if( limit!="unlimited" ) {
+        val l = limit.toInt
+
+        var min_limit = 500 // estimate.. perhaps could we do better?
+        config.connectors.foreach { connector=>
+          import OptionSupport._
+          min_limit += connector.connection_limit.getOrElse(10000)
+        }
+
+        if( l < min_limit ) {
+          console_log.warn("Please increase the process file limit using 'ulimit -n %d' or
configure lower the connection limits on the broker connectors.", min_limit)
+        }
+      }
+    } catch {
+      case _ =>
+    }
+
+    try {
+      launch("ulimit","-n") { case (rc, out, err) =>
+        if( rc==0 ) {
+          process(out)
         }
       }
+    } catch {
+      case _ =>
+        launch("sh", "-c", "ulimit -n") { case (rc, out, err) =>
+          if( rc==0 ) {
+            process(out)
+          }
+        }
     }
 
   }



Mime
View raw message