InterruptibleEquality
tinyscalautils.lang.InterruptibleEquality
trait InterruptibleEquality
Checks for thread interrupts in equals
and hashCode
.
This can be used to make code more responsive to interrupts, e.g.:
class MyFancyClass extends SomeInterface with InterruptibleEquality:
...
If a thread is interrupted and then attempts to call equals
or hashCode
, an InterruptedException
will be thrown; otherwise, the call is forwarded to the super method.
Note that ==
and ##
rely on equals
and hasCode
, and thus will also throw the InterruptedException
.
Attributes
- Since
-
1.0
- Source
- InterruptibleEquality.scala
- Graph
-
- Supertypes
Members list
In this article