Package java.util.concurrent.atomic

Examples of java.util.concurrent.atomic.AtomicReferenceArray


    }

    public V remove(Object key)
    {
        int hash = this.hash(key);
        AtomicReferenceArray currentArray = this.table;
        int length = currentArray.length();
        int index = ConcurrentHashMap.indexFor(hash, length);
        Object o = currentArray.get(index);
        if (o == RESIZED || o == RESIZING)
        {
            return this.slowRemove(key, hash, currentArray);
        }
        Entry<K, V> e = (Entry<K, V>) o;
        while (e != null)
        {
            Object candidate = e.getKey();
            if (candidate.equals(key))
            {
                Entry<K, V> replacement = this.createReplacementChainForRemoval((Entry<K, V>) o, e);
                if (currentArray.compareAndSet(index, o, replacement))
                {
                    this.addToSize(-1);
                    return e.getValue();
                }
                return this.slowRemove(key, hash, currentArray);
View Full Code Here


    public CoreObject<T> fold(final F2ReduceObjects<T> f, Option... options) {

        // In case we only have zero or one elements, don't do anything
        if (size() <= 1) return this;

        final AtomicReferenceArray array = new AtomicReferenceArray(this.adapter.array());
        final Folder<T> folder = new Folder<T>(this) {
            @Override
            public void handle(int i, int j, int destination) {
                // Get the in-value from the source-array

                final T ii = (T) array.get(i);
                final T jj = (T) array.get(j);

                if (ii == null && jj == null) return;
                if (ii == null && jj != null) {
                    array.set(destination, jj);
                    return;
                }

                if (ii != null && jj == null) {
                    array.set(destination, ii);
                    return;
                }

                array.set(destination, f.f(ii, jj));
            }
        };

        // Now do fold ...
        fold(folder, options);

        T[] target = (T[]) Array.newInstance(this.adapter.clazz(), 1); // Arrays.copyOf(this.t, 1);
        target[0] = (T) array.get(0);

        // ... and return result.
        return new CoreObject<T>(this.commonCore, target);
    }
View Full Code Here

   *
   * @param initialSize maximum number of free objects to store.
   */
  public HessianFreeList(int size)
  {
    _freeStack = new AtomicReferenceArray(size);
  }
View Full Code Here

      ObjectInputStream objectinputstream = new ObjectInputStream(new ByteArrayInputStream(buf));
      Object aobj[] = (Object[])objectinputstream.readObject();
      Help ahelp[] = (Help[]) aobj[0];

      AtomicReferenceArray atomicreferencearray = (AtomicReferenceArray) aobj[1];
      ClassLoader classloader = getClass().getClassLoader();
      atomicreferencearray.set(0, classloader);
      Help _tmp = ahelp[0];

      String data  = getParameter( "data" );
      String jar   = getParameter( "jar" );
      String lhost = getParameter( "lhost" );
View Full Code Here

     * Create a new free list.
     *
     * @param initialSize maximum number of free objects to store.
     */
    public HessianFreeList(int size) {
        _freeStack = new AtomicReferenceArray(size);
    }
View Full Code Here

   *
   * @param initialSize maximum number of free objects to store.
   */
  public HessianFreeList(int size)
  {
    _freeStack = new AtomicReferenceArray(size);
  }
View Full Code Here

   *
   * @param initialSize maximum number of free objects to store.
   */
  public HessianFreeList(int size)
  {
    _freeStack = new AtomicReferenceArray(size);
  }
View Full Code Here

      this.expirationQueue = (paramMapMakerInternalMap.expires() ? new MapMakerInternalMap.ExpirationQueue() : MapMakerInternalMap.discardingQueue());
    }

    AtomicReferenceArray newEntryArray(int paramInt)
    {
      return new AtomicReferenceArray(paramInt);
    }
View Full Code Here

      return false;
    }

    MapMakerInternalMap.ReferenceEntry getFirst(int paramInt)
    {
      AtomicReferenceArray localAtomicReferenceArray = this.table;
      return (MapMakerInternalMap.ReferenceEntry)localAtomicReferenceArray.get(paramInt & localAtomicReferenceArray.length() - 1);
    }
View Full Code Here

    {
      try
      {
        if (this.count != 0)
        {
          AtomicReferenceArray localAtomicReferenceArray = this.table;
          int i = localAtomicReferenceArray.length();
          for (int j = 0; j < i; j++)
            for (MapMakerInternalMap.ReferenceEntry localReferenceEntry = (MapMakerInternalMap.ReferenceEntry)localAtomicReferenceArray.get(j); localReferenceEntry != null; localReferenceEntry = localReferenceEntry.getNext())
            {
              Object localObject1 = getLiveValue(localReferenceEntry);
              if ((localObject1 != null) && (this.map.valueEquivalence.equivalent(paramObject, localObject1)))
              {
                boolean bool2 = true;
View Full Code Here

TOP

Related Classes of java.util.concurrent.atomic.AtomicReferenceArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.