You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Zohar <da...@hotmail.com> on 2008/03/03 16:41:01 UTC

handling events

Hi,
I've implemented the IElementEventHandler interface.
I now have :

public void handleElementEvent(IElementEvent event) {
    // handle event
}

How do I access the cached object in the event?
I managed to do it using:

CacheElement obj = (CacheElement) ((EventObject)event).getSource();

but it seems a bit ugly - doesn't it...?

Is there a better way?

Thanks,
Zohar. 

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: cache file corruption

Posted by Aaron Smuts <as...@yahoo.com>.
It looks like its happening during defragmentation.


--- Tim Cronin <tc...@interwoven.com> wrote:

> We've got a customer who has started seeing these
> issue.
> they say it's happening every few hours to their
> servers
> 
> we're still trying to track down what they might be
> doing.
> 
> 
> 2008-02-26 16:42:33,058 ERROR
>
[org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache]
> Region
> [component] Error occurred during defragmentation.
> java.io.IOException: Mismatched memory and disk
> length (829686271) for
> [DED:  pos = 122753 len = 923]
>  at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDisk.move(IndexedDisk.java:
> 135)
>  at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.defragFile(Indexe
> dDiskCache.java:1198)
>  at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.optimizeFile(Inde
> xedDiskCache.java:1125)
>  at
>
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache$2.run(IndexedDisk
> Cache.java:1052)
>  at java.lang.Thread.run(Thread.java:595)
> 2008-02-26 16:42:33,308 WARN
> [org.apache.jcs.auxiliary.disk.indexed.IndexedDisk]
>  The file is corrupt:
>  Record [DED:  pos = 469507 len = 799] starts past
> EOF.
> 2008-02-26 16:42:33,308 ERROR
>
[org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache]
> Region
> [component] IO Exception, Problem reading object
> from file
> java.io.IOException: The File Is Corrupt, need to
> reset
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jcs-users-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


cache file corruption

Posted by Tim Cronin <tc...@interwoven.com>.
We've got a customer who has started seeing these issue.
they say it's happening every few hours to their servers

we're still trying to track down what they might be doing.


2008-02-26 16:42:33,058 ERROR
[org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache] Region
[component] Error occurred during defragmentation.
java.io.IOException: Mismatched memory and disk length (829686271) for
[DED:  pos = 122753 len = 923]
 at
org.apache.jcs.auxiliary.disk.indexed.IndexedDisk.move(IndexedDisk.java:
135)
 at
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.defragFile(Indexe
dDiskCache.java:1198)
 at
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache.optimizeFile(Inde
xedDiskCache.java:1125)
 at
org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache$2.run(IndexedDisk
Cache.java:1052)
 at java.lang.Thread.run(Thread.java:595)
2008-02-26 16:42:33,308 WARN
[org.apache.jcs.auxiliary.disk.indexed.IndexedDisk]
 The file is corrupt:
 Record [DED:  pos = 469507 len = 799] starts past EOF.
2008-02-26 16:42:33,308 ERROR
[org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCache] Region
[component] IO Exception, Problem reading object from file
java.io.IOException: The File Is Corrupt, need to reset

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: handling events

Posted by Thomas Vandahl <tv...@apache.org>.
Zohar wrote:
> CacheElement obj = (CacheElement) ((EventObject)event).getSource();
> 
> but it seems a bit ugly - doesn't it...?

Yep, but this is how it's done. Please note that the expiry event types 
that are supposed to be fired on access will not be generated in 1.3. 
See https://issues.apache.org/jira/browse/JCS-33 for the story. You'll 
need to roll your own from the code in SVN.

Bye, Thomas.


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: cache size limit

Posted by Aaron Smuts <as...@yahoo.com>.
You could extend the memory cache, use an object key
that your extension understands, and do it yourself. 
The cache is completely pluggable.  It would trivial
to do this.

Aaron


--- Zohar <da...@hotmail.com> wrote:

> Hello,
> I use JCS to cache entries which hold file paths.
> The underlying files are 
> kept in the file system. Is there any way I can
> impose a size limit on the 
> cache's "real impact" on the file system? For
> example, is there a way to 
> assign a 'size' attribute to a CacheElement, so that
> this attribute is used 
> when calculating the cache's size, instead of the
> entry's size?
> 
> Thanks,
> Zohar. 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> jcs-users-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


cache size limit

Posted by Zohar <da...@hotmail.com>.
Hello,
I use JCS to cache entries which hold file paths. The underlying files are 
kept in the file system. Is there any way I can impose a size limit on the 
cache's "real impact" on the file system? For example, is there a way to 
assign a 'size' attribute to a CacheElement, so that this attribute is used 
when calculating the cache's size, instead of the entry's size?

Thanks,
Zohar. 


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org