Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merging in latest master changes

  • Loading branch information...
commit 1d2bb659613427c68865ed4f264ebcaa26f019be 2 parents 1b5e50c + d534b42
@stevej stevej authored
View
2  .gitignore
@@ -13,3 +13,5 @@ project/boot
.DS_Store
src_managed
.ensime
+project/plugins/project
+ostrich.tmproj
View
4 project/build.properties
@@ -1,9 +1,9 @@
#Project properties
-#Thu Sep 16 00:02:01 PDT 2010
+#Thu Sep 23 00:52:49 PDT 2010
project.organization=com.twitter
project.name=ostrich
sbt.version=0.7.4
project.version=2.2.6
-def.scala.version=2.8.0
+def.scala.version=2.7.7
build.scala.versions=2.8.0
project.initialize=false
View
5 project/plugins/Plugins.scala
@@ -1,7 +1,6 @@
import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
- val scalaTools = "scala-tools.org" at "http://scala-tools.org/repo-releases/"
- val lagNet = "twitter.com" at "http://www.lag.net/repo/"
- val defaultProject = "com.twitter" % "standard-project" % "0.7.4"
+ val twitterMaven = "twitter.com" at "http://maven.twttr.com/"
+ val defaultProject = "com.twitter" % "standard-project" % "0.7.5"
}
View
3  project/plugins/project/build.properties
@@ -1,3 +0,0 @@
-#Project properties
-#Sat Sep 11 13:18:18 PDT 2010
-plugin.uptodate=true
View
8 src/main/resources/graph.html
@@ -2,10 +2,10 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <script type="text/javascript" src="static/jquery.js"></script>
- <script type="text/javascript" src="static/jquery.flot.js"></script>
- <script type="text/javascript" src="static/jquery.flot.selection.js"></script>
- <script type="text/javascript" src="static/drawgraph.js"></script>
+ <script type="text/javascript" src="/static/jquery.js"></script>
+ <script type="text/javascript" src="/static/jquery.flot.js"></script>
+ <script type="text/javascript" src="/static/jquery.flot.selection.js"></script>
+ <script type="text/javascript" src="/static/drawgraph.js"></script>
</head>
<body>
View
9 src/main/scala/com/twitter/ostrich/AdminHttpService.scala
@@ -73,7 +73,14 @@ class FolderResourceHandler(staticPath: String) extends CustomHttpHandler {
val requestPath = exchange.getRequestURI().getPath()
val n = requestPath.lastIndexOf('/')
val relativePath = if (n >= 0) requestPath.substring(n + 1) else requestPath
- render(loadResource(staticPath + "/" + relativePath), exchange)
+ val contentType = if (relativePath.endsWith(".js")) {
+ "text/javascript"
+ } else if (relativePath.endsWith(".html")) {
+ "text/html"
+ } else {
+ "application/unknown"
+ }
+ render(loadResource(staticPath + "/" + relativePath), exchange, 200, contentType)
}
}
View
5 src/main/scala/com/twitter/ostrich/AdminSocketService.scala
@@ -66,11 +66,12 @@ class AdminSocketService(config: ConfigMap, runtime: RuntimeEnvironment) extends
future.addListener(new ChannelGroupFutureListener() {
def operationComplete(future: ChannelGroupFuture) {
- val completed = future.awaitUninterruptibly(500)
- log.debug("shutdown completed: " + completed)
bootstrap.releaseExternalResources()
}
})
+
+ val completed = future.awaitUninterruptibly(500)
+ log.debug("Shutdown completed: " + completed)
}
}
View
17 src/main/scala/com/twitter/ostrich/ServiceTracker.scala
@@ -28,6 +28,7 @@ object ServiceTracker {
val services = new mutable.HashSet[Service]
val queuedAdminHandlers = new mutable.HashMap[String, HttpHandler]
var adminHttpService: Option[AdminHttpService] = None
+ var adminService: Option[AdminSocketService] = None
def register(service: Service) {
services += service
@@ -36,16 +37,18 @@ object ServiceTracker {
def shutdown() {
services.foreach { _.shutdown() }
services.clear()
+ stopAdmin()
}
def quiesce() {
services.foreach { _.quiesce() }
services.clear()
+ stopAdmin()
}
def startAdmin(config: ConfigMap, runtime: RuntimeEnvironment) = synchronized {
val _adminHttpService = new AdminHttpService(config, runtime)
- val adminService = new AdminSocketService(config, runtime)
+ val _adminService = new AdminSocketService(config, runtime)
config.getString("admin_jmx_package").map(StatsMBean(_))
if (config.getBool("admin_timeseries", true)) {
val collector = new TimeSeriesCollector()
@@ -58,11 +61,21 @@ object ServiceTracker {
}
_adminHttpService.start()
- adminService.start()
+ _adminService.start()
adminHttpService = Some(_adminHttpService)
+ adminService = Some(_adminService)
}
+ def stopAdmin() = synchronized {
+ adminHttpService.map { _.shutdown() }
+ adminHttpService = None
+
+ adminService.map { _.shutdown() }
+ adminService = None
+ }
+
+
def registerAdminHttpHandler(path: String)(generator: (List[List[String]]) => String) = {
val handler = new CustomHttpHandler {
def handle(exchange: HttpExchange) {
Please sign in to comment.
Something went wrong with that request. Please try again.