Java Code Examples for java.util.concurrent.CopyOnWriteArraySet

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project chukwa, under directory /src/main/java/org/apache/hadoop/chukwa/datastore/.

Source file: ChukwaHBaseStore.java

  19 
vote

public static Set<String> getFamilyNames(String tableName){
  Set<String> familyNames=new CopyOnWriteArraySet<String>();
  try {
    HTableInterface table=pool.getTable(tableName);
    Set<byte[]> families=table.getTableDescriptor().getFamiliesKeys();
    for (    byte[] name : families) {
      familyNames.add(new String(name));
    }
    table.close();
  }
 catch (  Exception e) {
    log.error(ExceptionUtil.getStackTrace(e));
  }
  return familyNames;
}
 

Example 2

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.dashboard.ui/src/org/springsource/ide/eclipse/dashboard/internal/ui/editors/.

Source file: DashboardMainPage.java

  19 
vote

@Override protected void createFormContent(IManagedForm managedForm){
  toolkit=managedForm.getToolkit();
  form=managedForm.getForm();
  unfinishedJobs=new CopyOnWriteArraySet<AggregateFeedJob>();
  feedColor=new Color(Display.getDefault(),70,70,70);
  toolkit.decorateFormHeading(form.getForm());
  prefStore=IdeUiPlugin.getDefault().getPreferenceStore();
  GridLayout compositeLayout=new GridLayout(2,true);
  compositeLayout.marginHeight=0;
  compositeLayout.marginTop=5;
  compositeLayout.verticalSpacing=0;
  Composite body=form.getBody();
  body.setLayout(compositeLayout);
  Composite leftComposite=toolkit.createComposite(body);
  leftComposite.setLayout(new GridLayout());
  GridDataFactory.fillDefaults().grab(true,true).applyTo(leftComposite);
  Composite rightComposite=toolkit.createComposite(body);
  rightComposite.setLayout(new GridLayout());
  GridDataFactory.fillDefaults().grab(true,true).applyTo(rightComposite);
  createHeader();
  createNewProjectsSection(leftComposite);
  createUpdateSection(leftComposite);
  parts=contributeParts(leftComposite,AbstractDashboardPart.ID_PATH_DOC);
  for (  AbstractDashboardPart part : parts) {
    if (part.getControl() instanceof Section) {
      String expansionProp=getExpansionPropertyId(part);
      Section section=(Section)part.getControl();
      GridDataFactory.fillDefaults().grab(false,getStoredExpandedState(expansionProp,false)).applyTo(section);
      setUpExpandableSection(section,expansionProp,false);
    }
  }
  createHelpSection(leftComposite);
  createFeedsSection(rightComposite,"Feeds",FeedType.BLOG,"blog");
  searchBox.setFocus();
  ResourceProvider.getInstance().addPropertyChangeListener(this);
}
 

Example 3

From project fakereplace, under directory /core/src/main/java/org/fakereplace/manip/util/.

Source file: ManipulationDataStore.java

  19 
vote

public void add(String name,T mdata){
  ClassLoader loader=mdata.getClassLoader();
  if (loader == null) {
    loader=NULL_CLASS_LOADER;
  }
  ConcurrentMap<String,Set<T>> data=cldata.get(loader);
  Set<T> store=data.get(name);
  if (store == null) {
    store=new CopyOnWriteArraySet<T>();
    Set<T> existing=data.putIfAbsent(name,store);
    if (existing != null) {
      store=existing;
    }
  }
  store.add(mdata);
}
 

Example 4

From project floodlight, under directory /src/main/java/net/floodlightcontroller/core/internal/.

Source file: Controller.java

  19 
vote

/** 
 * Initialize internal data structures
 */
public void init(Map<String,String> configParams){
  this.messageListeners=new ConcurrentHashMap<OFType,ListenerDispatcher<OFType,IOFMessageListener>>();
  this.switchListeners=new CopyOnWriteArraySet<IOFSwitchListener>();
  this.haListeners=new CopyOnWriteArraySet<IHAListener>();
  this.activeSwitches=new ConcurrentHashMap<Long,IOFSwitch>();
  this.connectedSwitches=new HashSet<OFSwitchImpl>();
  this.controllerNodeIPsCache=new HashMap<String,String>();
  this.updates=new LinkedBlockingQueue<IUpdate>();
  this.factory=new BasicFactory();
  this.providerMap=new HashMap<String,List<IInfoProvider>>();
  setConfigParams(configParams);
  this.role=getInitialRole(configParams);
  this.roleChanger=new RoleChanger();
  initVendorMessages();
  this.systemStartTime=System.currentTimeMillis();
}
 

Example 5

From project karaf, under directory /features/core/src/test/java/org/apache/karaf/features/.

Source file: FeaturesServiceTest.java

  19 
vote

@Test public void testInstallBatchFeatureWithContinueOnFailureNoClean() throws Exception {
  String bundle1Uri="bundle1";
  String bundle2Uri="bundle2";
  URI uri=createTempRepo(FEATURE_WITH_INVALID_BUNDLE,bundle1Uri,bundle2Uri);
  BundleManager bundleManager=EasyMock.createMock(BundleManager.class);
  Bundle installedBundle1=createDummyBundle(12345L,"bundle1",headers());
  Bundle installedBundle2=createDummyBundle(54321L,"bundle2",headers());
  expect(bundleManager.getDataFile(EasyMock.<String>anyObject())).andReturn(dataFile).anyTimes();
  expect(bundleManager.installBundleIfNeeded(bundle1Uri,0,null)).andReturn(new BundleInstallerResult(installedBundle1,true));
  expect(bundleManager.installBundleIfNeeded(bundle2Uri,0,null)).andReturn(new BundleInstallerResult(installedBundle2,true));
  expect(bundleManager.installBundleIfNeeded("zfs:unknown",0,null)).andThrow(new MalformedURLException());
  EasyMock.expectLastCall();
  ignoreRefreshes(bundleManager);
  replay(bundleManager);
  FeaturesServiceImpl svc=new FeaturesServiceImpl(bundleManager);
  svc.addRepository(uri);
  svc.installFeatures(new CopyOnWriteArraySet<Feature>(Arrays.asList(svc.listFeatures())),EnumSet.of(FeaturesService.Option.ContinueBatchOnFailure,FeaturesService.Option.NoCleanIfFailure));
  verify(bundleManager);
}
 

Example 6

From project log4j-jboss-logmanager, under directory /src/main/java/org/apache/log4j/.

Source file: Hierarchy.java

  19 
vote

public Hierarchy(Logger root){
  listeners=new CopyOnWriteArraySet<HierarchyEventListener>();
  jblmRootLogger=JBossLogManagerFacade.getJBossRootLogger();
  jblmRootLogger.setLevel(JBossLevelMapping.getLevelFor(root.getLevel()));
  defaultFactory=new DefaultCategoryFactory();
  rendererMap=new RendererMap();
}
 

Example 7

From project mina-sshd, under directory /sshd-core/src/main/java/org/apache/sshd/server/channel/.

Source file: ChannelSession.java

  19 
vote

protected Set<SignalListener> getSignalListeners(Signal signal,boolean create){
  Set<SignalListener> ls=listeners.get(signal);
  if (ls == null && create) {
synchronized (listeners) {
      ls=listeners.get(signal);
      if (ls == null) {
        ls=new CopyOnWriteArraySet<SignalListener>();
        listeners.put(signal,ls);
      }
    }
  }
  return ls;
}
 

Example 8

From project morphia, under directory /morphia/src/main/java/com/google/code/morphia/mapping/.

Source file: Mapper.java

  19 
vote

/** 
 * Add MappedClass to internal cache, possibly validating first. 
 */
private MappedClass addMappedClass(MappedClass mc,boolean validate){
  if (validate)   mc.validate();
  Converters c=(Converters)mc.getAnnotation(Converters.class);
  if (c != null)   for (  Class<? extends TypeConverter> clazz : c.value())   if (!converters.isRegistered(clazz))   converters.addConverter(clazz);
  mappedClasses.put(mc.getClazz().getName(),mc);
  Set<MappedClass> mcs=mappedClassesByCollection.get(mc.getCollectionName());
  if (mcs == null) {
    mcs=new CopyOnWriteArraySet<MappedClass>();
    Set<MappedClass> temp=mappedClassesByCollection.putIfAbsent(mc.getCollectionName(),mcs);
    if (temp != null)     mcs=temp;
  }
  mcs.add(mc);
  return mc;
}
 

Example 9

From project myfaces-extcdi, under directory /jse-modules/message-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/message/impl/.

Source file: DefaultMessageContextConfig.java

  19 
vote

private void resetMessageContextConfig(){
  this.messageInterpolator=new DefaultMessageInterpolator();
  this.messageResolver=null;
  this.messageHandlers=new CopyOnWriteArraySet<MessageHandler>();
  this.localeResolver=new DefaultLocaleResolver();
  this.formatterFactory=new DefaultFormatterFactory();
}
 

Example 10

From project mylyn.context, under directory /org.eclipse.mylyn.context.core/src/org/eclipse/mylyn/internal/context/core/.

Source file: ContextCorePlugin.java

  19 
vote

/** 
 * Recommended bridge registration is via extension point, but bridges can also be added at runtime. Note that only one bridge per content type is supported. Overriding content types is not supported.
 */
public synchronized void addStructureBridge(AbstractContextStructureBridge bridge){
  if (bridge.getContentType().equals(ContextCore.CONTENT_TYPE_RESOURCE)) {
    defaultBridge=bridge;
  }
 else {
    bridges.put(bridge.getContentType(),bridge);
  }
  if (bridge.getParentContentType() != null) {
    Set<String> childContentTypes=childContentTypeMap.get(bridge.getParentContentType());
    if (childContentTypes == null) {
      childContentTypes=new CopyOnWriteArraySet<String>();
    }
    childContentTypes.add(bridge.getContentType());
    childContentTypeMap.put(bridge.getParentContentType(),childContentTypes);
  }
}
 

Example 11

From project OpenTripPlanner, under directory /opentripplanner-routing/src/main/java/org/opentripplanner/routing/graph/.

Source file: AbstractVertex.java

  19 
vote

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  this.incoming=new CopyOnWriteArraySet<Edge>();
  this.outgoing=new CopyOnWriteArraySet<Edge>();
  index=maxIndex++;
}
 

Example 12

From project org.openscada.atlantis, under directory /org.openscada.da.server.common/src/org/openscada/da/server/common/chain/.

Source file: DataItemBaseChained.java

  19 
vote

/** 
 * Replace the current chain with the new one
 * @param chain the new chain
 */
public void setChain(final Collection<ChainProcessEntry> chain){
  for (  final ChainProcessEntry entry : this.chain) {
    entry.getWhat().dataItemChanged(this);
  }
  if (chain == null) {
    this.chain=new CopyOnWriteArraySet<ChainProcessEntry>();
  }
 else {
    final Set<ChainProcessEntry> newChain=new CopyOnWriteArraySet<ChainProcessEntry>(chain);
    for (    final ChainProcessEntry entry : newChain) {
      entry.getWhat().dataItemChanged(this);
    }
    this.chain=newChain;
  }
  process();
}
 

Example 13

From project org.ops4j.pax.web, under directory /pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/.

Source file: ServerControllerImpl.java

  19 
vote

ServerControllerImpl(final JettyFactory jettyFactory){
  m_jettyFactory=jettyFactory;
  m_configuration=null;
  m_state=new Unconfigured();
  m_listeners=new CopyOnWriteArraySet<ServerListener>();
}
 

Example 14

From project otto, under directory /library/src/main/java/com/squareup/otto/.

Source file: Bus.java

  19 
vote

/** 
 * Registers all handler methods on  {@code object} to receive events and producer methods to provide events.<p> If any subscribers are registering for types which already have a producer they will be called immediately with the result of calling that producer. <p> If any producers are registering for types which already have subscribers, each subscriber will be called with the value from the result of calling the producer.
 * @param object object whose handler methods should be registered.
 */
public void register(Object object){
  enforcer.enforce(this);
  Map<Class<?>,EventProducer> foundProducers=findAllProducers(object);
  for (  Class<?> type : foundProducers.keySet()) {
    final EventProducer producer=foundProducers.get(type);
    EventProducer previousProducer=producersByType.putIfAbsent(type,producer);
    if (previousProducer != null) {
      throw new IllegalArgumentException("Producer method for type " + type + " already registered.");
    }
    Set<EventHandler> handlers=handlersByType.get(type);
    if (handlers != null && !handlers.isEmpty()) {
      for (      EventHandler handler : handlers) {
        dispatchProducerResultToHandler(handler,producer);
      }
    }
  }
  Map<Class<?>,Set<EventHandler>> foundHandlersMap=findAllSubscribers(object);
  for (  Class<?> type : foundHandlersMap.keySet()) {
    Set<EventHandler> handlers=handlersByType.get(type);
    if (handlers == null) {
      Set<EventHandler> handlersCreation=new CopyOnWriteArraySet<EventHandler>();
      handlers=handlersByType.putIfAbsent(type,handlersCreation);
      if (handlers == null) {
        handlers=handlersCreation;
      }
    }
    final Set<EventHandler> foundHandlers=foundHandlersMap.get(type);
    handlers.addAll(foundHandlers);
    EventProducer producer=producersByType.get(type);
    if (producer != null) {
      for (      EventHandler foundHandler : foundHandlers) {
        dispatchProducerResultToHandler(foundHandler,producer);
      }
    }
  }
}
 

Example 15

From project PerfExpert, under directory /hpcdata/src/edu/utexas/tacc/hpcdata/structures/.

Source file: Node.java

  19 
vote

public Node(){
  children=new CopyOnWriteArraySet<Node>();
  i=0;
  max_index=-1;
  type=null;
  metric_map=null;
  parent=null;
}
 

Example 16

From project Red5, under directory /src/org/red5/server/scope/.

Source file: Scope.java

  19 
vote

/** 
 * Connect to scope with parameters. To successfully connect to scope it must have handler that will accept this connection with given set of parameters. Client associated with connection is added to scope clients set, connection is registered as scope event listener.
 * @param conn Connection object
 * @param params Parameters passed with connection
 * @return <code>true</code> on success, <code>false</code> otherwise
 */
public boolean connect(IConnection conn,Object[] params){
  log.debug("Connect: {}",conn);
  if (hasParent() && !parent.connect(conn,params)) {
    return false;
  }
  if (hasHandler() && !getHandler().connect(conn,this,params)) {
    return false;
  }
  final IClient client=conn.getClient();
  if (!conn.isConnected()) {
    return false;
  }
  if (hasHandler() && !getHandler().join(client,this)) {
    return false;
  }
  if (!conn.isConnected()) {
    return false;
  }
  Set<IConnection> conns=clients.get(client);
  if (conns == null) {
    conns=new CopyOnWriteArraySet<IConnection>();
    clients.put(client,conns);
  }
  conns.add(conn);
  clientStats.increment();
  addEventListener(conn);
  connectionStats.increment();
  IScope connScope=conn.getScope();
  log.trace("Connection scope: {}",connScope);
  if (this.equals(connScope)) {
    final IServer server=getServer();
    if (server instanceof Server) {
      ((Server)server).notifyConnected(conn);
    }
  }
  return true;
}
 

Example 17

From project red5-mavenized, under directory /red5_base/src/main/java/org/red5/server/.

Source file: Scope.java

  19 
vote

/** 
 * Connect to scope with parameters. To successfully connect to scope it must have handler that will accept this connection with given set of parameters. Client associated with connection is added to scope clients set, connection is registered as scope event listener.
 * @param conn Connection object
 * @param params Parameters passed with connection
 * @return <code>true</code> on success, <code>false</code> otherwise
 */
public boolean connect(IConnection conn,Object[] params){
  log.debug("Connect: {}",conn);
  if (hasParent() && !parent.connect(conn,params)) {
    return false;
  }
  if (hasHandler() && !getHandler().connect(conn,this,params)) {
    return false;
  }
  final IClient client=conn.getClient();
  if (!conn.isConnected()) {
    return false;
  }
  if (hasHandler() && !getHandler().join(client,this)) {
    return false;
  }
  if (!conn.isConnected()) {
    return false;
  }
  Set<IConnection> conns=clients.get(client);
  if (conns == null) {
    conns=new CopyOnWriteArraySet<IConnection>();
    clients.put(client,conns);
  }
  conns.add(conn);
  clientStats.increment();
  addEventListener(conn);
  connectionStats.increment();
  IScope connScope=conn.getScope();
  log.trace("Connection scope: {}",connScope);
  if (this.equals(connScope)) {
    final IServer server=getServer();
    if (server instanceof Server) {
      ((Server)server).notifyConnected(conn);
    }
  }
  return true;
}
 

Example 18

From project red5-server, under directory /src/org/red5/server/.

Source file: Scope.java

  19 
vote

/** 
 * Connect to scope with parameters. To successfully connect to scope it must have handler that will accept this connection with given set of parameters. Client associated with connection is added to scope clients set, connection is registered as scope event listener.
 * @param conn Connection object
 * @param params Parameters passed with connection
 * @return <code>true</code> on success, <code>false</code> otherwise
 */
public boolean connect(IConnection conn,Object[] params){
  log.debug("Connect: {}",conn);
  if (hasParent() && !parent.connect(conn,params)) {
    return false;
  }
  if (hasHandler() && !getHandler().connect(conn,this,params)) {
    return false;
  }
  final IClient client=conn.getClient();
  if (!conn.isConnected()) {
    return false;
  }
  if (hasHandler() && !getHandler().join(client,this)) {
    return false;
  }
  if (!conn.isConnected()) {
    return false;
  }
  Set<IConnection> conns=clients.get(client);
  if (conns == null) {
    conns=new CopyOnWriteArraySet<IConnection>();
    clients.put(client,conns);
  }
  conns.add(conn);
  clientStats.increment();
  addEventListener(conn);
  connectionStats.increment();
  IScope connScope=conn.getScope();
  log.trace("Connection scope: {}",connScope);
  if (this.equals(connScope)) {
    final IServer server=getServer();
    if (server instanceof Server) {
      ((Server)server).notifyConnected(conn);
    }
  }
  return true;
}
 

Example 19

From project spring-data-keyvalue, under directory /spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/.

Source file: RedisMessageListenerContainer.java

  19 
vote

private void addListener(MessageListener listener,Collection<? extends Topic> topics){
  List<byte[]> channels=new ArrayList<byte[]>(topics.size());
  List<byte[]> patterns=new ArrayList<byte[]>(topics.size());
  boolean trace=logger.isTraceEnabled();
  for (  Topic topic : topics) {
    ByteArrayWrapper holder=new ByteArrayWrapper(serializer.serialize(topic.getTopic()));
    if (topic instanceof ChannelTopic) {
      Collection<MessageListener> collection=channelMapping.get(holder);
      if (collection == null) {
        collection=new CopyOnWriteArraySet<MessageListener>();
        channelMapping.put(holder,collection);
      }
      collection.add(listener);
      channels.add(holder.getArray());
      if (trace)       logger.trace("Adding listener '" + listener + "' on channel '"+ topic.getTopic()+ "'");
    }
 else     if (topic instanceof PatternTopic) {
      Collection<MessageListener> collection=patternMapping.get(holder);
      if (collection == null) {
        collection=new CopyOnWriteArraySet<MessageListener>();
        patternMapping.put(holder,collection);
      }
      collection.add(listener);
      patterns.add(holder.getArray());
      if (trace)       logger.trace("Adding listener '" + listener + "' for pattern '"+ topic.getTopic()+ "'");
    }
 else {
      throw new IllegalArgumentException("Unknown topic type '" + topic.getClass() + "'");
    }
  }
  if (listening) {
    subscriptionTask.subscribeChannel(channels.toArray(new byte[channels.size()][]));
    subscriptionTask.subscribePattern(patterns.toArray(new byte[patterns.size()][]));
  }
}
 

Example 20

From project spring-data-redis, under directory /src/main/java/org/springframework/data/redis/listener/.

Source file: RedisMessageListenerContainer.java

  19 
vote

private void addListener(MessageListener listener,Collection<? extends Topic> topics){
  List<byte[]> channels=new ArrayList<byte[]>(topics.size());
  List<byte[]> patterns=new ArrayList<byte[]>(topics.size());
  boolean trace=logger.isTraceEnabled();
  for (  Topic topic : topics) {
    ByteArrayWrapper holder=new ByteArrayWrapper(serializer.serialize(topic.getTopic()));
    if (topic instanceof ChannelTopic) {
      Collection<MessageListener> collection=channelMapping.get(holder);
      if (collection == null) {
        collection=new CopyOnWriteArraySet<MessageListener>();
        channelMapping.put(holder,collection);
      }
      collection.add(listener);
      channels.add(holder.getArray());
      if (trace)       logger.trace("Adding listener '" + listener + "' on channel '"+ topic.getTopic()+ "'");
    }
 else     if (topic instanceof PatternTopic) {
      Collection<MessageListener> collection=patternMapping.get(holder);
      if (collection == null) {
        collection=new CopyOnWriteArraySet<MessageListener>();
        patternMapping.put(holder,collection);
      }
      collection.add(listener);
      patterns.add(holder.getArray());
      if (trace)       logger.trace("Adding listener '" + listener + "' for pattern '"+ topic.getTopic()+ "'");
    }
 else {
      throw new IllegalArgumentException("Unknown topic type '" + topic.getClass() + "'");
    }
  }
  if (listening) {
    subscriptionTask.subscribeChannel(channels.toArray(new byte[channels.size()][]));
    subscriptionTask.subscribePattern(patterns.toArray(new byte[patterns.size()][]));
  }
}
 

Example 21

From project spring-security, under directory /core/src/main/java/org/springframework/security/core/session/.

Source file: SessionRegistryImpl.java

  19 
vote

public void registerNewSession(String sessionId,Object principal){
  Assert.hasText(sessionId,"SessionId required as per interface contract");
  Assert.notNull(principal,"Principal required as per interface contract");
  if (logger.isDebugEnabled()) {
    logger.debug("Registering session " + sessionId + ", for principal "+ principal);
  }
  if (getSessionInformation(sessionId) != null) {
    removeSessionInformation(sessionId);
  }
  sessionIds.put(sessionId,new SessionInformation(principal,sessionId,new Date()));
  Set<String> sessionsUsedByPrincipal=principals.get(principal);
  if (sessionsUsedByPrincipal == null) {
    sessionsUsedByPrincipal=new CopyOnWriteArraySet<String>();
    Set<String> prevSessionsUsedByPrincipal=principals.putIfAbsent(principal,sessionsUsedByPrincipal);
    if (prevSessionsUsedByPrincipal != null) {
      sessionsUsedByPrincipal=prevSessionsUsedByPrincipal;
    }
  }
  sessionsUsedByPrincipal.add(sessionId);
  if (logger.isTraceEnabled()) {
    logger.trace("Sessions used by '" + principal + "' : "+ sessionsUsedByPrincipal);
  }
}
 

Example 22

From project SqueezeControl, under directory /src/com/squeezecontrol/.

Source file: AbstractMusicBrowserActivity.java

  19 
vote

private void setQueryString(String query){
synchronized (mLoaderThread) {
    mQueryVersion++;
    mLoadedPages=new CopyOnWriteArraySet<Integer>();
    mPageLoadQueue=new LinkedBlockingQueue<PageLoadCommand>();
  }
  mQueryString=query;
  if (query != null && query.length() > 0)   mSearchQueryPattern=Pattern.compile(query,Pattern.LITERAL | Pattern.CASE_INSENSITIVE);
 else   mSearchQueryPattern=null;
  mPageLoadQueue.add(new PageLoadCommand(mQueryVersion,0));
  mLoaderThread.interrupt();
}
 

Example 23

From project ubuntu-packaging-floodlight, under directory /src/main/java/net/floodlightcontroller/core/internal/.

Source file: Controller.java

  19 
vote

/** 
 * Initialize internal data structures
 */
public void init(Map<String,String> configParams){
  this.messageListeners=new ConcurrentHashMap<OFType,ListenerDispatcher<OFType,IOFMessageListener>>();
  this.switchListeners=new CopyOnWriteArraySet<IOFSwitchListener>();
  this.haListeners=new CopyOnWriteArraySet<IHAListener>();
  this.activeSwitches=new ConcurrentHashMap<Long,IOFSwitch>();
  this.connectedSwitches=new HashSet<OFSwitchImpl>();
  this.controllerNodeIPsCache=new HashMap<String,String>();
  this.updates=new LinkedBlockingQueue<IUpdate>();
  this.factory=new BasicFactory();
  this.providerMap=new HashMap<String,List<IInfoProvider>>();
  setConfigParams(configParams);
  this.role=getInitialRole(configParams);
  this.roleChanger=new RoleChanger();
  initVendorMessages();
  this.systemStartTime=System.currentTimeMillis();
}
 

Example 24

From project zkclient, under directory /src/main/java/org/I0Itec/zkclient/.

Source file: ZkClient.java

  19 
vote

public List<String> subscribeChildChanges(String path,IZkChildListener listener){
synchronized (_childListener) {
    Set<IZkChildListener> listeners=_childListener.get(path);
    if (listeners == null) {
      listeners=new CopyOnWriteArraySet<IZkChildListener>();
      _childListener.put(path,listeners);
    }
    listeners.add(listener);
  }
  return watchForChilds(path);
}
 

Example 25

From project zkclient_1, under directory /src/main/java/com/github/zkclient/.

Source file: ZkClient.java

  19 
vote

public List<String> subscribeChildChanges(String path,IZkChildListener listener){
synchronized (_childListener) {
    Set<IZkChildListener> listeners=_childListener.get(path);
    if (listeners == null) {
      listeners=new CopyOnWriteArraySet<IZkChildListener>();
      _childListener.put(path,listeners);
    }
    listeners.add(listener);
  }
  return watchForChilds(path);
}