docs: public void activate(StatefulBeanO beanO, BeanMetaData bmd) // d648122
      throws RemoteException
      {
          final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
          if (isTraceOn && tc.isEntryEnabled()) //130050
              Tr.entry(tc, "activate: " + beanO);
  
          Object sb = null; // d367572.7
          ManagedObjectContext ejbState = null;
          BeanId bid = beanO.getId();
          ClassLoader classLoader = bmd.classLoader; // d648122
  
          // LI2775-107.2 Begins WS18354.02a,MD19305C
          Object credToken = ivContainer.getEJBRuntime().pushServerIdentity();
  
          // LI2775-107.2 Ends
  
          ObjectInputStream beanStream = null;
          GZIPInputStream istream = null;
          try
          {
              //PK69093 - Only allow one stream to be open for reading at one time
              synchronized (ivActivateLock)
              {
                  // LIDB2018-1 begins
                  // Check whether SFSB failover is enabled.
                  if (!beanO.sfsbFailoverEnabled())
                  {
                      if (isTraceOn && tc.isDebugEnabled())
                          Tr.debug(tc, "Failover is NOT enabled");
  
                      istream = ivBeanStore.getGZIPInputStream(bid);
                      beanStream = createActivationInputStream(istream, beanO, classLoader);
                  }
                  else
                  {
                      if (isTraceOn && tc.isDebugEnabled())
                          Tr.debug(tc, "Failover is enabled");
  
                      // SFSB failover is enabled.  Determine whether to
                      // get compressed data from passivation file or
                      // from failover cache.
                      byte[] data = null;
                      if (ivStatefulFailoverCache.beanExists(bid))
                      {
                          if (isTraceOn && tc.isDebugEnabled())
                              Tr.debug(tc, "Retrieving data from failover cache");
  
                          // Exists in failover cache, so activate using data in failover cache.
                          boolean isSticky = ivStatefulFailoverCache.inStickyUOW(bid); // d209857
                          data = ivStatefulFailoverCache.getAndRemoveData(bid, beanO.ivSfFailoverClient); // d209857 //d229518
                          if (isSticky)
                          {
                              // SFSB failover occured while in middle of a sticky BMT.
                              // This is not supported, so throw an exception.
                              throw new NoSuchObjectException("Bean Managed Transaction is active, SFSB failover not supported");
                          }
  
                          if (data == null)
                          {
                              // For some reason failover cache entry exists, but replication
                              // of SFSB to this server was unsuccessful.
                              throw new NoSuchObjectException("SFSB replication failed.");
                          }
                      }
                      else
                      {
                          //SFSB not in failover cache. so get data from passivation file.
                          InputStream fis = ivBeanStore.getInputStream(bid);
                          ObjectInputStream beanStream2 = createActivationInputStream(fis, beanO, classLoader);
                          int n = beanStream2.readInt();
                          data = new byte[n];
  
                          if (isTraceOn && tc.isDebugEnabled())
                              Tr.debug(tc, "length of compressed bytes is: " + n);
  
                          int bytesRead = 0;
                          for (int offset = 0; offset < n; offset += bytesRead)
                          {
                              bytesRead = beanStream2.read(data, offset, n - offset);
                              if (isTraceOn && tc.isDebugEnabled())
                              {
                                  Tr.debug(tc, "bytes read from input stream is: " + bytesRead);
                              }
  
                              if (bytesRead == -1)
                              {
                                  throw new IOException("end of input stream while reading compressed bytes");
                              }
                          }
  
                          beanStream2.close();
                      }
  
                      // create an input stream for decompressing the SFSB data.
                      ByteArrayInputStream bais = new ByteArrayInputStream(data);
                      istream = new GZIPInputStream(bais);
                      beanStream = createActivationInputStream(istream, beanO, classLoader);
                  }
  
                  // If failover was enabled and the EJB module is pre-3.0, the old format is used
                  boolean oldFormat = beanO.sfsbFailoverEnabled() && (getEJBModuleVersion(beanO) < BeanMetaData.J2EE_EJB_VERSION_3_0);
  
                  //  d204278.2 begin
                  // First read in last access time from input stream
                  // and set it in the StatefulBeanO.
                  long lastAccessTime = beanStream.readLong();
                  if (isTraceOn && tc.isDebugEnabled())
                      Tr.debug(tc, "read from data last access time: " + lastAccessTime);
                  beanO.setLastAccessTime(lastAccessTime);
                  // d204278.2 end
  
                  // Read the JPAExPcBindingContext.
                  // TODO: ejbteam - Since we are very late in the EJB3 FP cycle I will not
                  // make this change now, but we really should only be passivating and
                  // activating this value when this EJB has ContainerManaged Extended
                  // Persistence Context.    When this change is made we will need to
                  // change this method, but also the passivate method and StatefulBeanO.remove().
                  // It can also be removed from the logic for activating and passivating
                  // 2.0 and 2.1 SFSB's since they will not have an extendedPC
                  // An incomplete change will result in NPE's in certain circumstances.  //d477342
                  Object exPC = beanStream.readObject();
                  beanO.setJPAExPcBindingContext(exPC);
  
                  Map<String, Map<String, Field>> passivatorFields = null;
                  if (oldFormat)
                  {
                      // Now read SFSB data from the input stream and close
                      // the input stream.
                      sb = beanStream.readObject(); // d367572.7
                      ejbState = null;
                  }
                  else
                  {
                      EJBObjectInfo sbObjectInfo = (EJBObjectInfo) beanStream.readObject();
                      passivatorFields = getPassivatorFields(bmd); // d648122
  
                      if (sbObjectInfo.isSerializable())
                      {
                          sb = sbObjectInfo.getSerializableObject();
                      }
                      else
                      {
                          sb = activateObjectFromInfo(sbObjectInfo, bmd.enterpriseBeanClass, passivatorFields); // d648122
                      }
  
                      ejbState = readManagedObjectContext(beanStream, bmd, sb); // F87720
  
                      int expectedNumInterceptors = 0;
                      if (bmd.ivInterceptorMetaData != null && bmd.ivInterceptorMetaData.ivInterceptorClasses != null)
                      {
                          expectedNumInterceptors = bmd.ivInterceptorMetaData.ivInterceptorClasses.length;
                      }
  
                      // Handle interceptors
                      int n = beanStream.readInt();
                      if (isTraceOn && tc.isDebugEnabled())
                          Tr.debug(tc, "number of interceptors is " + n);
  
                      if (n == -1)
                      {
                          n = 0;
                      }
  
                      if (n != expectedNumInterceptors) // RTC97224
                      {
                          throw new RemoteException("interceptor count " + n +
                                                    " in serialization data does not match actual count " + expectedNumInterceptors);
                      }
  
                      if (n != 0)
                      {
                          Class<?>[] interceptorClasses = bmd.ivInterceptorMetaData.ivInterceptorClasses;
                          Object[] interceptors = new Object[n];
  
                          for (int i = 0; i < n; i++)
                          {
                              EJBObjectInfo interceptorObjectInfo = (EJBObjectInfo) beanStream.readObject();
                              if (interceptorObjectInfo.isSerializable())
                              {
                                  interceptors[i] = interceptorObjectInfo.getSerializableObject();
                              }
                              else
                              {
                                  interceptors[i] = activateObjectFromInfo(interceptorObjectInfo, interceptorClasses[i], passivatorFields); // d648122
                              }
  
                          }
                          beanO.setInterceptors(interceptors);
                      }
  
                      beanO.setLastAccessTime(lastAccessTime);
                  }
  
                  beanStream.close();
              }
  
              beanO.setEnterpriseBean(sb, ejbState);
  
              // PK69093 - beanStore.remove will access a file, as such lets synch this call
              // such that only one file can be open for remove at a time.
              synchronized (ivRemoveLock)
              {
                  // Now delete the file used to passivate the bean.
                  ivBeanStore.remove(bid); //d248470
              }
  
              // LIDB2018-1 ends
          } catch (StreamUnavailableException ex)
          {
              FFDCFilter.processException(ex, CLASS_NAME + ".activate", "146", this);
              throw new NoSuchObjectException("");
          } catch (CSIException ex)
          {
              FFDCFilter.processException(ex, CLASS_NAME + ".activate", "149", this);
              throw new RemoteException("activation failed", ex);
          } catch (ClassNotFoundException e)
          {
              FFDCFilter.processException(e, CLASS_NAME + ".activate", "152", this);
              Tr.warning(tc, "CANNOT_ACTIVATE_STATEFUL_BEAN_CNTR0003W",
                         new Object[] { beanO.toString(), this, e }); //p111002.3
              throw new RemoteException("", e);
          } catch (RemoteException rex)
          {
              // RemoteException (including NoSuchObjectExcetpion) is a subclass
              // of IOException... but it should not get wrapped inside another
              // RemoteException, which IOException catch block will do.   d350987
              FFDCFilter.processException(rex, CLASS_NAME + ".activate", "576", this);
              Tr.warning(tc, "CANNOT_ACTIVATE_STATEFUL_BEAN_CNTR0003W",
                         new Object[] { beanO.toString(), this, rex });
              throw rex;
          } catch (IOException e)
          {
              FFDCFilter.processException(e, CLASS_NAME + ".activate", "157", this);
              Tr.warning(tc, "CANNOT_ACTIVATE_STATEFUL_BEAN_CNTR0003W",
                         new Object[] { beanO.toString(), this, e }); //p111002.3
              throw new RemoteException("", e);
              // LI2775-107.2 Begins WS18354.02a,MD19305C
          } finally
          {
              if (credToken != null) // d646413.2
              {
                  ivContainer.getEJBRuntime().popServerIdentity(credToken);
              }
              // LI2775-107.2 Begins WS18354.02a,MD19305C
          }
  
          if (isTraceOn && tc.isEntryEnabled()) //130050
              Tr.exit(tc, "activate");
      }