Issue #4647 Hazelcast remote.xml configuration file do not configure hazelcast remote addresses (#4649)
* Fix for #4647 Signed-off-by: Mattias Andersson <andermaj@gmail.com> Co-authored-by: Mattias Andersson <andermaj@gmail.com>
This commit is contained in:
parent
67eb9b3531
commit
82247f257d
|
@ -4,7 +4,7 @@
|
|||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Configure a factory for HazelcastSessionDataStore using -->
|
||||
<!-- an embedded Hazelcast Instance -->
|
||||
<!-- an remote Hazelcast Instance -->
|
||||
<!-- ===================================================================== -->
|
||||
<Call name="addBean">
|
||||
<Arg>
|
||||
|
@ -15,6 +15,7 @@
|
|||
<Set name="gracePeriodSec"><Property name="jetty.session.gracePeriod.seconds" default="3600" /></Set>
|
||||
<Set name="savePeriodSec"><Property name="jetty.session.savePeriod.seconds" default="0" /></Set>
|
||||
<Set name="onlyClient"><Property name="jetty.session.hazelcast.onlyClient" default="true" /></Set>
|
||||
<Set name="addresses"><Property name="jetty.session.hazelcast.addresses" default="" /></Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
|
|
@ -31,7 +31,6 @@ http://www.apache.org/licenses/LICENSE-2.0.html
|
|||
[ini-template]
|
||||
jetty.session.hazelcast.mapName=jetty-distributed-session-map
|
||||
jetty.session.hazelcast.hazelcastInstanceName=JETTY_DISTRIBUTED_SESSION_INSTANCE
|
||||
#jetty.session.hazelcast.configurationLocation=
|
||||
jetty.session.hazelcast.scavengeZombies=false
|
||||
jetty.session.gracePeriod.seconds=3600
|
||||
jetty.session.savePeriod.seconds=0
|
||||
|
|
|
@ -34,6 +34,6 @@ jetty.session.hazelcast.mapName=jetty-distributed-session-map
|
|||
jetty.session.hazelcast.hazelcastInstanceName=JETTY_DISTRIBUTED_SESSION_INSTANCE
|
||||
jetty.session.hazelcast.onlyClient=true
|
||||
jetty.session.hazelcast.scavengeZombies=false
|
||||
#jetty.session.hazelcast.configurationLocation=
|
||||
jetty.session.gracePeriod.seconds=3600
|
||||
jetty.session.savePeriod.seconds=0
|
||||
#jetty.session.hazelcast.addresses=
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.hazelcast.session;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.hazelcast.client.HazelcastClient;
|
||||
import com.hazelcast.client.config.ClientConfig;
|
||||
|
@ -29,6 +30,7 @@ import com.hazelcast.config.SerializerConfig;
|
|||
import com.hazelcast.config.XmlConfigBuilder;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
|
||||
import org.eclipse.jetty.server.session.AbstractSessionDataStoreFactory;
|
||||
import org.eclipse.jetty.server.session.SessionData;
|
||||
import org.eclipse.jetty.server.session.SessionDataStore;
|
||||
|
@ -57,6 +59,8 @@ public class HazelcastSessionDataStoreFactory
|
|||
|
||||
private boolean scavengeZombies = false;
|
||||
|
||||
private String addresses;
|
||||
|
||||
public boolean isScavengeZombies()
|
||||
{
|
||||
return scavengeZombies;
|
||||
|
@ -81,6 +85,12 @@ public class HazelcastSessionDataStoreFactory
|
|||
if (configurationLocation == null)
|
||||
{
|
||||
ClientConfig config = new ClientConfig();
|
||||
|
||||
if (addresses != null && !addresses.isEmpty())
|
||||
{
|
||||
config.getNetworkConfig().setAddresses(Arrays.asList(addresses.split(",")));
|
||||
}
|
||||
|
||||
SerializerConfig sc = new SerializerConfig()
|
||||
.setImplementation(new SessionDataSerializer())
|
||||
.setTypeClass(SessionData.class);
|
||||
|
@ -201,4 +211,14 @@ public class HazelcastSessionDataStoreFactory
|
|||
{
|
||||
this.hazelcastInstanceName = hazelcastInstanceName;
|
||||
}
|
||||
|
||||
public String getAddresses()
|
||||
{
|
||||
return addresses;
|
||||
}
|
||||
|
||||
public void setAddresses(String addresses)
|
||||
{
|
||||
this.addresses = addresses;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue