Merge branch 'jetty-11.0.x' into jetty-12.0.x

This commit is contained in:
Olivier Lamy 2022-09-22 10:09:06 +10:00
commit 45ca33676d
2 changed files with 77 additions and 7 deletions

View File

@ -59,6 +59,10 @@ public class HazelcastSessionDataStoreFactory
private String addresses;
private ClientConfig clientConfig;
private Config serverConfig;
public boolean isUseQueries()
{
return useQueries;
@ -84,7 +88,14 @@ public class HazelcastSessionDataStoreFactory
ClientConfig config;
if (StringUtil.isEmpty(configurationLocation))
{
config = new ClientConfig();
if (clientConfig == null)
{
config = new ClientConfig();
}
else
{
config = clientConfig;
}
if (addresses != null && !addresses.isEmpty())
{
@ -98,7 +109,15 @@ public class HazelcastSessionDataStoreFactory
}
else
{
config = new XmlClientConfigBuilder(configurationLocation).build();
if (clientConfig == null)
{
config = new XmlClientConfigBuilder(configurationLocation).build();
}
else
{
LOG.warn("Both configurationLocation and clientConfig are set, using clientConfig");
config = clientConfig;
}
if (config.getSerializationConfig().getSerializerConfigs().stream().noneMatch(s ->
SessionData.class.getName().equals(s.getTypeClassName()) && s.getImplementation() instanceof SessionDataSerializer))
LOG.warn("Hazelcast xml config is missing org.eclipse.jetty.hazelcast.session.SessionDataSerializer - sessions may not serialize correctly");
@ -114,7 +133,14 @@ public class HazelcastSessionDataStoreFactory
SerializerConfig sc = new SerializerConfig()
.setImplementation(new SessionDataSerializer())
.setTypeClass(SessionData.class);
config = new Config();
if (serverConfig == null)
{
config = new Config();
}
else
{
config = serverConfig;
}
config.getSerializationConfig().addSerializerConfig(sc);
// configure a default Map if null
if (mapConfig == null)
@ -131,7 +157,15 @@ public class HazelcastSessionDataStoreFactory
}
else
{
config = new XmlConfigBuilder(configurationLocation).build();
if (serverConfig == null)
{
config = new XmlConfigBuilder(configurationLocation).build();
}
else
{
LOG.warn("Both configurationLocation and serverConfig are set, using serverConfig");
config = serverConfig;
}
if (config.getSerializationConfig().getSerializerConfigs().stream().noneMatch(s ->
SessionData.class.getName().equals(s.getTypeClassName()) && s.getImplementation() instanceof SessionDataSerializer))
LOG.warn("Hazelcast xml config is missing org.eclipse.jetty.hazelcast.session.SessionDataSerializer - sessions may not serialize correctly");
@ -160,7 +194,7 @@ public class HazelcastSessionDataStoreFactory
/**
* @param onlyClient if <code>true</code> the session manager will only connect to an external Hazelcast instance
* and not use this JVM to start an Hazelcast instance
* and not use this JVM to start a Hazelcast instance
*/
public void setOnlyClient(boolean onlyClient)
{
@ -172,6 +206,12 @@ public class HazelcastSessionDataStoreFactory
return configurationLocation;
}
/**
* @param configurationLocation the location of the XML Hazelcast configuration file to load.
* Depending on whether {@link #setOnlyClient(boolean)} is set to {@code true}
* or not, this will be used to configure either a Hazelcast client or a Hazelcast server.
* This parameter is mutually exclusive with {@link #setClientConfig(ClientConfig)} and {@link #setServerConfig(Config)}.
*/
public void setConfigurationLocation(String configurationLocation)
{
this.configurationLocation = configurationLocation;
@ -226,4 +266,34 @@ public class HazelcastSessionDataStoreFactory
{
this.addresses = addresses;
}
public ClientConfig getClientConfig()
{
return clientConfig;
}
/**
* @param clientConfig the client configuration to use to connect to Hazelcast.
* Only used if {@link #setOnlyClient(boolean)} is set to {@code true}.
* Overrides any configuration set via {@link #setConfigurationLocation(String)}
*/
public void setClientConfig(ClientConfig clientConfig)
{
this.clientConfig = clientConfig;
}
public Config getServerConfig()
{
return serverConfig;
}
/**
* @param serverConfig the server configuration to use to configure the embedded Hazelcast cluster.
* Only used if {@link #setOnlyClient(boolean)} is set to {@code false}.
* Overrides any configuration set via {@link #setConfigurationLocation(String)}
*/
public void setServerConfig(Config serverConfig)
{
this.serverConfig = serverConfig;
}
}

View File

@ -73,7 +73,7 @@
<junit.version>5.9.0</junit.version>
<kerb-simplekdc.version>2.0.2</kerb-simplekdc.version>
<log4j2.version>2.19.0</log4j2.version>
<logback.version>1.4.0</logback.version>
<logback.version>1.4.1</logback.version>
<mariadb.version>3.0.7</mariadb.version>
<mariadb.docker.version>10.3.6</mariadb.docker.version>
<maven.deps.version>3.8.4</maven.deps.version>
@ -88,7 +88,7 @@
<org.osgi.util.promise.version>1.2.0</org.osgi.util.promise.version>
<plexus-component-annotations.version>2.1.1</plexus-component-annotations.version>
<plexus-utils.version>3.4.2</plexus-utils.version>
<slf4j.version>2.0.1</slf4j.version>
<slf4j.version>2.0.2</slf4j.version>
<springboot.version>2.1.1.RELEASE</springboot.version>
<testcontainers.version>1.17.3</testcontainers.version>
<weld.version>4.0.3.Final</weld.version>