Package org.apache.hadoop.hdfs.notifier

Examples of org.apache.hadoop.hdfs.notifier.NamespaceEventKey


   
    // Add only one client with one subscription
    subscriptions.add(clientId);
    core.clientQueues.put(clientId,
        new ConcurrentLinkedQueue<NamespaceNotification>());
    core.subscriptions.put(new NamespaceEventKey(event), subscriptions);
    core.clients.put(clientId, new ClientData(clientId, handler, "host", 3000));
    dispatcher.loopSleepTime = 20;
    dispatcher.assignClient(clientId);
   
    // Add a notification and wait for it to be delivered
View Full Code Here


   
    // Add only one client with one subscription
    subscriptions.add(clientId);
    core.clientQueues.put(clientId,
        new ConcurrentLinkedQueue<NamespaceNotification>());
    core.subscriptions.put(new NamespaceEventKey(event), subscriptions);
    core.subscriptions.put(new NamespaceEventKey(event2), subscriptions);
    core.clients.put(clientId, new ClientData(clientId, handler, "host", 3000));
    dispatcher.loopSleepTime = 20;
    dispatcher.assignClient(clientId);
   
    dispatcherThread.start();
View Full Code Here

   
    // Add only one client with one subscription
    subscriptions.add(clientId);
    core.clientQueues.put(clientId,
        new ConcurrentLinkedQueue<NamespaceNotification>());
    core.subscriptions.put(new NamespaceEventKey(event), subscriptions);
    core.subscriptions.put(new NamespaceEventKey(event2), subscriptions);
    core.clients.put(clientId, new ClientData(clientId, handler, "host", 3000));
    dispatcher.assignClient(clientId);
    dispatcher.loopSleepTime = 20;
   
    handler.failChance = 0.8f;
View Full Code Here

    subscriptions.add(client2Id);
    core.clientQueues.put(client1Id,
        new ConcurrentLinkedQueue<NamespaceNotification>());
    core.clientQueues.put(client2Id,
        new ConcurrentLinkedQueue<NamespaceNotification>());
    core.subscriptions.put(new NamespaceEventKey(eventCommon), subscriptions);
    subscriptions = new HashSet<Long>();
    subscriptions.add(client1Id);
    core.subscriptions.put(new NamespaceEventKey(event1), subscriptions);
    subscriptions = new HashSet<Long>();
    subscriptions.add(client2Id);
    core.subscriptions.put(new NamespaceEventKey(event2), subscriptions);
    core.clients.put(client1Id, new ClientData(client1Id, handler1, "host", 3000));
    core.clients.put(client2Id, new ClientData(client2Id, handler2, "host", 3000));
    dispatcher.assignClient(client1Id);
    dispatcher.assignClient(client2Id);
    dispatcher.loopSleepTime = 1;
View Full Code Here

   
    // Add only one client with one subscription
    subscriptions.add(clientId);
    core.clientQueues.put(clientId,
        new ConcurrentLinkedQueue<NamespaceNotification>());
    core.subscriptions.put(new NamespaceEventKey(event), subscriptions);
    core.subscriptions.put(new NamespaceEventKey(event2), subscriptions);
    core.clients.put(clientId, new ClientData(clientId, handler, "host", 3000));
    dispatcher.loopSleepTime = 20;
   
    handler.failChance = 1.0f;
    handler.failChanceDec = 1.0f;
View Full Code Here

      return clientQueues.get(clientId);
    }
   
    @Override
    public Set<Long> getClientsForNotification(NamespaceNotification n) {
      Set<Long> clients = subscriptions.get(new NamespaceEventKey(n));
      if (clients == null)
        return new HashSet<Long>();
      return null;
    }
View Full Code Here

    }
    List<String> ancestors = NotifierUtils.getAllAncestors(eventPath);
    Set<Long> clients = new HashSet<Long>();
    synchronized (subscriptions) {
      for (String path : ancestors) {
        Set<Long> clientsOnPath = subscriptions.get(new NamespaceEventKey(path, n.type));
        if (clientsOnPath != null) {
          clients.addAll(clientsOnPath);
        }
      }
    }
View Full Code Here

 
 
  @Override
  public void subscribeClient(long clientId, NamespaceEvent event, long txId)
      throws TransactionIdTooOldException, InvalidClientIdException {
    NamespaceEventKey eventKey = new NamespaceEventKey(event);
    Set<Long> clientsForEvent;
    ClientData clientData = clientsData.get(clientId);
   
    if (clientData == null) {
      LOG.warn("subscribe client called with invalid id " + clientId);
View Full Code Here

 
  @Override
  public void unsubscribeClient(long clientId, NamespaceEvent event)
      throws ClientNotSubscribedException, InvalidClientIdException {
    NamespaceEventKey eventKey = new NamespaceEventKey(event);
    Set<Long> clientsForEvent;
    ClientData clientData = clientsData.get(clientId);
   
    if (clientData == null) {
      LOG.warn("subscribe client called with invalid id " + clientId);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.notifier.NamespaceEventKey

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.