-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86011e7
commit 1878228
Showing
2 changed files
with
17 additions
and
22 deletions.
There are no files selected for viewing
20 changes: 1 addition & 19 deletions
20
org.scala-ide.sdt.debug/src/org/scalaide/debug/internal/model/ClassPrepareListener.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,9 @@ | ||
package org.scalaide.debug.internal.model | ||
|
||
import com.sun.jdi.event.ClassPrepareEvent | ||
import scala.concurrent.Await | ||
import scala.concurrent.Future | ||
import scala.util.Try | ||
|
||
trait ClassPrepareListener { | ||
import scala.concurrent.duration._ | ||
val Timeout = 500 millis | ||
type Timeouted = Boolean | ||
|
||
def notify(event: ClassPrepareEvent): Timeouted = { | ||
import scala.concurrent.ExecutionContext.Implicits.global | ||
import scala.concurrent.TimeoutException | ||
|
||
Try { | ||
Await.ready(Future { consume(event) }, Timeout) | ||
}.map { _ => | ||
false | ||
}.recover { | ||
case e: TimeoutException => true | ||
}.get | ||
} | ||
def notify(event: ClassPrepareEvent): Boolean = SyncCall.ready(consume(event)) | ||
|
||
protected def consume(event: ClassPrepareEvent): Unit | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters