Class RwlSegmentedStoredList<T>

java.lang.Object
com.j_spaces.kernel.list.RwlSegmentedStoredList<T>
All Implemented Interfaces:
IHashEntry<Object,IStoredList<T>>, ICollection<T>, IStoredList<T>, IObjectsList

@Deprecated public class RwlSegmentedStoredList<T> extends Object implements IStoredList<T>
Deprecated.
segmented Read/Write Lock version of StoredList to be used with JDK 1.5+ NOTE : some of the apis of IStoredList are not supported used just for shortest path selected fifo & order related apis not supported
Since:
6.1
Version:
1.0
Author:
Yechiel Fefer
  • Constructor Details

  • Method Details

    • size

      public int size()
      Deprecated.
      Description copied from interface: ICollection
      Returns the amount of elements in the StoredList.
      Specified by:
      size in interface ICollection<T>
      Returns:
      size of the StoredList
      See Also:
    • isEmpty

      public boolean isEmpty()
      Deprecated.
      Returns true if the list is empty
      Specified by:
      isEmpty in interface ICollection<T>
      Returns:
      true if list is empty; false otherwise.
    • getHead

      public IObjectInfo<T> getHead()
      Deprecated.
      Goes over all the segments and finds the first element.
      Specified by:
      getHead in interface IStoredList<T>
      Returns:
      the head of the list
    • getObjectFromHead

      public T getObjectFromHead()
      Deprecated.
      Description copied from interface: IStoredList
      Returns the value of the first element in the list (fifo)
      Specified by:
      getObjectFromHead in interface IStoredList<T>
      Returns:
      the value of the head of the list
    • optimizeScanForSingleObject

      public boolean optimizeScanForSingleObject()
      Deprecated.
      return true if we can save iterator creation and get a single entry
      Specified by:
      optimizeScanForSingleObject in interface IStoredList<T>
      Returns:
      true if we can optimize
    • establishListScan

      public IStoredListIterator<T> establishListScan(boolean random_scan)
      Deprecated.
      establish a scan position. we select a random segment to start from
      Specified by:
      establishListScan in interface ICollection<T>
      Parameters:
      random_scan - true enable random scan; false start from head.
      Returns:
      a Holder for this scan. This Resource should be released if scan ended prematurely.
    • next

      Deprecated.
      get the next element in scan order
      Specified by:
      next in interface ICollection<T>
      Parameters:
      slh - Holder representing a pivot position.
      Returns:
      the next pivot position in this scan; null if reached end of scan.
    • freeSLHolder

      public void freeSLHolder(IStoredListIterator<T> slh)
      Deprecated.
      this method is called by outside scan that want to quit the scan and return the slholder to the factory
      Specified by:
      freeSLHolder in interface IStoredList<T>
      Parameters:
      slh - Holder resource to return to pool; can be null.
    • add

      public IObjectInfo<T> add(T subject)
      Deprecated.
      store an element
      Specified by:
      add in interface ICollection<T>
      Parameters:
      subject - element to store.
      Returns:
      an information node representing the inserted element; null if StoredList has been invalidated.
    • addUnlocked

      public IObjectInfo<T> addUnlocked(T subject)
      Deprecated.
      Description copied from interface: IStoredList
      Store an element in the list, while the SL is unlocked . New elements are inserted at the tail.
      Specified by:
      addUnlocked in interface IStoredList<T>
      Parameters:
      subject - element to store.
      Returns:
      an information node representing the inserted element; null if StoredList has been invalidated.
    • store_impl

      protected IObjectInfo<T> store_impl(com.j_spaces.kernel.list.RwlSegmentedStoredList.Segment<T> segment, com.j_spaces.kernel.list.RwlSegmentedStoredList.ObjectInfo<T> oi)
      Deprecated.
      store an element in segment
    • remove

      public void remove(IObjectInfo<T> poi)
      Deprecated.
      remove an element described by ObjectInfo
      Specified by:
      remove in interface IStoredList<T>
      Parameters:
      poi - an existing element between Tail and Head
    • removeUnlocked

      public void removeUnlocked(IObjectInfo<T> poi)
      Deprecated.
      Description copied from interface: IStoredList
      Remove an element described by ObjectInfo, while the SL is unlocked. [Tail] - .. - [beforeOi] - [oi] - [afterOi] - .. - [Head]
      Specified by:
      removeUnlocked in interface IStoredList<T>
      Parameters:
      poi - an existing element between Tail and Head
    • remove_impl

      protected void remove_impl(com.j_spaces.kernel.list.RwlSegmentedStoredList.Segment<T> segment, com.j_spaces.kernel.list.RwlSegmentedStoredList.ObjectInfo<T> oi)
      Deprecated.
      remove an element described by ObjectInfo
      Parameters:
      segment - TODO
    • removeByObject

      public boolean removeByObject(T obj)
      Deprecated.
      given an object scan the list, find it and remove it, returns true if found
      Specified by:
      removeByObject in interface ICollection<T>
      Parameters:
      obj - element to remove
      Returns:
      true if object was removed; false otherwise (if element wasn't found)
    • contains

      public boolean contains(T obj)
      Deprecated.
      is this object contained in the SL ?
      Specified by:
      contains in interface ICollection<T>
      Parameters:
      obj - the element to search for
      Returns:
      true if element exists in the StoredList; false otherwise.
    • invalidate

      public boolean invalidate()
      Deprecated.
      Sets an indication that this StoredList is invalid. if isEmpty() returns true, the indication is set; otherwise the indication remains false. Called by PersistentGC when scanning for empty StoredList that can be garbage collected.
      Specified by:
      invalidate in interface IStoredList<T>
      Returns:
      true if StoredList was set to invalid; false otherwise.
    • isMultiObjectCollection

      public boolean isMultiObjectCollection()
      Deprecated.
      Description copied from interface: ICollection
      is it an actual multi object container.
      Specified by:
      isMultiObjectCollection in interface ICollection<T>
      Returns:
      true if its an actual list; false otherwise
    • isIterator

      public boolean isIterator()
      Deprecated.
      Description copied from interface: IObjectsList
      is the list an iterator or basic list ?
      Specified by:
      isIterator in interface IObjectsList
    • dump

      public void dump(org.slf4j.Logger logger, String msg)
      Deprecated.
      Description copied from interface: IStoredList
      Dump list content, used for Debug.
      Specified by:
      dump in interface IStoredList<T>
      Parameters:
      logger - logger to use
      msg - message to add in log
    • getHashCode

      public int getHashCode(int id)
      Deprecated.
      Specified by:
      getHashCode in interface IHashEntry<Object,IStoredList<T>>
    • getKey

      public Object getKey(int id)
      Deprecated.
      Specified by:
      getKey in interface IHashEntry<Object,IStoredList<T>>
    • getValue

      public IStoredList<T> getValue(int id)
      Deprecated.
      Specified by:
      getValue in interface IHashEntry<Object,IStoredList<T>>
    • isNativeHashEntry

      public boolean isNativeHashEntry()
      Deprecated.
      Specified by:
      isNativeHashEntry in interface IHashEntry<Object,IStoredList<T>>
      Returns:
      true if this is a native hashmap entry