Package java.util.concurrent

Examples of java.util.concurrent.CopyOnWriteArrayList$ListIteratorImpl


        return flattenList;
    }


    public static List FlattenSafeList(Iterable... listArgs) {
        final List flattenList = new CopyOnWriteArrayList();
        for (Iterable collection : listArgs) {
            for (Object obj : collection) {
                flattenList.add(obj);
            }
        }
        return flattenList;
    }
View Full Code Here


     * a new instance and initialize it.
     * @param serviceClass the service interface
     * @param provider the provider of that service.
     */
    public <T> void registerRunningService(Class<T> serviceClass, T provider) {
        CopyOnWriteArrayList rs = runningServices.get(serviceClass);
        if (rs==null) {
            rs = new CopyOnWriteArrayList<T>();
            CopyOnWriteArrayList existing = runningServices.putIfAbsent(serviceClass, rs);
            if(existing!=null)
                rs = existing;
        }
        rs.add(provider);
    }
View Full Code Here

    /**
     * Removes a running service, this is useful when a service instance is no longer
     * available as a provider of a service.
     */
    public <T> boolean unregisterRunningService(Class<T> serviceClass, T provider) {
        CopyOnWriteArrayList rs = runningServices.get(serviceClass);
        if (rs==null) {
            return false;
        }
        return rs.remove(provider);
    }
View Full Code Here


public class CollectionTest {
  @Test
  public void concurrent() throws Exception {
    CopyOnWriteArrayList list = new CopyOnWriteArrayList();
    list.add("vivek");
    list.add("kumar");
    Iterator i =list.iterator();
    while(i.hasNext()){
      System.out.println(i.next());
      list.add("abhishek");
    }
   
    System.out.println("After modification:");
    System.out.println("Size:" + list.size());
    Iterator i2 =list.iterator();
    while(i2.hasNext()){
      System.out.println(i2.next());
    }
  }
View Full Code Here

/*  99 */         this.eventListenerRegistry.put(filterObject, handbacks);
/*     */       }
/* 101 */       List listeners = (List)handbacks.get(handbackObject);
/* 102 */       if (listeners == null)
/*     */       {
/* 104 */         listeners = new CopyOnWriteArrayList();
/* 105 */         handbacks.put(handbackObject, listeners);
/*     */       }
/* 107 */       listeners.add(listener);
/* 108 */       if (log.isTraceEnabled())
/* 109 */         log.trace("Registered listener: " + listener + " with filter=" + filter + " handback=" + handback + " on object " + this);
View Full Code Here

/*     */           {
/* 165 */             Object supply = supplied.getSupply();
/* 166 */             List list = (List)this.suppliers.get(supply);
/* 167 */             if (list == null)
/*     */             {
/* 169 */               list = new CopyOnWriteArrayList();
/* 170 */               this.suppliers.put(supply, list);
/*     */             }
/* 172 */             list.add(context);
/* 173 */             if (trace)
/* 174 */               this.log.trace("Suppliers of " + supply + ": " + list);
View Full Code Here

/*     */
/*     */   private void readObject(ObjectInputStream in)
/*     */     throws IOException, ClassNotFoundException
/*     */   {
/* 349 */     in.defaultReadObject();
/* 350 */     this.installedContexts = new CopyOnWriteArrayList();
/*     */   }
View Full Code Here

/*     */     }
/*     */     else
/*     */     {
/* 235 */       eventSource = (EventSource)this.eventSourceMapping.get(eventSource.getNameSpace());
/* 236 */       updateManagerAddress(deploymentInfo, eventSource);
/* 237 */       this.subscriptionMapping.put(eventSource.getNameSpace(), new CopyOnWriteArrayList());
/*     */
/* 239 */       eventSource.setState(EventSource.State.STARTED);
/* 240 */       log.debug("Started: " + eventSource);
/*     */     }
/*     */   }
View Full Code Here

/* 904 */         for (String packageName : packageNames)
/*     */         {
/* 906 */           List list = (List)this.classLoadersByPackageName.get(packageName);
/* 907 */           if (list == null)
/*     */           {
/* 909 */             list = new CopyOnWriteArrayList();
/* 910 */             this.classLoadersByPackageName.put(packageName, list);
/*     */           }
/* 912 */           list.add(info);
/* 913 */           log.trace("Registered " + policy + " as providing package=" + packageName);
/*     */         }
View Full Code Here

/*  86 */     return new ConcurrentHashMap();
/*     */   }
/*     */
/*     */   public static final <T> List<T> createCopyOnWriteList()
/*     */   {
/*  97 */     return new CopyOnWriteArrayList();
/*     */   }
View Full Code Here

TOP

Related Classes of java.util.concurrent.CopyOnWriteArrayList$ListIteratorImpl

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.