public class LazyLoadItemList<E> extends BaseLazyLoadItemList<E>
List is thread safe for accessing it elements via get(int).
| Modifier and Type | Class and Description |
|---|---|
protected static class |
LazyLoadItemList.BufferedPage<T>
Thread safe (hopefully) abstraction for paged result objects list with information at which index this page
starts.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_PREFETCH_SIZE
The value for
DEFAULT_PREFETCH_SIZE is read from the configuration properties. |
static int |
DEFUALT_PREFETCH_SIZE
Deprecated.
|
static LazyLoadItemList |
EMPTY_LIST
Static, light-weight empty list instance.
|
static String |
PREFETCH_SIZE_PROPERTY |
DEFAULT_CONFIG_PREFETCH_SIZEmodCount| Modifier | Constructor and Description |
|---|---|
|
LazyLoadItemList()
This constructor usees as prefetch size
DEFAULT_PREFETCH_SIZE. |
|
LazyLoadItemList(Set<PK> prefetchLanguages,
List<PK> pks,
int prefetchSize)
LazyLoadItemList Constructor.
|
protected |
LazyLoadItemList(Set<PK> prefetchLanguages,
List<PK> pks,
int prefetchSize,
boolean modifable) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
Object element) |
void |
clear() |
E |
get(int index) |
protected E |
getBuffered(int listPos)
Gets an object of type E for absolute global given
listPos. |
protected LazyLoadItemList.BufferedPage<E> |
getBufferedPageIfLoaded(int totalIndex)
Returns a
LazyLoadItemList.BufferedPage for the given totalIndex or null if it is not in range of
currentBufferedPage. |
protected LazyLoadItemList.BufferedPage<E> |
getCurrentBufferedPage() |
protected LazyLoadItemList.BufferedPage<E> |
getOrSwitchBufferedPage(int totalIndex)
Returns a
LazyLoadItemList.BufferedPage for the given totalIndex or creates a new LazyLoadItemList.BufferedPage if it
is not in range of currentBufferedPage. |
protected void |
invalidateBuffer()
Invalidates a
currentBufferedPage's . |
boolean |
isIgnoreMissing()
Deprecated.
since 4.8
|
protected List<E> |
loadPage(List<PK> pks)
Override this method to provide a resolving mechanism for generating values for the pre-fetched
BaseLazyLoadItemList.pkList
entries. |
E |
remove(int index)
Does not completely fulfill the remove() contract.
|
E |
set(int index,
Object element)
Does not completely fulfill the set() contract.
|
void |
setIgnoreMissing(boolean ignoreMissing)
Deprecated.
since 4.8
|
void |
setModifiable(boolean modifiable)
Deprecated.
since 4.8 set modifiable during creation - by default is true
|
void |
setPreFetchSize(int preFetchSize)
Deprecated.
since 4.8 does not have a counter part - set a prefetch size in constructor
|
protected LazyLoadItemList.BufferedPage<E> |
switchBufferedPage(int totalIndex) |
protected LazyLoadItemList.BufferedPage<E> |
switchBufferedPageNoLock(int totalIndex) |
protected LazyLoadItemList.BufferedPage<E> |
switchBufferedPageSynchronized(int totalIndex) |
protected LazyLoadItemList.BufferedPage<E> |
switchPage(int listPos)
Not thread safe switch page method.
|
assureIndex, contains, equals, getConfig, getPK, getPKList, getPKListInternal, getPrefetchLanguages, getPreFetchSize, hashCode, isModifiable, iterator, size, toStringadd, addAll, indexOf, lastIndexOf, listIterator, listIterator, removeRange, subListaddAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayparallelStream, removeIf, streampublic static final String PREFETCH_SIZE_PROPERTY
public static final int DEFAULT_PREFETCH_SIZE
DEFAULT_PREFETCH_SIZE is read from the configuration properties. The key is
lazy.pkcollection.prefetchsize.public static final LazyLoadItemList EMPTY_LIST
@Deprecated public static final int DEFUALT_PREFETCH_SIZE
public LazyLoadItemList()
DEFAULT_PREFETCH_SIZE.public LazyLoadItemList(Set<PK> prefetchLanguages, List<PK> pks, int prefetchSize)
prefetchLanguages - pks - prefetchSize - use postive values only or DEFAULT_PREFETCH_SIZE for reading the value from the configuration
properties.public E get(int index) throws IndexOutOfBoundsException
get in interface List<E>get in class BaseLazyLoadItemList<E>IndexOutOfBoundsExceptionprotected E getBuffered(int listPos)
listPos. Internally it checks if this index is
accessible for the current page if not appropriate page is loaded.
Method ensured by change of volatile currentBufferedPage to retrieve consistent result for given index in
multi-threaded environment.
protected void invalidateBuffer()
currentBufferedPage's .protected LazyLoadItemList.BufferedPage<E> switchPage(int listPos)
protected List<E> loadPage(List<PK> pks)
BaseLazyLoadItemList.pkList
entries.public E set(int index, Object element)
public void add(int index,
Object element)
public E remove(int index)
public void clear()
clear in interface Collection<E>clear in interface List<E>clear in class BaseLazyLoadItemList<E>@Deprecated public void setPreFetchSize(int preFetchSize)
DEFAULT_PREFETCH_SIZE
instead of -1. Other negative values are interpreted as -1. If you add a negative or invalid value to the
configuration property key lazy.pkcollection.prefetchsize, the prefetch size is set to 100.
If you do not wish to use the value from the configuration properties, use positive values only.preFetchSize - the size of the prefetched elements for the list. Has to be a positive value.@Deprecated public boolean isIgnoreMissing()
@Deprecated public void setIgnoreMissing(boolean ignoreMissing)
ignoreMissing - the ignoreMissing to set@Deprecated public void setModifiable(boolean modifiable)
modifiable - the modifiable to setprotected LazyLoadItemList.BufferedPage<E> getCurrentBufferedPage()
protected LazyLoadItemList.BufferedPage<E> getOrSwitchBufferedPage(int totalIndex)
LazyLoadItemList.BufferedPage for the given totalIndex or creates a new LazyLoadItemList.BufferedPage if it
is not in range of currentBufferedPage.protected LazyLoadItemList.BufferedPage<E> getBufferedPageIfLoaded(int totalIndex)
LazyLoadItemList.BufferedPage for the given totalIndex or null if it is not in range of
currentBufferedPage.protected LazyLoadItemList.BufferedPage<E> switchBufferedPage(int totalIndex)
protected final LazyLoadItemList.BufferedPage<E> switchBufferedPageSynchronized(int totalIndex)
protected final LazyLoadItemList.BufferedPage<E> switchBufferedPageNoLock(int totalIndex)
Copyright © 2017 SAP SE. All Rights Reserved.