KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > output > cache > SoftTimedContent


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.server.output.cache;
10
11 import java.lang.ref.WeakReference JavaDoc;
12
13 import org.jboss.portal.server.output.FragmentResult;
14
15 /**
16  * Use soft reference.
17  *
18  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
19  * @version $Revision: 1.2 $
20  */

21 public class SoftTimedContent extends TimedContent
22 {
23
24    /** The content. */
25    private final WeakReference JavaDoc content;
26
27    /**
28     * @exception IllegalArgumentException if the content is null
29     */

30    public SoftTimedContent(FragmentResult content, long expirationTimeMillis) throws IllegalArgumentException JavaDoc
31    {
32       super(expirationTimeMillis);
33       if (content == null)
34       {
35          throw new IllegalArgumentException JavaDoc("Content must not be null");
36       }
37       this.content = new WeakReference JavaDoc(content);
38    }
39
40    public FragmentResult getContent()
41    {
42       return (FragmentResult)content.get();
43    }
44 }
45
Popular Tags