Commit 611a9a90 authored by Matija Obreza's avatar Matija Obreza

Upgraded springframework and hazelcast (session creation was forced by spring)

parent bd39b807
......@@ -71,7 +71,7 @@
<servlet-api.version>2.5</servlet-api.version>
<jsp-api.version>2.1</jsp-api.version>
<spring.framework.version>4.2.5.RELEASE</spring.framework.version>
<spring.framework.version>4.3.8.RELEASE</spring.framework.version>
<spring.data.release-train>Hopper-SR1</spring.data.release-train>
<spring.security.version>4.0.4.RELEASE</spring.security.version>
<spring.security.oauth2.version>1.0.5.RELEASE</spring.security.oauth2.version>
......@@ -88,10 +88,10 @@
<aspectj.version>1.7.2</aspectj.version>
<mysql.version>5.1.31</mysql.version>
<hazelcast.version>3.6.6</hazelcast.version>
<hazelcast.version>3.8.1</hazelcast.version>
<oval.version>1.81</oval.version>
<jackson.version>2.2.1</jackson.version>
<jackson.version>2.6.4</jackson.version>
<jaxb-api.version>2.2.12</jaxb-api.version>
<!--Container -->
......@@ -373,11 +373,6 @@
<artifactId>hazelcast-spring</artifactId>
<version>${hazelcast.version}</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-cloud</artifactId>
<version>${hazelcast.version}</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-hibernate4</artifactId>
......
......@@ -40,7 +40,7 @@ import org.springframework.context.annotation.Import;
@Configuration
@EnableCaching
@Import({ HazelcastConfigAWS.class, HazelcastConfigCacher.class })
@Import({ HazelcastConfigCacher.class })
public abstract class HazelcastConfig {
protected final Logger LOG = LoggerFactory.getLogger(HazelcastConfig.class);
......
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.genesys2.spring.config;
import com.hazelcast.config.AwsConfig;
import com.hazelcast.config.Config;
import com.hazelcast.config.GroupConfig;
import com.hazelcast.config.JoinConfig;
import com.hazelcast.config.NetworkConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.ManagedContext;
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;
import org.springframework.context.annotation.Profile;
@Configuration
@Profile("aws")
public class HazelcastConfigAWS extends HazelcastConfig {
@Value("${hazelcast.aws.region}")
private String region;
@Value("${hazelcast.aws.access-key}")
private String accessKey;
@Value("${hazelcast.aws.secret-key}")
private String secretKey;
@Value("${hazelcast.aws.security-group}")
private String securityGroupName;
@Bean
public HazelcastInstance hazelcast(ManagedContext managedContext) {
Config cfg = new Config();
cfg.setManagedContext(managedContext);
cfg.setInstanceName(instanceName);
GroupConfig groupConfig = cfg.getGroupConfig();
groupConfig.setName(name);
groupConfig.setPassword(password);
cfg.setProperty("hazelcast.merge.first.run.delay.seconds", "5");
cfg.setProperty("hazelcast.merge.next.run.delay.seconds", "5");
cfg.setProperty("hazelcast.logging.type", "log4j");
cfg.setProperty("hazelcast.icmp.enabled", "true");
NetworkConfig network = cfg.getNetworkConfig();
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);
AwsConfig awsConfig = join.getAwsConfig();
awsConfig.setEnabled(true);
awsConfig.setRegion(region);
awsConfig.setAccessKey(accessKey);
awsConfig.setSecretKey(secretKey);
awsConfig.setConnectionTimeoutSeconds(20);
awsConfig.setSecurityGroupName(securityGroupName);
configureHazelcast(cfg);
HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);
return instance;
}
}
......@@ -99,13 +99,14 @@ public class SpringCacheConfig {
final Properties properties = new Properties();
properties.setProperty("use-client", "false");
properties.setProperty("map-name", "jetty-sessions");
properties.setProperty("session-ttl-seconds", "21600");
// Not allowed in HZ-3.8.1
// properties.setProperty("session-ttl-seconds", "21600");
properties.setProperty("sticky-session", "false");
properties.setProperty("cookie-name", "hz-session-id");
properties.setProperty("cookie-domain", cookieDomain);
properties.setProperty("cookie-secure", cookieSecure);
properties.setProperty("cookie-http-only", cookieHttpOnly);
properties.setProperty("debug", "true");
// properties.setProperty("debug", "true");
properties.setProperty("instance-name", instanceName);
properties.setProperty("shutdown-on-destroy", "true");
return properties;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment