public GlobalConfiguration build() {
   return new GlobalConfiguration(
       asyncListenerExecutor.create(),
       asyncTransportExecutor.create(),
       evictionScheduledExecutor.create(),
       replicationQueueScheduledExecutor.create(),
       globalJmxStatistics.create(),
       transport.create(),
       serialization.create(),
       shutdown.create(),
       cl);
 }
  public GlobalConfigurationBuilder read(GlobalConfiguration template) {
    this.cl = template.classLoader();

    asyncListenerExecutor.read(template.asyncListenerExecutor());
    asyncTransportExecutor.read(template.asyncTransportExecutor());
    evictionScheduledExecutor.read(template.evictionScheduledExecutor());
    globalJmxStatistics.read(template.globalJmxStatistics());
    replicationQueueScheduledExecutor.read(template.replicationQueueScheduledExecutor());
    serialization.read(template.serialization());
    shutdown.read(template.shutdown());
    transport.read(template.transport());

    return this;
  }
 @Override
 public GlobalConfiguration build() {
   validate();
   List<Object> modulesConfig = new LinkedList<Object>();
   for (Builder<?> module : modules) modulesConfig.add(module.create());
   return new GlobalConfiguration(
       asyncListenerExecutor.create(),
       asyncTransportExecutor.create(),
       remoteCommandsExecutor.create(),
       evictionScheduledExecutor.create(),
       replicationQueueScheduledExecutor.create(),
       globalJmxStatistics.create(),
       transport.create(),
       serialization.create(),
       shutdown.create(),
       modulesConfig,
       site.create(),
       cl.get(),
       totalOrderExecutor.create());
 }
 @Override
 public int hashCode() {
   int result = cl != null ? cl.hashCode() : 0;
   result = 31 * result + (transport != null ? transport.hashCode() : 0);
   result = 31 * result + (globalJmxStatistics != null ? globalJmxStatistics.hashCode() : 0);
   result = 31 * result + (serialization != null ? serialization.hashCode() : 0);
   result = 31 * result + (asyncTransportExecutor != null ? asyncTransportExecutor.hashCode() : 0);
   result = 31 * result + (asyncListenerExecutor != null ? asyncListenerExecutor.hashCode() : 0);
   result = 31 * result + (remoteCommandsExecutor != null ? remoteCommandsExecutor.hashCode() : 0);
   result =
       31 * result
           + (evictionScheduledExecutor != null ? evictionScheduledExecutor.hashCode() : 0);
   result =
       31 * result
           + (replicationQueueScheduledExecutor != null
               ? replicationQueueScheduledExecutor.hashCode()
               : 0);
   result = 31 * result + (shutdown != null ? shutdown.hashCode() : 0);
   result = 31 * result + (site != null ? site.hashCode() : 0);
   result = 31 * result + (totalOrderExecutor != null ? totalOrderExecutor().hashCode() : 0);
   return result;
 }
  public GlobalConfigurationBuilder read(GlobalConfiguration template) {
    this.cl = new WeakReference<ClassLoader>(template.classLoader());

    for (Object c : template.modules().values()) {
      BuiltBy builtBy = c.getClass().getAnnotation(BuiltBy.class);
      Builder<Object> builder = (Builder<Object>) this.addModule(builtBy.value());
      builder.read(c);
    }

    asyncListenerExecutor.read(template.asyncListenerExecutor());
    asyncTransportExecutor.read(template.asyncTransportExecutor());
    remoteCommandsExecutor.read(template.remoteCommandsExecutor());
    evictionScheduledExecutor.read(template.evictionScheduledExecutor());
    globalJmxStatistics.read(template.globalJmxStatistics());
    replicationQueueScheduledExecutor.read(template.replicationQueueScheduledExecutor());
    serialization.read(template.serialization());
    shutdown.read(template.shutdown());
    transport.read(template.transport());
    site.read(template.sites());
    totalOrderExecutor.read(template.totalOrderExecutor());
    return this;
  }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    GlobalConfigurationBuilder that = (GlobalConfigurationBuilder) o;

    if (asyncListenerExecutor != null
        ? !asyncListenerExecutor.equals(that.asyncListenerExecutor)
        : that.asyncListenerExecutor != null) return false;
    if (asyncTransportExecutor != null
        ? !asyncTransportExecutor.equals(that.asyncTransportExecutor)
        : that.asyncTransportExecutor != null) return false;
    if (remoteCommandsExecutor != null
        ? !remoteCommandsExecutor.equals(that.remoteCommandsExecutor)
        : that.remoteCommandsExecutor != null) return false;
    if (cl != null ? !cl.equals(that.cl) : that.cl != null) return false;
    if (evictionScheduledExecutor != null
        ? !evictionScheduledExecutor.equals(that.evictionScheduledExecutor)
        : that.evictionScheduledExecutor != null) return false;
    if (globalJmxStatistics != null
        ? !globalJmxStatistics.equals(that.globalJmxStatistics)
        : that.globalJmxStatistics != null) return false;
    if (replicationQueueScheduledExecutor != null
        ? !replicationQueueScheduledExecutor.equals(that.replicationQueueScheduledExecutor)
        : that.replicationQueueScheduledExecutor != null) return false;
    if (serialization != null
        ? !serialization.equals(that.serialization)
        : that.serialization != null) return false;
    if (shutdown != null ? !shutdown.equals(that.shutdown) : that.shutdown != null) return false;
    if (site != null ? !site.equals(that.site) : that.site != null) return false;
    if (transport != null ? !transport.equals(that.transport) : that.transport != null)
      return false;

    return !(totalOrderExecutor != null
        ? !totalOrderExecutor.equals(that.totalOrderExecutor())
        : that.totalOrderExecutor != null);
  }