Author |
Message |
|
I have a distributed ehcahe application.
Objects are stored in the ehcache and on removal of the objects from the cache, they are written to the database.
I have implemented the CacheWriter interface to do the same. The code to write to database is written in
I have certain questions?
1) Can it so happen that objects are removed from cache but are yet to be written to database ? Is there is a time window between the two actions ?
That is, can there be a situation when the objects are neither in cache or in database.
2) If somehow the database crashed or the link to the database is broken, will the objects from the cache be removed, even after the command is given to remove from cache ?
|
|
|
Is it possible to provide hostname instead of ip-address in tc-config.xml ?
<tc-config xmlns="http://www.terracotta.org/config">
<server bind="hostname1" host="hostname1" name="node1">
<dso-port bind="hostname1">9510</dso-port>
<jmx-port bind="hostname1">9520</jmx-port>
<l2-group-port bind="hostname1">9530</l2-group-port>
</server>
</tc-config>
|
|
|
I have an application which uses distributed ehcache with a write-behind policy.
The deployment architecture contains two terracotta servers in cluster, two tomcat servers and a single MySql database server.
My question is, if the MySql server goes down or communication with MySql server is broken, how the application is going to be affected? Will the application be still in running state ?
Moreover, when the MySql server is restarted, will the communication be re-established and all the data that were not written to the database will get committed ?
|
|
|
Can I give hostname of a machine in <terracottaConfig> tag instead of ip-address ?
Code:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" >
<terracottaConfig url="hostname1:9510, hostname2:9510" />
<!-- <terracottaConfig url="10.0.0.1:9510, 10.0.0.2:9510" /> -->
<defaultCache
maxElementsInMemory="100000"
eternal="false"
timeToIdleSeconds="1000"
timeToLiveSeconds="1000"
overflowToDisk="false"
statistics="true">
<terracotta />
</defaultCache>
</ehcache>
|
|
|
My question is very simple !!
Do I need to configure tc-config.xml so that it contains root and instrumented classes if I already have a distributed ehcache in place ?
|
|
|
How to set up two terracotta servers in active-active mode using open source terracotta.
I have implemented the same using networked-active-passive mode as shown below.
Code:
<servers secure="false" xmlns:tc="http://www.terracotta.org/config" xmlns:con="http://www.terracotta.org/config" xmlns="">
<server bind="0.0.0.0" host="127.0.0.1" name="node1">
....
</server>
<server bind="0.0.0.0" host="127.0.0.1" name="node2">
....
</server>
<mirror-groups>
<mirror-group>
<members>
<member>node1</member>
<member>node2</member>
</members>
</mirror-group>
</mirror-groups>
<ha>
<mode>networked-active-passive</mode>
<networked-active-passive>
<election-time>5</election-time>
</networked-active-passive>
</ha>
<update-check>
<enabled>true</enabled>
<period-days>7</period-days>
</update-check>
</servers>
How can this be modified for active-active configuration ?
|
|
|
I have created an application which uses distributed ehcache.
There is a custom session class named UserItemSession. This class contains all sorts of other objects (like Long, String, List<>, Map<>) to store details pertaining to each logged in user.
Code:
public class UserItemSession implements Serializable{
String userName;
Map<Long, List<Long>> availableItems;
List<Long> itemsChosen;
Map<Long, List<Item>> availableItemObjects;
List<Item> itemObjectsChosen;
//.....getters and setters.......
}
That is, for every user I create a new object of type UserItemSession and populate them with details specific to each user.
These, I put in a "userItemSessionCache" configured in ehcache.xml.
Code:
public class UserItemSessionServiceImpl implements IUserItemSessionService{
Ehcache userItemSessionCache;
@Override
public boolean addItemToUserList(String userName, Long itemSectionId, Long itemId) {
UserItemSession uiSession = getUserItemSesion(userName);
List<Item> availableItemObjects = uiSession.getAvailableItemObjects().get(itemSectionId);
List<Long> availableItems = uiSession.getAvailableItems().get(itemSectionId);
System.out.println("List of items available under section "+itemSectionId.toString()+ " are");
Iterator<Long> itr = availableItems.iterator();
while(itr.hasNext()){
System.out.println(itr.next());
}
System.out.println("Item to add "+itemId);
if(!availableItems.contains(itemId.longValue())){
System.out.println("Adding item not in available list");
return false;
}else{
System.out.println("Adding item "+itemId);
uiSession.getItemsChosen().add(itemId);
Iterator<Item> itemItr = availableItemObjects.iterator();
while(itemItr.hasNext()){
Item item = itemItr.next();
if(itemId.longValue() == item.getId().longValue()){
System.out.println("Item Object Found");
uiSession.getItemObjectsChosen().add(item);
break;
}
}
userItemSessionCache.put(new Element(userName, uiSession));
System.out.println("Session updated to cache");
return true;
}
}
}
@Override
public UserItemSession getUserItemSesion(String userName){
Ehcache userItemSessionCache = CacheManager.getInstance().getCache("userItemSessionCache");
Element cachedElement = userItemSessionCache.get(userName);
UserItemSession uiSession = null;
if(cachedElement != null){
System.out.println("Old Session Found");
uiSession = (UserItemSession) cachedElement.getValue();
}else{
System.out.println("New Session Created");
uiSession = new UserItemSession();
uiSession.setUserName(userName);
ItemInitilizeSingleton st = new ItemInitilizeSingleton();
System.out.println("Object returned from singleton");
uiSession.setAvailableItemObjects(st.itemSectionMap);
Map<Long, List<Item>> tempMap = st.itemSectionMap;
System.out.println(tempMap.keySet().toString());
uiSession.setItemObjectsChosen(new ArrayList<Item>());
uiSession.setAvailableItems(getDefaultItemList2(st.itemSectionMap));
uiSession.setItemsChosen(new ArrayList<Long>());
}
return uiSession;
}
In the above function "getUserItemSesion", I am trying to check whether the UserItemSession for a particular user already exists in cache. If no, i create a new UserItemSession for the user, populate it with some values, and return it. If the UserItemSession already exists for the user, then I return the old session.
In the other function, "addItemToUserList", I add a new item or the id of a new item to a new list, based on some available items with the user.
I tested this code with ehcache and terracotta(default configuration). There were puts and hits in the ehcache. But terracotta session was blank which seems to be ok since i did not define any roots and instrumented classes in tc-config.
This is where I am confused as to what to define as root and what to define as instrumented class.
Do I really require to set up distributed EHCACHE as well as configure tc-config.xml (root and instrumented classes) for clustering ? Or setting up Distributed EHCACHE only will do the job for me ?
Kindly let me know.
Versions
Terracotta 3.7.2
Ehcache 2.6.2
|
|
|
Code:
public class ExamineeSession implements Serializable {
//.....other codes...
private Map<String, List<String>> questionOrder;
public Map<String, List<String>> getQuestionOrder() {
return questionOrder;
}
public void setQuestionOrder(Map<String, List<String>> questionOrder) {
this.questionOrder = questionOrder;
}
//.....other codes.....
}
EHCACHE
Code:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<terracottaConfig url="localhost:9510" />
<defaultCache maxElementsInMemory="100000" eternal="false"
timeToIdleSeconds="600" timeToLiveSeconds="1200" overflowToDisk="false"
statistics="true">
<terracotta />
</defaultCache>
<cache name="examCache" maxEntriesLocalHeap="10000" eternal="true"
timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="false"
statistics="true">
<terracotta />
</cache>
<cache name="examSessionCache" maxElementsInMemory="10000"
eternal="true" timeToIdleSeconds="600" timeToLiveSeconds="600">
<cacheWriter writeMode="write-behind" minWriteDelay="5"
maxWriteDelay="120">
</cacheWriter>
<terracotta />
</cache>
</ehcache>
ExamineeSession service class
Code:
//.....codes....
questionOrder = examineeSession.getQuestionOrder();
// get list of question ids
questions = questionOrder.get(examineeSession.getSectionName());
for (int i = 0; i < questions.size(); i++) {
//............codes............
}
//....codes........
I am putting ExamineeSession objects in examSessionCache.
I am getting null pointer exception in "questions.size()" when I am using terracotta. But without terracotta everything works fine.
I ma using default configuration of terracotta.
Have not defined any dso-s or root elements
|
|
|
I have developed an application with Spring-Hibernate-Ehcahe-Terracotta.
The application contains a class 'ExamSession' which itself has several map objects like Map<Long List<Long>>.
There is a cache defined in ehcahe.xml which holds the objects of the ExamSession
When the application is being run using ehcache only, there is no problem.
But when it is run using terracotta, the map objects are not getting retrieved.
I am using the default terracotta configuration.
I have not yet defined any instrumented classes or dso-s.
As of now terracotta is running on a single machine
Versions used
Spring 3.1
Hibernate 3.6.10
Ehcache 3.6.2
Terracotta 3.7.0
Kindly let me know what changes need to be made both in the terracotta configuration or the ExamSession class so as to resolve the problem
|
|
|
I have imported the Terracotta Examinator project release 1.4.2.
But was unable to find the tc-config.xml configuration file.
Kindly let me know where to find the same.
|
|
|
I am trying to implement Write_Behind SOR using ehcache.
Data is getting saved in cache but its not getting committed to the database.
Hibernate session is also getting closed before the cache writer begins writing to the database.
the configuration and sample code is provided below
Code:
ehcache.xml
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect" dynamicConfig="true">
<cache name="contactCache"
maxElementsInMemory="10000"
eternal="true"
timeToIdleSeconds="100" timeToLiveSeconds="100"
>
<cacheWriter writeMode="write-behind"
minWriteDelay="5" maxWriteDelay="10">
<cacheWriterFactory class="com.mvc.service.WriteBehindClassFactory"></cacheWriterFactory>
</cacheWriter>
</cache>
</ehcache>
------------------------------------------------------------------
Hibernate.cfg.xml
Code:
<hibernate-configuration>
<session-factory>
<property name="hbm2ddl.auto">create</property>
<!-- 2nd level caching -->
<property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="net.sf.ehcache.configurationResourceName">ehcache.xml</property>
<!-- mapping classes -->
<mapping class="com.mvc.business.Contact" />
</session-factory>
</hibernate-configuration>
---------------------------------------------------------------------------------
Classes:
Code:
public class WriteBehindClassFactory extends CacheWriterFactory {
@Override
public CacheWriter createCacheWriter(Ehcache arg0, Properties arg1) {
// TODO Auto-generated method stub
return new ContactCacheWriter();
}
}
-------------------------------------------------------------------------------------
Code:
public class ContactCacheWriter implements CacheWriter{
static final Logger LOG = LoggerFactory.getLogger(ContactCacheWriter.class);
// public ContactCacheWriter(ContactServiceImpl contactService){
// this.contactService = contactService;
// }
public void delete(CacheEntry cacheEntry)throws CacheException
{
}
@Override
public void write(Element arg0) throws CacheException {
Ehcache contactCache = CacheManager.getInstance().getCache("contactCache");
LOG.info("Key Value = "+contactCache.get(arg0.getKey()));
Contact contact = (Contact) arg0.getObjectValue();
LOG.info("Contact Firstname = "+contact.getFirstname());
new ContactServiceImpl().addContact(contact);
System.out.println("written");
}
........
........
}
--------------------------------------------------------------------------------------
Code:
@Service
public class ContactServiceImpl implements IContactService {
static final Logger LOG = LoggerFactory.getLogger(ContactServiceImpl.class);
@Autowired
private IContactDao contactDao;
Ehcache contactCache;
public ContactServiceImpl(){
this.contactCache = CacheManager.getInstance().getCache("contactCache");
//this.contactCache.registerCacheWriter(new ContactCacheWriter(this));
}
@Transactional(propagation=Propagation.REQUIRED)
public void addContactToCache(Contact contact){
this.contactCache = CacheManager.getInstance().getCache("contactCache");
LOG.info("Adding contact to cache");
contactCache.putWithWriter(new Element(contact.getEmail(),contact));
LOG.info("Value in Cache = "+contactCache.get(contact.getEmail()));
}
@Transactional(propagation=Propagation.REQUIRED)
public void addContact(Contact contact) {
LOG.info("Adding contact to database ");
contact.setImagename(contact.getFirstname()+".jpg");
contactDao.addContact(contact);
//contactCache.remove(contact.getEmail());
}
..........
..........
}
--------------------------------------------------------------------------------------
Code:
@Repository
public class ContactDaoImpl implements IContactDao {
@Autowired
private SessionFactory sessionFactory;
@Transactional(propagation=Propagation.REQUIRED)
public void addContact(Contact contact) {
sessionFactory.getCurrentSession().save(contact);
}
......
......
}
--------------------------------------------------------------------------------------
Logs:
Code:
10:33:45.305 [main] DEBUG o.h.impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
10:33:45.339 [main] DEBUG o.h.impl.SessionFactoryObjectFactory - registered: 6b6bdc47-c34d-4569-b85c-b82a6c3a2231 (unnamed)
10:33:45.340 [main] INFO o.h.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
10:33:45.340 [main] DEBUG o.hibernate.impl.SessionFactoryImpl - instantiated session factory
10:33:45.368 [main] DEBUG org.hibernate.cfg.Configuration - Processing hbm.xml files
10:33:45.368 [main] DEBUG org.hibernate.cfg.Configuration - Process annotated classes
10:33:45.369 [main] DEBUG org.hibernate.cfg.Configuration - processing fk mappings (*ToOne and JoinedSubclass)
10:33:45.369 [main] DEBUG org.hibernate.cfg.Configuration - processing extends queue
10:33:45.369 [main] DEBUG org.hibernate.cfg.Configuration - processing extends queue
10:33:45.369 [main] DEBUG org.hibernate.cfg.Configuration - processing collection mappings
10:33:45.369 [main] DEBUG org.hibernate.cfg.Configuration - processing native query and ResultSetMapping mappings
10:33:45.369 [main] DEBUG org.hibernate.cfg.Configuration - processing association property references
10:33:45.369 [main] DEBUG org.hibernate.cfg.Configuration - processing foreign key constraints
10:33:45.373 [main] DEBUG o.h.i.f.DefaultIdentifierGeneratorFactory - Setting dialect [org.hibernate.dialect.MySQLDialect]
10:33:45.374 [main] DEBUG org.hibernate.cfg.Configuration - Processing hbm.xml files
10:33:45.374 [main] DEBUG org.hibernate.cfg.Configuration - Process annotated classes
10:33:45.374 [main] DEBUG org.hibernate.cfg.Configuration - processing fk mappings (*ToOne and JoinedSubclass)
10:33:45.374 [main] DEBUG org.hibernate.cfg.Configuration - processing extends queue
10:33:45.375 [main] DEBUG org.hibernate.cfg.Configuration - processing extends queue
10:33:45.375 [main] DEBUG org.hibernate.cfg.Configuration - processing collection mappings
10:33:45.375 [main] DEBUG org.hibernate.cfg.Configuration - processing native query and ResultSetMapping mappings
10:33:45.375 [main] DEBUG org.hibernate.cfg.Configuration - processing association property references
10:33:45.375 [main] DEBUG org.hibernate.cfg.Configuration - processing foreign key constraints
10:33:45.379 [main] DEBUG o.h.i.f.DefaultIdentifierGeneratorFactory - Setting dialect [org.hibernate.dialect.MySQLDialect]
10:33:45.379 [main] DEBUG o.h.i.f.DefaultIdentifierGeneratorFactory - Setting dialect [org.hibernate.dialect.MySQLDialect]
10:33:45.385 [main] INFO o.h.tool.hbm2ddl.SchemaExport - Running hbm2ddl schema export
10:33:45.388 [main] DEBUG o.h.tool.hbm2ddl.SchemaExport - import file not found: /import.sql
10:33:45.388 [main] INFO o.h.tool.hbm2ddl.SchemaExport - exporting generated schema to database
10:33:45.391 [main] DEBUG o.h.tool.hbm2ddl.SchemaExport - drop table if exists CONTACTS
10:33:45.539 [main] DEBUG o.h.tool.hbm2ddl.SchemaExport - create table CONTACTS (ID integer not null auto_increment, EMAIL varchar(255), FIRSTNAME varchar(255), IMAGENAME varchar(255), LASTNAME varchar(255), TELEPHONE varchar(255), primary key (ID))
10:33:45.613 [main] INFO o.h.tool.hbm2ddl.SchemaExport - schema export complete
10:33:45.649 [main] INFO o.h.cache.UpdateTimestampsCache - starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCache
10:33:45.652 [main] WARN n.s.e.h.AbstractEhcacheRegionFactory - Couldn't find a specific ehcache configuration for cache named [org.hibernate.cache.UpdateTimestampsCache]; using defaults.
10:33:45.664 [main] DEBUG net.sf.ehcache.store.MemoryStore - Initialized net.sf.ehcache.store.NotifyingMemoryStore for org.hibernate.cache.UpdateTimestampsCache
10:33:45.664 [main] DEBUG net.sf.ehcache.Cache - Initialised cache: org.hibernate.cache.UpdateTimestampsCache
10:33:45.665 [main] DEBUG n.s.e.config.ConfigurationHelper - CacheDecoratorFactory not configured for defaultCache. Skipping for 'org.hibernate.cache.UpdateTimestampsCache'.
10:33:45.665 [main] DEBUG n.s.e.h.AbstractEhcacheRegionFactory - started EHCache region: org.hibernate.cache.UpdateTimestampsCache
10:33:45.667 [main] INFO o.hibernate.cache.StandardQueryCache - starting query cache at region: org.hibernate.cache.StandardQueryCache
10:33:45.669 [main] WARN n.s.e.h.AbstractEhcacheRegionFactory - Couldn't find a specific ehcache configuration for cache named [org.hibernate.cache.StandardQueryCache]; using defaults.
10:33:45.670 [main] DEBUG net.sf.ehcache.store.MemoryStore - Initialized net.sf.ehcache.store.NotifyingMemoryStore for org.hibernate.cache.StandardQueryCache
10:33:45.671 [main] DEBUG net.sf.ehcache.Cache - Initialised cache: org.hibernate.cache.StandardQueryCache
10:33:45.671 [main] DEBUG n.s.e.config.ConfigurationHelper - CacheDecoratorFactory not configured for defaultCache. Skipping for 'org.hibernate.cache.StandardQueryCache'.
10:33:45.671 [main] DEBUG n.s.e.h.AbstractEhcacheRegionFactory - started EHCache region: org.hibernate.cache.StandardQueryCache
10:33:45.672 [main] DEBUG o.hibernate.impl.SessionFactoryImpl - Checking 0 named HQL queries
10:33:45.672 [main] DEBUG o.hibernate.impl.SessionFactoryImpl - Checking 0 named SQL queries
Jan 10, 2013 10:33:46 AM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
Jan 10, 2013 10:33:46 AM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/add],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.mvc.controller.HelloController.addContact(com.mvc.business.Contact,org.springframework.validation.BindingResult)
Jan 10, 2013 10:33:46 AM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/welcome],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.mvc.controller.HelloController.printWelcome(org.springframework.ui.ModelMap)
Jan 10, 2013 10:33:46 AM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/index],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.mvc.controller.HelloController.listContacts(java.util.Map<java.lang.String, java.lang.Object>)
Jan 10, 2013 10:33:46 AM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/delete/{contactId}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.mvc.controller.HelloController.deleteContact(java.lang.Integer)
Jan 10, 2013 10:33:48 AM org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
INFO: Using DataSource [org.apache.commons.dbcp.BasicDataSource@1079ff] of Hibernate SessionFactory for HibernateTransactionManager
Jan 10, 2013 10:33:48 AM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#1'
Jan 10, 2013 10:33:48 AM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/add],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.mvc.controller.HelloController.addContact(com.mvc.business.Contact,org.springframework.validation.BindingResult)
Jan 10, 2013 10:33:48 AM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/welcome],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.mvc.controller.HelloController.printWelcome(org.springframework.ui.ModelMap)
Jan 10, 2013 10:33:48 AM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/index],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.mvc.controller.HelloController.listContacts(java.util.Map<java.lang.String, java.lang.Object>)
Jan 10, 2013 10:33:48 AM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/delete/{contactId}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.mvc.controller.HelloController.deleteContact(java.lang.Integer)
10:33:48.647 [main] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 5561525159845888
10:33:48.698 [main] DEBUG o.h.transaction.JDBCTransaction - begin
10:33:48.698 [main] DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection
10:33:48.698 [main] DEBUG o.h.transaction.JDBCTransaction - current autocommit status: true
10:33:48.698 [main] DEBUG o.h.transaction.JDBCTransaction - disabling autocommit
10:33:48.749 [main] DEBUG net.sf.ehcache.CacheManager - Attempting to create an existing singleton. Existing singleton returned.
10:33:48.750 [main] INFO com.mvc.service.ContactServiceImpl - Adding contact to cache
10:33:48.771 [main] INFO com.mvc.service.ContactServiceImpl - Value in Cache = [ key = test@gmail.com, value=com.mvc.business.Contact@f36e59, version=1, hitCount=1, CreationTime = 1357794228750, LastAccessTime = 1357794228771 ]
10:33:48.771 [main] DEBUG o.h.transaction.JDBCTransaction - commit
10:33:48.772 [main] DEBUG o.h.transaction.JDBCTransaction - re-enabling autocommit
10:33:48.773 [main] DEBUG o.h.transaction.JDBCTransaction - committed JDBC Connection
10:33:48.773 [main] DEBUG org.hibernate.jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
10:33:48.774 [main] DEBUG org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
10:33:48.775 [main] DEBUG org.hibernate.jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
Jan 10, 2013 10:33:48 AM org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing org.springframework.context.support.GenericApplicationContext@b82368: startup date [Thu Jan 10 10:33:22 IST 2013]; root of context hierarchy
10:33:48.863 [Thread-3] INFO o.hibernate.impl.SessionFactoryImpl - closing
10:33:53.166 [contactCache write-behind] DEBUG net.sf.ehcache.CacheManager - Attempting to create an existing singleton. Existing singleton returned.
10:33:53.180 [contactCache write-behind] INFO com.mvc.service.ContactCacheWriter - Key Value = [ key = test@gmail.com, value=com.mvc.business.Contact@f36e59, version=1, hitCount=2, CreationTime = 1357794228750, LastAccessTime = 1357794233180 ]
10:33:53.181 [contactCache write-behind] INFO com.mvc.service.ContactCacheWriter - Contact Firstname = test
10:33:53.182 [contactCache write-behind] DEBUG net.sf.ehcache.CacheManager - Attempting to create an existing singleton. Existing singleton returned.
10:33:53.182 [contactCache write-behind] INFO com.mvc.service.ContactServiceImpl - Adding contact to database
------------------------------------------------------------------------------------
But the data never gets committed to the database
|
|
|
Can you tell me a suitable method to cache images in Ehcache ?
|
|
|
I have an application that requires a large number (around 2000) of small sized (max 100kb) images which will be viewed by a large number of people.
I would like to know the following
1. Whether putting these images in Ehcache will be of any help ? If no, Why?
2. If yes, What will be the best way to cache these images using terracotta Ehcache?
|
|
|
|
|