Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Commit

Permalink
merging in latest master changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stevej committed Oct 15, 2010
2 parents 1b5e50c + d534b42 commit 1d2bb65
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ project/boot
.DS_Store
src_managed
.ensime
project/plugins/project
ostrich.tmproj
4 changes: 2 additions & 2 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions project/plugins/Plugins.scala
Original file line number Diff line number Diff line change
@@ -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"
}
3 changes: 0 additions & 3 deletions project/plugins/project/build.properties

This file was deleted.

8 changes: 4 additions & 4 deletions src/main/resources/graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
9 changes: 8 additions & 1 deletion src/main/scala/com/twitter/ostrich/AdminHttpService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/com/twitter/ostrich/AdminSocketService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
17 changes: 15 additions & 2 deletions src/main/scala/com/twitter/ostrich/ServiceTracker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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) {
Expand Down

0 comments on commit 1d2bb65

Please sign in to comment.