Browse files

Merge branch 'master' into extra_copy_status

  • Loading branch information...
2 parents 010ba8e + db2ea09 commit 60824e742a3a1b902565ec2d433463b627757b08 @freels freels committed Jan 18, 2011
View
2 project/build/GizzardProject.scala
@@ -5,7 +5,7 @@ class GizzardProject(info: ProjectInfo) extends StandardProject(info) with Subve
override def filterScalaJars = false
val scalaTools = "org.scala-lang" % "scala-compiler" % "2.7.7"
- inline("com.twitter" %% "querulous" % "1.5.1")
+ inline("com.twitter" %% "querulous" % "1.5.4")
inline("net.lag" % "configgy" % "1.6.10-SNAPSHOT")
inline("net.lag" % "kestrel" % "1.2.7")
inline("com.twitter" % "ostrich" % "1.2.10")
View
15 src/main/scala/com/twitter/gizzard/thrift/TSelectorServer.scala
@@ -111,14 +111,15 @@ class TSelectorServer(name: String, processor: TProcessor, serverSocket: ServerS
}
def shutdown() {
- running = false
- selectorThread.join()
- try {
- serverSocket.close()
- } catch {
- case _ =>
+ if ((selectorThread ne null) && selectorThread.isAlive()) {
+ running = false
+ selectorThread.join()
+ try {
+ serverSocket.close()
+ } catch {
+ case _ =>
+ }
}
-
executor.shutdown()
while (!executor.isTerminated()) {
log.info("Waiting for thread-pool executor...")
View
10 src/main/scala/com/twitter/gizzard/thrift/TThreadServer.scala
@@ -60,7 +60,7 @@ class TThreadServer(name: String, port: Int, idleTimeout: Int,
private val ACCEPT_TIMEOUT = 1000
private val SHUTDOWN_TIMEOUT = 5000
- @volatile var running = true
+ @volatile var running = false
private val deathSwitch = new CountDownLatch(1)
def start() {
@@ -78,6 +78,8 @@ class TThreadServer(name: String, port: Int, idleTimeout: Int,
serverSocket.setReuseAddress(true)
serverSocket.setSoTimeout(ACCEPT_TIMEOUT)
+ running = true
+
while (running) {
try {
val client = serverSocket.accept()
@@ -113,8 +115,10 @@ class TThreadServer(name: String, port: Int, idleTimeout: Int,
}
override def stop() {
- running = false
- deathSwitch.await()
+ if (running) {
+ running = false
+ deathSwitch.await()
+ }
}
private def process(client: Socket) {

0 comments on commit 60824e7

Please sign in to comment.