code: private synchronized void writeObject(ObjectOutputStream oos) throws IOException {
  
          int serializable = 0;
          oos.defaultWriteObject();
  
          // write out the service providers
          Set<Map.Entry<Class, ServiceProvider>> providers = _serviceProviders.entrySet();
          for (Map.Entry<Class, ServiceProvider> provider : providers) {
              if (provider.getValue().isSerializable()) {
                  serializable++;
              }
          }
  
          oos.writeInt(serializable);
          if (serializable > 0) {
              for (Map.Entry<Class, ServiceProvider> entry : providers) {
                  if (entry.getValue().isSerializable()) {
                      oos.writeObject(entry.getKey());
                      oos.writeObject(entry.getValue());
                  }
              }
          }
  
          // write out the event listeners
          serializable = 0;
          for (BeanContextServicesListener l : _bcsListeners) {
              if (l instanceof Serializable) {
                  serializable++;
              }
          }
  
          oos.writeInt(serializable);
          if (serializable > 0) {
              for (BeanContextServicesListener l : _bcsListeners) {
                  if (l instanceof Serializable) {
                      oos.writeObject(l);
                  }
              }
          }
      }
docs: Serialize this instance including any serializable services and BeanContextServicesListeners.
  Any services or listeners which are not Serializable will not be present once deserialized.
  
  @param oos
  @throws IOException