svn commit: r585667 - in /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache: HardRefCacheLine.java SoftRefCacheLine.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r585667 - in /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache: HardRefCacheLine.java SoftRefCacheLine.java

doogie-3
Author: doogie
Date: Wed Oct 17 13:19:51 2007
New Revision: 585667

URL: http://svn.apache.org/viewvc?rev=585667&view=rev
Log:
Forgot to add these for version 585661.

Added:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/HardRefCacheLine.java
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/SoftRefCacheLine.java

Added: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/HardRefCacheLine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/HardRefCacheLine.java?rev=585667&view=auto
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/HardRefCacheLine.java (added)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/HardRefCacheLine.java Wed Oct 17 13:19:51 2007
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.base.util.cache;
+
+public final class HardRefCacheLine extends CacheLine {
+    public final Object value;
+
+    public HardRefCacheLine(Object value, long expireTime) {
+        super(expireTime);
+        this.value = value;
+    }
+
+    public HardRefCacheLine(Object value, long loadTime, long expireTime) {
+        super(loadTime, expireTime);
+        this.value = value;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public boolean isInvalid() {
+        return value == null;
+    }
+}

Added: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/SoftRefCacheLine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/SoftRefCacheLine.java?rev=585667&view=auto
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/SoftRefCacheLine.java (added)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/cache/SoftRefCacheLine.java Wed Oct 17 13:19:51 2007
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.base.util.cache;
+
+public final class SoftRefCacheLine extends CacheLine {
+    public final CacheSoftReference ref;
+
+    public SoftRefCacheLine(Object value, long expireTime) {
+        super(expireTime);
+        this.ref = new CacheSoftReference(value);
+    }
+
+    public SoftRefCacheLine(Object value, long loadTime, long expireTime) {
+        super(loadTime, expireTime);
+        this.ref = new CacheSoftReference(value);
+    }
+
+    public Object getValue() {
+        return ref.get();
+    }
+
+    public boolean isInvalid() {
+        return ref.get() == null;
+    }
+}