Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
a8b0744a
Commit
a8b0744a
authored
Aug 02, 2016
by
Matija Obreza
Browse files
Hazelcast configuration: interfaces and public address
parent
5815417d
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/spring/config/HazelcastConfig.java
View file @
a8b0744a
...
...
@@ -34,8 +34,19 @@ import com.hazelcast.spring.context.SpringManagedContext;
@EnableCaching
@Import
({
HazelcastConfigDev
.
class
,
HazelcastConfigAWS
.
class
})
public
abstract
class
HazelcastConfig
{
/// Interfaces on which HZ should bind
@Value
(
"${hazelcast.interfaces}"
)
protected
String
hazelInterfaces
;
/// TCP port to listen on
@Value
(
"${hazelcast.port}"
)
protected
int
hazelPort
;
/// The public address (in case of NAT)
@Value
(
"${hazelcast.publicAddress}"
)
protected
String
hazelPublicAddress
;
@Value
(
"${hazelcast.instanceName}"
)
protected
String
instanceName
;
@Value
(
"${hazelcast.password}"
)
...
...
src/main/java/org/genesys2/spring/config/HazelcastConfigAWS.java
View file @
a8b0744a
...
...
@@ -16,6 +16,7 @@
package
org.genesys2.spring.config
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -67,6 +68,18 @@ public class HazelcastConfigAWS extends HazelcastConfig {
network
.
setPort
(
hazelPort
);
network
.
setPortAutoIncrement
(
false
);
if
(
StringUtils
.
isNotBlank
(
hazelPublicAddress
))
{
System
.
out
.
println
(
"Hazelcast: Using public address "
+
hazelPublicAddress
);
network
.
setPublicAddress
(
hazelPublicAddress
);
}
if
(
StringUtils
.
isNotBlank
(
hazelInterfaces
))
{
for
(
String
hazelInterface
:
hazelInterfaces
.
split
(
","
))
{
System
.
out
.
println
(
"Hazelcast: Adding single interface "
+
hazelInterface
);
network
.
getInterfaces
().
addInterface
(
hazelInterface
);
}
}
JoinConfig
join
=
network
.
getJoin
();
join
.
getMulticastConfig
().
setEnabled
(
false
);
...
...
@@ -80,15 +93,15 @@ public class HazelcastConfigAWS extends HazelcastConfig {
MapConfig
defaultMapConfig
=
new
MapConfig
();
defaultMapConfig
.
setName
(
"default"
);
//
defaultMapConfig.setTimeToLiveSeconds(0);
//
defaultMapConfig.setTimeToLiveSeconds(0);
defaultMapConfig
.
setEvictionPolicy
(
EvictionPolicy
.
LFU
);
//
defaultMapConfig.setMaxIdleSeconds();
//
defaultMapConfig.setMaxIdleSeconds();
MaxSizeConfig
defaultMaxSizeConfig
=
new
MaxSizeConfig
();
defaultMaxSizeConfig
.
setSize
(
defaultCacheSize
);
defaultMaxSizeConfig
.
setMaxSizePolicy
(
MaxSizePolicy
.
PER_NODE
);
defaultMapConfig
.
setMaxSizeConfig
(
defaultMaxSizeConfig
);
cfg
.
addMapConfig
(
defaultMapConfig
);
MapConfig
tileserverMapConfig
=
new
MapConfig
();
tileserverMapConfig
.
setName
(
"tileserver"
);
tileserverMapConfig
.
setTimeToLiveSeconds
(
tileserverTTL
);
...
...
src/main/resources/spring/spring.properties
View file @
a8b0744a
...
...
@@ -111,6 +111,9 @@ hazelcast.instanceName=hz-genesys-instance1
# Hazelcast cluster configuration
hazelcast.name
=
hz-genesys-development
hazelcast.password
=
hazelcastdevelopment
# Binding and public address
hazelcast.publicAddress
=
hazelcast.interfaces
=
hazelcast.port
=
5701
# AWS Autodetection
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment