Package org.jboss.util

Examples of org.jboss.util.SoftObject


    * @param obj     Element to be inserted.
    */
   public void add(final int index, final Object obj) {
      maintain();

      SoftObject soft = SoftObject.create(obj, queue);
      list.add(index, soft);
   }
View Full Code Here


   /**
    * Maintains the collection by removing garbage collected objects.
    */
   private void maintain() {
      SoftObject obj;
      int count = 0;

      while ((obj = (SoftObject)queue.poll()) != null) {
         count++;
         list.remove(obj);
View Full Code Here

    * @return     True if object was added.
    */
   public boolean add(final Object obj) {
      maintain();

      SoftObject soft = SoftObject.create(obj, queue);
     
      return collection.add(soft);
   }
View Full Code Here

   /**
    * Maintains the collection by removing garbage collected objects.
    */
   private void maintain() {
      SoftObject obj;
      int count = 0;

      while ((obj = (SoftObject)queue.poll()) != null) {
         count++;
         collection.remove(obj);
View Full Code Here

    * @return        The previous element at the given index.
    */
   public Object set(final int index, final Object obj) {
      maintain();
     
      SoftObject soft = SoftObject.create(obj, queue);
      soft = (SoftObject)list.set(index, soft);

      return Objects.deref(soft);
   }
View Full Code Here

/*     */
/*     */   public Object set(int index, Object obj)
/*     */   {
/* 106 */     maintain();
/*     */
/* 108 */     SoftObject soft = SoftObject.create(obj, this.queue);
/* 109 */     soft = (SoftObject)this.list.set(index, soft);
/*     */
/* 111 */     return Objects.deref(soft);
/*     */   }
View Full Code Here

/*     */
/*     */   public void add(int index, Object obj)
/*     */   {
/* 124 */     maintain();
/*     */
/* 126 */     SoftObject soft = SoftObject.create(obj, this.queue);
/* 127 */     this.list.add(index, soft);
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   private void maintain()
/*     */   {
/* 150 */     int count = 0;
/*     */     SoftObject obj;
/* 152 */     while ((obj = (SoftObject)this.queue.poll()) != null) {
/* 153 */       count++;
/* 154 */       this.list.remove(obj);
/*     */     }
/*     */
View Full Code Here

/*     */
/*     */   public boolean add(Object obj)
/*     */   {
/*  86 */     maintain();
/*     */
/*  88 */     SoftObject soft = SoftObject.create(obj, this.queue);
/*     */
/*  90 */     return this.collection.add(soft);
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   private void maintain()
/*     */   {
/*  98 */     int count = 0;
/*     */     SoftObject obj;
/* 100 */     while ((obj = (SoftObject)this.queue.poll()) != null) {
/* 101 */       count++;
/* 102 */       this.collection.remove(obj);
/*     */     }
/*     */
View Full Code Here

TOP

Related Classes of org.jboss.util.SoftObject

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.