private void writeCacheContainer(XMLExtendedStreamWriter writer, ConfigurationHolder holder) throws XMLStreamException { writer.writeStartElement(Element.CACHE_CONTAINER); GlobalConfiguration globalConfiguration = holder.getGlobalConfiguration(); writer.writeAttribute( Attribute.NAME, globalConfiguration.globalJmxStatistics().cacheManagerName()); if (globalConfiguration.shutdown().hookBehavior() != ShutdownHookBehavior.DEFAULT) { writer.writeAttribute( Attribute.SHUTDOWN_HOOK, globalConfiguration.shutdown().hookBehavior().name()); } globalConfiguration .globalJmxStatistics() .attributes() .write(writer, GlobalJmxStatisticsConfiguration.ENABLED, Attribute.STATISTICS); if (globalConfiguration.asyncThreadPool().threadPoolFactory() != null) { writer.writeAttribute(Attribute.ASYNC_EXECUTOR, "async-pool"); } if (globalConfiguration.expirationThreadPool().threadPoolFactory() != null) { writer.writeAttribute(Attribute.EXPIRATION_EXECUTOR, "expiration-pool"); } if (globalConfiguration.listenerThreadPool().threadPoolFactory() != null) { writer.writeAttribute(Attribute.LISTENER_EXECUTOR, "listener-pool"); } if (globalConfiguration.persistenceThreadPool().threadPoolFactory() != null) { writer.writeAttribute(Attribute.PERSISTENCE_EXECUTOR, "persistence-pool"); } if (globalConfiguration.stateTransferThreadPool().threadPoolFactory() != null) { writer.writeAttribute(Attribute.STATE_TRANSFER_EXECUTOR, "state-transfer-pool"); } writeTransport(writer, globalConfiguration); writeSerialization(writer, globalConfiguration); writeJMX(writer, globalConfiguration); for (Entry<String, Configuration> configuration : holder.getConfigurations().entrySet()) { Configuration config = configuration.getValue(); switch (config.clustering().cacheMode()) { case LOCAL: writeLocalCache(writer, configuration.getKey(), config); break; case DIST_ASYNC: case DIST_SYNC: writeDistributedCache(writer, configuration.getKey(), config); break; case INVALIDATION_ASYNC: case INVALIDATION_SYNC: writeInvalidationCache(writer, configuration.getKey(), config); break; case REPL_ASYNC: case REPL_SYNC: writeReplicatedCache(writer, configuration.getKey(), config); break; default: break; } } }
private void writeThreads(XMLExtendedStreamWriter writer, GlobalConfiguration globalConfiguration) throws XMLStreamException { writer.writeStartElement(Element.THREADS); ConcurrentMap<String, DefaultThreadFactory> threadFactories = CollectionFactory.makeConcurrentMap(); for (ThreadPoolConfiguration threadPoolConfiguration : Arrays.asList( globalConfiguration.expirationThreadPool(), globalConfiguration.listenerThreadPool(), globalConfiguration.persistenceThreadPool(), globalConfiguration.replicationQueueThreadPool(), globalConfiguration.stateTransferThreadPool(), globalConfiguration.transport().remoteCommandThreadPool(), globalConfiguration.transport().transportThreadPool())) { ThreadFactory threadFactory = threadPoolConfiguration.threadFactory(); if (threadFactory instanceof DefaultThreadFactory) { DefaultThreadFactory tf = (DefaultThreadFactory) threadFactory; threadFactories.putIfAbsent(tf.getName(), tf); } } for (DefaultThreadFactory threadFactory : threadFactories.values()) { writeThreadFactory(writer, threadFactory); } writeThreadPool(writer, "async-pool", globalConfiguration.asyncThreadPool()); writeThreadPool(writer, "expiration-pool", globalConfiguration.expirationThreadPool()); writeThreadPool(writer, "listener-pool", globalConfiguration.listenerThreadPool()); writeThreadPool(writer, "persistence-pool", globalConfiguration.persistenceThreadPool()); writeThreadPool( writer, "replication-queue-pool", globalConfiguration.replicationQueueThreadPool()); writeThreadPool(writer, "state-transfer-pool", globalConfiguration.stateTransferThreadPool()); writeThreadPool( writer, "remote-command-pool", globalConfiguration.transport().remoteCommandThreadPool()); writeThreadPool( writer, "transport-pool", globalConfiguration.transport().transportThreadPool()); writer.writeEndElement(); }