So I thought about this a bit more.  Your code is correct.  However, rather than do this, maybe we should update the interface so that T extends Serializable, then you won't need to check this at runtime.  Practically, all our messages into the Q's should implement Serializable anyway.