Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/apache/derby/iapi/services/cache/CacheableFactory.java


1   /*
2   
3      Derby - Class org.apache.derby.iapi.services.cache.CacheableFactory
4   
5      Copyright 2000, 2004 The Apache Software Foundation or its licensors, as applicable.
6   
7      Licensed under the Apache License, Version 2.0 (the "License");
8      you may not use this file except in compliance with the License.
9      You may obtain a copy of the License at
10  
11        http://www.apache.org/licenses/LICENSE-2.0
12  
13     Unless required by applicable law or agreed to in writing, software
14     distributed under the License is distributed on an "AS IS" BASIS,
15     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16     See the License for the specific language governing permissions and
17     limitations under the License.
18  
19   */
20  
21  package org.apache.derby.iapi.services.cache;
22  
23  /**
24    Any object that implements this interface can be cached using the services of
25    the CacheManager/CacheFactory. In addition to implementing this interface the
26    class must be public and it must have a public no-arg constructor. This is because
27    the cache manager will construct objects itself and then set their identity
28    by calling the setIdentity method.
29    <P>
30    A Cacheable object has five states:
31    <OL>
32    <OL>
33    <LI> No identity - The object is only accessable by the cache manager
34    <LI> Identity, clean, unkept - The object has an identity, is clean but is only accessable by the cache manager
35    <LI> Identity, clean, kept - The object has an identity, is clean, and is in use by one or more threads 
36    <LI> Identity, kept, dirty - The object has an identity, is dirty, and is in use by one or more threads 
37    <LI> Identity, unkept, dirty - The object has an identity, is dirty but is only accessable by the cache manager
38    </OL>
39    </OL>
40    <BR>
41    While the object is kept it is guaranteed
42    not to change identity. While it is unkept no-one outside of the
43    cache manager can have a reference to the object.
44    The cache manager returns kept objects and they return to the unkept state
45    when all the current users of the object have released it.
46    <BR>
47    It is required that the object can only move into a dirty state while it is kept.
48  
49    <BR> MT - Mutable : thread aware - Calls to Cacheable method must only be made by the
50    cache manager or the object itself.
51  
52    @see CacheManager
53    @see CacheFactory
54    @see Class#newInstance
55  */
56  public interface CacheableFactory  {
57  
58    public Cacheable newCacheable(CacheManager cm);
59  }
60