Commit 15bb2fa5 authored by Matija Obreza's avatar Matija Obreza
Browse files

Use hazelcast as Hibernate4 2nd level cache

parent 8bb9a4c2
...@@ -473,6 +473,11 @@ ...@@ -473,6 +473,11 @@
<artifactId>hazelcast-wm</artifactId> <artifactId>hazelcast-wm</artifactId>
<version>3.1.5</version> <version>3.1.5</version>
</dependency> </dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-hibernate4</artifactId>
<version>3.1.5</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -16,12 +16,8 @@ ...@@ -16,12 +16,8 @@
package org.genesys2.server.servlet.controller; package org.genesys2.server.servlet.controller;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.genesys2.server.model.Permissions;
import org.genesys2.server.model.UserRole; import org.genesys2.server.model.UserRole;
import org.genesys2.server.model.impl.User; import org.genesys2.server.model.impl.User;
import org.genesys2.server.security.lockout.AccountLockoutManager; import org.genesys2.server.security.lockout.AccountLockoutManager;
...@@ -88,9 +84,6 @@ public class HtmlController extends BaseController { ...@@ -88,9 +84,6 @@ public class HtmlController extends BaseController {
@RequestMapping(value = "welcome") @RequestMapping(value = "welcome")
public String welcome(ModelMap model) { public String welcome(ModelMap model) {
List<Permissions> permissionsList = Arrays.asList(Permissions.values());
model.addAttribute("permissionsList", permissionsList);
// FIXME get user locale!
model.addAttribute("cropList", cropService.list(getLocale())); model.addAttribute("cropList", cropService.list(getLocale()));
model.addAttribute("lastNews", contentService.lastNews()); model.addAttribute("lastNews", contentService.lastNews());
model.addAttribute("welcomeBlurp", contentService.getGlobalArticle("welcome", getLocale())); model.addAttribute("welcomeBlurp", contentService.getGlobalArticle("welcome", getLocale()));
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
</constructor-arg> </constructor-arg>
</bean> </bean>
<beans profile="aws"> <beans profile="aws">
<hz:hazelcast id="theHazelcast"> <hz:hazelcast id="theHazelcast">
<hz:config> <hz:config>
...@@ -85,10 +84,38 @@ ...@@ -85,10 +84,38 @@
</bean> </bean>
</beans> </beans>
<beans profile="cacher">
<hz:hazelcast id="theHazelcast">
<hz:config>
<hz:instance-name>genesys</hz:instance-name>
<hz:group name="${hazelcast.name}" password="${hazelcast.password}" />
<hz:properties>
<hz:property name="hazelcast.merge.first.run.delay.seconds">5</hz:property>
<hz:property name="hazelcast.merge.next.run.delay.seconds">5</hz:property>
<hz:property name="hazelcast.logging.type">log4j</hz:property>
</hz:properties>
<hz:network port="${hazelcast.port}">
<hz:join>
<hz:multicast enabled="false" />
<hz:tcp-ip enabled="true">
<hz:required-member>127.0.0.1:5702</hz:required-member>
</hz:tcp-ip>
</hz:join>
</hz:network>
<hz:map name="default" max-idle-seconds="300" max-size="1000"
time-to-live-seconds="0" eviction-policy="LRU" />
</hz:config>
</hz:hazelcast>
<bean id="hzCacheManager" class="com.hazelcast.spring.cache.HazelcastCacheManager">
<constructor-arg ref="theHazelcast" />
</bean>
</beans>
<beans profile="dev"> <beans profile="dev">
<hz:hazelcast id="theHazelcast"> <hz:hazelcast id="theHazelcast">
<hz:config> <hz:config>
<hz:instance-name>genesys</hz:instance-name>
<hz:group name="${hazelcast.name}" password="${hazelcast.password}" /> <hz:group name="${hazelcast.name}" password="${hazelcast.password}" />
<hz:properties> <hz:properties>
<hz:property name="hazelcast.merge.first.run.delay.seconds">5</hz:property> <hz:property name="hazelcast.merge.first.run.delay.seconds">5</hz:property>
......
...@@ -57,6 +57,11 @@ ...@@ -57,6 +57,11 @@
<prop key="hibernate.search.default.indexBase">${lucene.indexDir}</prop> <prop key="hibernate.search.default.indexBase">${lucene.indexDir}</prop>
<prop key="hibernate.search.default.exclusive_index_use">false</prop> <prop key="hibernate.search.default.exclusive_index_use">false</prop>
<prop key="hibernate.search.default.​worker.execution">async</prop> <prop key="hibernate.search.default.​worker.execution">async</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_minimal_puts">true</prop>
<prop key="hibernate.cache.region.factory_class">com.hazelcast.hibernate.HazelcastLocalCacheRegionFactory</prop>
<prop key="hibernate.cache.hazelcast.instance_name">genesys</prop>
</props> </props>
</property> </property>
<property name="packagesToScan"> <property name="packagesToScan">
......
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