Java Doc for DistributedTimedCachePolicy.java in  » EJB-Server-JBoss-4.2.1 » cluster » org » jboss » ha » framework » server » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » cluster » org.jboss.ha.framework.server.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.TimerTask
      org.jboss.ha.framework.server.util.DistributedTimedCachePolicy

DistributedTimedCachePolicy
public class DistributedTimedCachePolicy extends TimerTask implements CachePolicy(Code)
An implementation of a timed cache. This is a cache whose entries have a limited lifetime with the ability to refresh their lifetime. The entries managed by the cache implement the TimedCachePolicy.TimedEntry interface. If an object inserted into the cache does not implement this interface, it will be wrapped in a DefaultTimedEntry and will expire without the possibility of refresh after getDefaultLifetime() seconds. This is a lazy cache policy in that objects are not checked for expiration until they are accessed.
author:
   Scott Stark.
version:
   $Revision: 57188 $

Inner Class :public static interface TimedEntry extends Serializable
Inner Class :static class DefaultTimedEntry implements TimedEntry

Field Summary
protected  Stringcategory
    
protected  intdefaultLifetime
     The lifetime in seconds to use for objects inserted that do not implement the TimedEntry interface.
protected  DistributedStateentryMap
     The map of cached TimedEntry objects.
protected static  Loggerlog
    
protected  longnow
    
protected  StringpartitionName
    
protected  intresolution
    
protected static  TimerresolutionTimer
    

Constructor Summary
public  DistributedTimedCachePolicy(String category, String partitionName, int defaultLifetime)
     Creates a new TimedCachePolicy with the given default entry lifetime that does not synchronized access to its policy store and uses a 60 second resolution.
public  DistributedTimedCachePolicy(String category, String partitionName, int defaultLifetime, int resolution)
     Creates a new TimedCachePolicy with the given default entry lifetime that does/does not synchronized access to its policy store depending on the value of threadSafe.
Parameters:
  category - the name of the catetegory used in the DistributedStateaccess calls.
Parameters:
  partitionName - the name of the HAPartition who's replicatedstate service will be used as the cache store.
Parameters:
  defaultLifetime - the lifetime in seconds to use for objects insertedthat do not implement the TimedEntry interface.
Parameters:
  resolution - the resolution in seconds of the cache timer.

Method Summary
public  voidcreate()
     Initializes the cache for use.
public  longcurrentTimeMillis()
     Get the cache time.
public  voiddestroy()
     Clears the cache of all entries.
public  voidflush()
     Remove all entries from the cache.
public  Objectget(Object key)
     Get the cache value for key if it has not expired.
public  intgetDefaultLifetime()
     Get the default lifetime of cache entries.
public  voidinsert(Object key, Object value)
     Insert a value into the cache.
public  Objectpeek(Object key)
     Get the cache value for key.
public  TimedEntrypeekEntry(Object key)
     Get the raw TimedEntry for key without performing any expiration check.
public  voidremove(Object key)
     Remove the entry associated with key and call destroy on the entry if found.
public  voidrun()
     The TimerTask run method.
public  voidsetDefaultLifetime(int defaultLifetime)
     Set the default lifetime of cache entries for new values added to the cache.
public  intsize()
    
public  voidstart()
     Schedules this with the class resolutionTimer Timer object for execution every resolution seconds.
public  voidstop()
     Stop cancels the resolution timer and flush()es the cache.

Field Detail
category
protected String category(Code)



defaultLifetime
protected int defaultLifetime(Code)
The lifetime in seconds to use for objects inserted that do not implement the TimedEntry interface.



entryMap
protected DistributedState entryMap(Code)
The map of cached TimedEntry objects.



log
protected static Logger log(Code)



now
protected long now(Code)
The caches notion of the current time



partitionName
protected String partitionName(Code)



resolution
protected int resolution(Code)
The resolution in seconds of the cach current time



resolutionTimer
protected static Timer resolutionTimer(Code)




Constructor Detail
DistributedTimedCachePolicy
public DistributedTimedCachePolicy(String category, String partitionName, int defaultLifetime)(Code)
Creates a new TimedCachePolicy with the given default entry lifetime that does not synchronized access to its policy store and uses a 60 second resolution.



DistributedTimedCachePolicy
public DistributedTimedCachePolicy(String category, String partitionName, int defaultLifetime, int resolution)(Code)
Creates a new TimedCachePolicy with the given default entry lifetime that does/does not synchronized access to its policy store depending on the value of threadSafe.
Parameters:
  category - the name of the catetegory used in the DistributedStateaccess calls.
Parameters:
  partitionName - the name of the HAPartition who's replicatedstate service will be used as the cache store.
Parameters:
  defaultLifetime - the lifetime in seconds to use for objects insertedthat do not implement the TimedEntry interface.
Parameters:
  resolution - the resolution in seconds of the cache timer. A cache doesnot query the system time on every get() invocation. Rather the cacheupdates its notion of the current time every 'resolution' seconds.
See Also:   DistributedState




Method Detail
create
public void create() throws Exception(Code)
Initializes the cache for use. Prior to this the cache has no store.



currentTimeMillis
public long currentTimeMillis()(Code)
Get the cache time. the cache time last obtained from System.currentTimeMillis()



destroy
public void destroy()(Code)
Clears the cache of all entries.



flush
public void flush()(Code)
Remove all entries from the cache.



get
public Object get(Object key)(Code)
Get the cache value for key if it has not expired. If the TimedEntry is expired its destroy method is called and then removed from the cache. the TimedEntry value or the original value if it was not aninstance of TimedEntry if key is in the cache, null otherwise.



getDefaultLifetime
public int getDefaultLifetime()(Code)
Get the default lifetime of cache entries. default lifetime in seconds of cache entries.



insert
public void insert(Object key, Object value)(Code)
Insert a value into the cache. In order to have the cache entry reshresh itself value would have to implement TimedEntry and implement the required refresh() method logic.
Parameters:
  key - the key for the cache entry
Parameters:
  value - Either an instance of TimedEntry that will be inserted withoutchange, or an abitrary value that will be wrapped in a non-refreshingTimedEntry.



peek
public Object peek(Object key)(Code)
Get the cache value for key. This method does not check to see if the entry has expired. the TimedEntry value or the original value if it was not aninstancee of TimedEntry if key is in the cache, null otherwise.



peekEntry
public TimedEntry peekEntry(Object key)(Code)
Get the raw TimedEntry for key without performing any expiration check. the TimedEntry value associated with key if one exists, null otherwise.



remove
public void remove(Object key)(Code)
Remove the entry associated with key and call destroy on the entry if found.



run
public void run()(Code)
The TimerTask run method. It updates the cache time to the current system time.



setDefaultLifetime
public void setDefaultLifetime(int defaultLifetime)(Code)
Set the default lifetime of cache entries for new values added to the cache.
Parameters:
  defaultLifetime - lifetime in seconds of cache values that donot implement TimedEntry.



size
public int size()(Code)



start
public void start()(Code)
Schedules this with the class resolutionTimer Timer object for execution every resolution seconds.



stop
public void stop()(Code)
Stop cancels the resolution timer and flush()es the cache.



Methods inherited from java.util.TimerTask
public boolean cancel()(Code)(Java Doc)
abstract public void run()(Code)(Java Doc)
public long scheduledExecutionTime()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.