Re: [JCS] disk persistence - same conf file, different results

2014-11-17 Thread Tim Cronin
Any ETA on when JCS 2.0 will be released?

On Mon, Nov 17, 2014 at 2:07 AM, Thomas Vandahl t...@apache.org wrote:

 On 14.11.14 19:14, joao tiago a. m. viegas wrote:
  thank you Thomas, but is there anyway to persist and reload the cache
 with
  1.3?

 Unfortunately not. Sorry. JCS 1.3 is full of static classes which are
 not re-initialized properly. I tried to address most of these problems
 in 2.0, but still a few remain.

 Bye, Thomas


 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




Re: [JCS] disk persistence - same conf file, different results

2014-11-17 Thread Thomas Vandahl
On 17.11.14 14:49, Tim Cronin wrote:
 Any ETA on when JCS 2.0 will be released?

There is a vote running currently for 2.0 alpha 1.

Bye, Thomas.



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [JCS] disk persistence - same conf file, different results

2014-11-17 Thread Gary Gregory
There is a mismatch in communication here:

What I see is a VOTE to release the current release JCS candidate candidate
labeled 2.0-RC1 as 2.0.

There is no alpha labeled software released or being released. What is in
trunk is just the latest.

Gary

On Mon, Nov 17, 2014 at 11:24 AM, Thomas Vandahl t...@apache.org wrote:

 On 17.11.14 14:49, Tim Cronin wrote:
  Any ETA on when JCS 2.0 will be released?

 There is a vote running currently for 2.0 alpha 1.

 Bye, Thomas.



 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition
http://www.manning.com/bauer3/
JUnit in Action, Second Edition http://www.manning.com/tahchiev/
Spring Batch in Action http://www.manning.com/templier/
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: [JCS] disk persistence - same conf file, different results

2014-11-14 Thread Duncan Jones
Hi João,

This is probably best addressed to the Commons user mailing list. I've
BCC'd the issues list so people know where this email thread went to.
Please also prefix the Commons component into the subject line (in
this case [JCS], which I've done for you).

Duncan

On 14 November 2014 11:25, joao tiago a. m. viegas jtvie...@gmail.com wrote:
 hello,

 I've been testing jcs, I want a cache that allows me to save all the
 eleemnts when I shutsown gracefully, and later when I create a new instance
 of the same cache I can get those same objects I had before in the first
 encarnation of that same cache.
 I made this test and I'm actually using two identical confs, but for some
 reason I'm getting different results.
 Could you please help me understanding why?

 tests are:

 private static final String[] configs = new String[]
 {ObjectPersistingInMemoryAndDisk_x1.ccf,
 ObjectPersistingInMemoryAndDisk_x2.ccf};

 private static final String[] expecteds = new String[] {null, null};

 private static final String region = OUR_REGION;
 private static final String key=key, value=value;

 .
 .

 @Test
 public void testObjectPersistingInMemoryAndDisk_1() throws Exception{

 performObjectPersistingInMemoryAndDisk(JCS_CONFIG_DIR + configs[0],
 expecteds[0]);
 }

 @Test
 public void testObjectPersistingInMemoryAndDisk_2() throws Exception{

 performObjectPersistingInMemoryAndDisk(JCS_CONFIG_DIR + configs[1],
 expecteds[1]);
 }

 private void performObjectPersistingInMemoryAndDisk(String configFile,
 String expected) throws Exception{


 System.out.println(---);

 System.out.println(testing with config file: + configFile);
 JCS.setConfigFilename(configFile);
 JCS cache = JCS.getInstance(region);
 cache.put(key, value);
 Thread.sleep(5000);
 Assert.assertNotNull(cache.get(key));
 Assert.assertEquals(value, cache.get(key));

 IStats stats = cache.getStatistics().getAuxiliaryCacheStats()[0];

 cache.freeMemoryElements(Integer.parseInt(stats.getStatElements()[0].getData()));
 Thread.sleep(5000);
 Assert.assertNotNull(cache.get(key));
 Assert.assertEquals(value, cache.get(key));
 System.out.println(cache.getStats());
 CompositeCacheManager.getInstance().shutDown();

 Thread.sleep(5000);

 JCS.setConfigFilename(configFile);
 cache = JCS.getInstance(region);
 Assert.assertEquals(expected, cache.get(key));

 System.out.println(cache.getStats());
 cache.clear();
 cache.dispose();
 CompositeCacheManager.getInstance().shutDown();
 }


 ...the confs are:

 -- ObjectPersistingInMemoryAndDisk_x1.ccf --
 # DEFAULT CACHE REGION
 jcs.default=DISK_REGION
 jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
 jcs.default.cacheattributes.MaxObjects=1000
 jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
 #jcs.default.cacheattributes.DiskUsagePatternName=UPDATE

 jcs.region.OUR_REGION=DISK_REGION
 jcs.region.OUR_REGION.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
 jcs.region.OUR_REGION.cacheattributes.MaxObjects=1000
 jcs.region.OUR_REGION.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
 jcs.region.OUR_REGION.cacheattributes.UseMemoryShrinker=true
 jcs.region.OUR_REGION.cacheattributes.MaxMemoryIdleTimeSeconds=3600
 jcs.region.OUR_REGION.cacheattributes.ShrinkerIntervalSeconds=60
 jcs.region.OUR_REGION.cacheattributes.MaxSpoolPerRun=500
 jcs.region.OUR_REGION.elementattributes=org.apache.jcs.engine.ElementAttributes
 jcs.region.OUR_REGION.elementattributes.IsEternal=false

 jcs.auxiliary.DISK_REGION=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
 jcs.auxiliary.DISK_REGION.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
 jcs.auxiliary.DISK_REGION.attributes.DiskPath=/tmp/jcs/cache
 jcs.auxiliary.DISK_REGION.attributes.maxKeySize=10


 -- ObjectPersistingInMemoryAndDisk_x2.ccf --
 # DEFAULT CACHE REGION
 jcs.default=DISK_REGION
 jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
 jcs.default.cacheattributes.MaxObjects=1000
 jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
 #jcs.default.cacheattributes.DiskUsagePatternName=UPDATE

 jcs.region.OUR_REGION=DISK_REGION
 jcs.region.OUR_REGION.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
 jcs.region.OUR_REGION.cacheattributes.MaxObjects=1000
 jcs.region.OUR_REGION.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
 jcs.region.OUR_REGION.cacheattributes.UseMemoryShrinker=true
 jcs.region.OUR_REGION.cacheattributes.MaxMemoryIdleTimeSeconds=3600
 jcs.region.OUR_REGION.cacheattributes.ShrinkerIntervalSeconds=60
 jcs.region.OUR_REGION.cacheattributes.MaxSpoolPerRun=500
 jcs.region.OUR_REGION.elementattributes=org.apache.jcs.engine.ElementAttributes
 jcs.region.OUR_REGION.elementattributes.IsEternal=false

 

Re: [JCS] disk persistence - same conf file, different results

2014-11-14 Thread joao tiago a. m. viegas
I'll probably reformat this question in a simpler way.

The goal is to persist an element and retrieve it after restart of a new vm.

so simplifying the test:

 private void performSimplerObjectPersistingInMemoryAndDisk(String
 configFile, String expected) throws Exception {


 String key = key, value = value;

JCS.setConfigFilename(configFile);
 JCS cache = JCS.getInstance(OUR_REGION);

cache.put(key, value);
 Thread.sleep(5000);
 Assert.assertNotNull(cache.get(key));
 Assert.assertEquals(value, cache.get(key));
 System.out.println(cache.getStats());
 CompositeCacheManager.getInstance().shutDown();
 Thread.sleep(5000);
 JCS.setConfigFilename(configFile);
 cache = JCS.getInstance(OUR_REGION);
 Assert.assertEquals(expected, cache.get(key));
 System.out.println(cache.getStats());
 }



...I've been trying this test with a set of configuration files, last one:

# DEFAULT CACHE REGION
 jcs.default=DISK_REGION
 jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
 jcs.default.cacheattributes.MaxObjects=1000

 jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
 jcs.default.cacheattributes.DiskUsagePatternName=UPDATE
 jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
 jcs.default.elementattributes.IsSpool=true
 jcs.default.elementattributes.IsRemote=false
 jcs.default.elementattributes.IsLateral=false
 jcs.default.elementattributes.IsEternal=true
 # CUSTOM REGION
 jcs.region.OUR_REGION=DISK_REGION

 jcs.region.OUR_REGION.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
 jcs.region.OUR_REGION.cacheattributes.MaxObjects=0

 jcs.region.OUR_REGION.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
 jcs.region.OUR_REGION.cacheattributes.UseMemoryShrinker=true
 jcs.region.OUR_REGION.cacheattributes.MaxMemoryIdleTimeSeconds=3600
 jcs.region.OUR_REGION.cacheattributes.ShrinkerIntervalSeconds=60
 jcs.region.OUR_REGION.cacheattributes.MaxSpoolPerRun=500

 jcs.region.OUR_REGION.elementattributes=org.apache.jcs.engine.ElementAttributes
 jcs.region.OUR_REGION.elementattributes.IsEternal=true
 jcs.region.OUR_REGION.elementattributes.IsSpool=true
 jcs.region.OUR_REGION.elementattributes.IsRemote=false
 jcs.region.OUR_REGION.elementattributes.IsLateral=false
 jcs.region.OUR_REGION.cacheattributes.DiskUsagePatternName=UPDATE
 # AUXILIARY

 jcs.auxiliary.DISK_REGION=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory

 jcs.auxiliary.DISK_REGION.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
 jcs.auxiliary.DISK_REGION.attributes.DiskPath=/tmp/jcs/cache
 jcs.auxiliary.DISK_REGION.attributes.maxKeySize=10
 jcs.auxiliary.DISK_REGION.attributes.OptimizeOnShutdown=true
 jcs.auxiliary.DISK_REGION.attributes.MaxPurgatorySize=8
 jcs.auxiliary.DISK_REGION.attributes.OptimizeAtRemoveCount=30
 jcs.auxiliary.DISK_REGION.attributes.MaxRecycleBinSize=7500
 jcs.auxiliary.DISK_REGION.attributes.OptimizeOnShutdown=true


anyone have an idea or example of how this could work?

thanking you in advance

os melhores cumprimentos / best regards / Mit freundlichen Grüssen / Saludos

joão tiago viegas

On 14 November 2014 11:56, Duncan Jones djo...@apache.org wrote:

 Hi João,

 This is probably best addressed to the Commons user mailing list. I've
 BCC'd the issues list so people know where this email thread went to.
 Please also prefix the Commons component into the subject line (in
 this case [JCS], which I've done for you).

 Duncan

 On 14 November 2014 11:25, joao tiago a. m. viegas jtvie...@gmail.com
 wrote:
  hello,
 
  I've been testing jcs, I want a cache that allows me to save all the
  eleemnts when I shutsown gracefully, and later when I create a new
 instance
  of the same cache I can get those same objects I had before in the first
  encarnation of that same cache.
  I made this test and I'm actually using two identical confs, but for some
  reason I'm getting different results.
  Could you please help me understanding why?
 
  tests are:
 
  private static final String[] configs = new String[]
  {ObjectPersistingInMemoryAndDisk_x1.ccf,
  ObjectPersistingInMemoryAndDisk_x2.ccf};
 
  private static final String[] expecteds = new String[] {null, null};
 
  private static final String region = OUR_REGION;
  private static final String key=key, value=value;
 
  .
  .
 
  @Test
  public void testObjectPersistingInMemoryAndDisk_1() throws Exception{
 
  performObjectPersistingInMemoryAndDisk(JCS_CONFIG_DIR + configs[0],
  expecteds[0]);
  }
 
  @Test
  public void testObjectPersistingInMemoryAndDisk_2() throws Exception{
 
  performObjectPersistingInMemoryAndDisk(JCS_CONFIG_DIR + configs[1],
  expecteds[1]);
  }
 
  private void performObjectPersistingInMemoryAndDisk(String configFile,
  String expected) throws Exception{
 
 
 
 System.out.println(---);
 
  System.out.println(testing with 

Re: [JCS] disk persistence - same conf file, different results

2014-11-14 Thread Thomas Vandahl
On 14.11.14 13:47, joao tiago a. m. viegas wrote:
 I'll probably reformat this question in a simpler way.
 
 The goal is to persist an element and retrieve it after restart of a new vm.

The disk caches persist the keys when the cache is shut down. So you
should call CompositeCacheManager.getInstance().shutDown(); before your
application ends.

Bye, Thomas.



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [JCS] disk persistence - same conf file, different results

2014-11-14 Thread Thomas Vandahl
On 14.11.14 18:03, Thomas Vandahl wrote:
 On 14.11.14 13:47, joao tiago a. m. viegas wrote:
 I'll probably reformat this question in a simpler way.

 The goal is to persist an element and retrieve it after restart of a new vm.
 
 The disk caches persist the keys when the cache is shut down. So you
 should call CompositeCacheManager.getInstance().shutDown(); before your
 application ends.
 

To be precise: You cannot shut down the cache in the middle of a process
because with jcs 1.3 the cache will not re-initialize correctly. This
should have been fixed to a large extent in jcs 2.0 but still needs
further work.

Bye, Thomas


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [JCS] disk persistence - same conf file, different results

2014-11-14 Thread joao tiago a. m. viegas
thank you Thomas, but is there anyway to persist and reload the cache with
1.3?


os melhores cumprimentos / best regards / Mit freundlichen Grüssen / Saludos

joão tiago viegas

On 14 November 2014 17:29, Thomas Vandahl t...@apache.org wrote:

 On 14.11.14 18:03, Thomas Vandahl wrote:
  On 14.11.14 13:47, joao tiago a. m. viegas wrote:
  I'll probably reformat this question in a simpler way.
 
  The goal is to persist an element and retrieve it after restart of a
 new vm.
 
  The disk caches persist the keys when the cache is shut down. So you
  should call CompositeCacheManager.getInstance().shutDown(); before your
  application ends.
 

 To be precise: You cannot shut down the cache in the middle of a process
 because with jcs 1.3 the cache will not re-initialize correctly. This
 should have been fixed to a large extent in jcs 2.0 but still needs
 further work.

 Bye, Thomas


 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org