1 package org.gffs.cache;
4 * Copyright 2006 University of Virginia
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
7 * obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
13 * and limitations under the License.
16 class TimeoutList<KeyType, DataType> extends CacheList<KeyType, DataType>
20 super(RoleBasedCacheNode.ROLE_TIMEOUT);
24 public void insert(RoleBasedCacheNode<KeyType, DataType> node)
26 // We'll start at the end because most likely we're adding to the end
33 RoleBasedCacheNode<KeyType, DataType> tmp;
34 for (tmp = _tail; tmp != null; tmp = tmp.getPrevious(_myRole)) {
35 if (tmp.getInvalidationDate().compareTo(node.getInvalidationDate()) <= 0) {
36 // current node invalidates before me, so I should go after him
37 node.setPrevious(_myRole, tmp);
38 node.setNext(_myRole, tmp.getNext(_myRole));
39 tmp.setNext(_myRole, node);
40 if (node.getNext(_myRole) == null) {
44 node.getNext(_myRole).setPrevious(_myRole, node);
51 // We add to the head of the list
52 node.setNext(_myRole, _head);
53 _head.setPrevious(_myRole, node);