Exemplo n.º 1
0
 private void writeTransport(
     XMLExtendedStreamWriter writer, GlobalConfiguration globalConfiguration)
     throws XMLStreamException {
   TransportConfiguration transport = globalConfiguration.transport();
   AttributeSet attributes = transport.attributes();
   if (attributes.isModified()) {
     writer.writeStartElement(Element.TRANSPORT);
     attributes.write(writer, TransportConfiguration.CLUSTER_NAME, Attribute.CLUSTER);
     attributes.write(writer, TransportConfiguration.MACHINE_ID, Attribute.MACHINE_ID);
     attributes.write(writer, TransportConfiguration.RACK_ID, Attribute.RACK_ID);
     if (transport.siteId() != null) {
       attributes.write(writer, TransportConfiguration.SITE_ID, Attribute.SITE);
     } else if (globalConfiguration.sites().localSite() != null) {
       writer.writeAttribute(Attribute.SITE, globalConfiguration.sites().localSite());
     }
     attributes.write(writer, TransportConfiguration.NODE_NAME, Attribute.NODE_NAME);
     TypedProperties properties = globalConfiguration.transport().properties();
     if (properties.containsKey("stack")) {
       writer.writeAttribute(Attribute.STACK, properties.getProperty("stack"));
     }
     if (transport.remoteCommandThreadPool().threadPoolFactory() != null) {
       writer.writeAttribute(Attribute.REMOTE_COMMAND_EXECUTOR, "remote-command-pool");
     }
     if (transport.transportThreadPool().threadPoolFactory() != null) {
       writer.writeAttribute(Attribute.EXECUTOR, "transport-pool");
     }
     writer.writeEndElement();
   }
 }
Exemplo n.º 2
0
 private void writeJGroups(XMLExtendedStreamWriter writer, GlobalConfiguration globalConfiguration)
     throws XMLStreamException {
   if (globalConfiguration.isClustered()) {
     writer.writeStartElement(Element.JGROUPS);
     writer.writeAttribute(
         Attribute.TRANSPORT, globalConfiguration.transport().transport().getClass().getName());
     TypedProperties properties = globalConfiguration.transport().properties();
     for (String property : properties.stringPropertyNames()) {
       if (property.startsWith("stack-")) {
         String stackName = properties.getProperty(property);
         String path = properties.getProperty("stackFilePath-" + stackName);
         writer.writeStartElement(Element.STACK_FILE);
         writer.writeAttribute(Attribute.NAME, stackName);
         writer.writeAttribute(Attribute.PATH, path);
         writer.writeEndElement();
       }
     }
     writer.writeEndElement();
   }
 }