code: @SuppressWarnings("unchecked")
      void read(ObjectInputStream in) throws ClassNotFoundException, IOException {
          GetField fields = in.readFields();
  
          internalPropNames = (Set<String>) fields.get(INTERNAL_PROP_NAMES, null);
  
          byte[] bytes = (byte[]) fields.get(OBJECT, null);
  
          // TODO: for internal usage, find a way to supply the class loader of the bundle that creates the contextual object?
  
          DeserializationObjectInputStream doin = new DeserializationObjectInputStream(
                          new ByteArrayInputStream(bytes),
                          AccessController.doPrivileged(getThreadContextClassLoader));
          object = (T) doin.readObject();
          doin.close();
  
          Map<String, String> execProps = (Map<String, String>) fields.get(EXEC_PROPS, null);
  
          bytes = (byte[]) fields.get(CONTEXT, null);
          threadContextDescriptor = (ThreadContextDescriptorImpl) ThreadContextDeserializer.deserialize(bytes, execProps);
      }
docs: Deserialize.
  
  @param in stream from which to deserialize
  @throws ClassNotFoundException if a class for a field cannot be found
  @throws IOException if there is an error reading from the stream