code: private synchronized void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
          // todo: for multithreaded usage this block needs to be synchronized
          in.defaultReadObject();
          initialize();
  
          // only deserialize child if not using a peer
          if (this.equals(getPeer())) {
              readChildren(in);
          }
  
          int listenerCount = in.readInt();
          for (int i = 0; i < listenerCount; i++) {
              addBeanContextMembershipListener((BeanContextMembershipListener) in.readObject());
          }
          // end synchronized block
      }
docs: Deserialize this an instance of this class, including any children and
  BeanContextMembershipListeners which were present during serialization and
  were serializable.
  
  @param in ObjectInputStream to deserialize from.
  @throws IOException
  @throws ClassNotFoundException