@@ -136,14 +136,15 @@ object HookupClient {
136
136
*/
137
137
private final class HookupClientHost (val client : HookupClient )(implicit executionContext : ExecutionContext ) extends HookupClientLike with BroadcastChannel with Connectable with Reconnectable {
138
138
139
+ import HookupClientHost ._
140
+
139
141
private [this ] val normalized = client.settings.uri.normalize()
140
142
private [this ] val tgt = if (normalized.getPath == null || normalized.getPath.trim().isEmpty) {
141
143
new URI (normalized.getScheme, normalized.getAuthority, " /" , normalized.getQuery, normalized.getFragment)
142
144
} else normalized
143
145
144
- private [this ] val bootstrap = new ClientBootstrap (HookupClientHost . clientSocketChannelFactory)
146
+ private [this ] val bootstrap = new ClientBootstrap (clientSocketChannelFactory)
145
147
private [this ] var handshaker : WebSocketClientHandshaker = null
146
- private [this ] val timer = new HashedWheelTimer ()
147
148
private [this ] var channel : Channel = null
148
149
private [this ] var _isConnected : Promise [OperationResult ] = Promise [OperationResult ]()
149
150
private [this ] val buffer = client.settings.buffer
@@ -329,25 +330,7 @@ object HookupClient {
329
330
}
330
331
331
332
disconnected.future onComplete {
332
- case _ ⇒ {
333
- _isConnected = Promise [OperationResult ]()
334
- try {
335
- if (! isReconnecting && bootstrap != null ) {
336
- val thread = new Thread {
337
- override def run = {
338
- timer.stop.asScala foreach (_.cancel())
339
- }
340
- }
341
- thread.setDaemon(false )
342
- thread.start()
343
- thread.join()
344
- }
345
- } catch {
346
- case e : Throwable ⇒ logger.error(" error while closing the connection" , e)
347
- } finally {
348
- if (! closing.isCompleted) closing.success(Success )
349
- }
350
- }
333
+ _ ⇒ if (! closing.isCompleted) closing.success(Success )
351
334
}
352
335
353
336
closing.future
@@ -390,6 +373,8 @@ object HookupClient {
390
373
object HookupClientHost {
391
374
private lazy val clientSocketChannelFactory =
392
375
new NioClientSocketChannelFactory (Executors .newCachedThreadPool(), Executors .newCachedThreadPool())
376
+
377
+ private lazy val timer = new HashedWheelTimer
393
378
}
394
379
395
380
/**
0 commit comments