ensure container is initialized before accessing

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@480416 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-11-29 05:36:42 +00:00
parent 5c587a2f13
commit d871d0e304
1 changed files with 5 additions and 0 deletions

View File

@ -689,6 +689,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
* @return the first StoreEntry or null if the list is empty * @return the first StoreEntry or null if the list is empty
*/ */
public synchronized StoreEntry getFirst(){ public synchronized StoreEntry getFirst(){
load();
return indexList.getFirst(); return indexList.getFirst();
} }
@ -698,6 +699,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
* @return the last StoreEntry or null if the list is empty * @return the last StoreEntry or null if the list is empty
*/ */
public synchronized StoreEntry getLast(){ public synchronized StoreEntry getLast(){
load();
return indexList.getLast(); return indexList.getLast();
} }
@ -708,6 +710,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
* @return the next StoreEntry or null * @return the next StoreEntry or null
*/ */
public synchronized StoreEntry getNext(StoreEntry entry){ public synchronized StoreEntry getNext(StoreEntry entry){
load();
IndexItem item=(IndexItem)entry; IndexItem item=(IndexItem)entry;
return indexList.getNextEntry(item); return indexList.getNextEntry(item);
} }
@ -719,6 +722,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
* @return the previous store entry or null * @return the previous store entry or null
*/ */
public synchronized StoreEntry getPrevious(StoreEntry entry){ public synchronized StoreEntry getPrevious(StoreEntry entry){
load();
IndexItem item=(IndexItem)entry; IndexItem item=(IndexItem)entry;
return indexList.getPrevEntry(item); return indexList.getPrevEntry(item);
} }
@ -730,6 +734,7 @@ public class ListContainerImpl extends BaseContainerImpl implements ListContaine
* @return a refreshed StoreEntry * @return a refreshed StoreEntry
*/ */
public synchronized StoreEntry refresh(StoreEntry entry) { public synchronized StoreEntry refresh(StoreEntry entry) {
load();
return indexList.getEntry(entry); return indexList.getEntry(entry);
} }