Object readResolve ( ) throws ObjectStreamException { // Replace the marshalled instance type with the local instance BlockingMode mode = ABORT ; switch ( type ) { case RUN_TYPE : mode = RUN ; break ; case WAIT_TYPE : mode = RUN ; break ; case DISCARD_TYPE : mode = RUN ; break ; case DISCARD_OLDEST_TYPE : mode = RUN ; break ; case ABORT_TYPE : mode = RUN ; break ; } return mode ; }
Overriden to return the indentity instance of BlockingMode based on the stream type int value . This ensures that BlockingMode enums can be compared using == .