code: private ServiceRefAmp service(StubFactoryAmp stubFactory)
    {
      validateOpen();
      
      Thread thread = Thread.currentThread();
      ClassLoader oldLoader = thread.getContextClassLoader();
      OutboxAmp outbox = OutboxAmp.current();
      Object oldContext = null;
      
      try {
        thread.setContextClassLoader(_services.classLoader());
        
        if (outbox != null) {
          oldContext = outbox.getAndSetContext(_services.inboxSystem());
        }
        
        //return serviceImpl(beanFactory, address, config);
        ServiceRefAmp serviceRef = serviceImpl(stubFactory);
        
        String address = stubFactory.address();
        
        if (address != null) {
          _services.bind(serviceRef, address);
        }
        
        if (serviceRef.stub().isAutoStart()
            || stubFactory.config().isAutoStart()) {
          _services.addAutoStart(serviceRef);
        }
        
        return serviceRef;
      } finally {
        thread.setContextClassLoader(oldLoader);
        
        if (outbox != null) {
          outbox.getAndSetContext(oldContext);
        }
      }
    }
docs: Main service builder. Called from ServiceBuilder and ServiceRefBean.