Exemplo n.º 1
0
 public void deserialize(InputArchive ia, String tag) throws IOException {
   deserializeList(longKeyMap, ia);
   nodes.clear();
   String path = ia.readString("path");
   while (!path.equals("/")) {
     DataNode node = new DataNode();
     ia.readRecord(node, "node");
     nodes.put(path, node);
     int lastSlash = path.lastIndexOf('/');
     if (lastSlash == -1) {
       root = node;
     } else {
       String parentPath = path.substring(0, lastSlash);
       node.parent = nodes.get(parentPath);
       node.parent.children.add(path.substring(lastSlash + 1));
       long eowner = node.stat.getEphemeralOwner();
       if (eowner != 0) {
         HashSet<String> list = ephemerals.get(eowner);
         if (list == null) {
           list = new HashSet<String>();
           ephemerals.put(eowner, list);
         }
         list.add(path);
       }
     }
     path = ia.readString("path");
   }
   nodes.put("/", root);
   // we are done with deserializing the
   // the datatree
   // update the quotas - create path trie
   // and also update the stat nodes
   setupQuota();
 }
Exemplo n.º 2
0
 public SipChannel createSipChannel(JID sender, SocketAddress destination) throws IOException {
   final SipChannel c =
       new SipChannel(getSipChannelID(sender), destination, localSipIp, localSipPort, this);
   channels.put(getSipChannelID(sender), c);
   iChannels.put(c.getDatagramChannel().hashCode(), c);
   return c;
 }
 private void addup() {
   if (!map.containsKey(KEY)) {
     map.put(KEY, 1);
   } else {
     map.put(KEY, map.get(KEY) + 1);
   }
 }
Exemplo n.º 4
0
  /**
   * update the distance vectors from the message and refresh the routing table
   *
   * @param msg
   */
  public void updateRouteFromMsg(PA2TCP msg) {
    // payload: 192.168.0.8:1111=323;192.168.0.8:2323 223

    String sourceAddress = msg.sourceAddress;
    if (!neighbors.containsKey(sourceAddress)) {
      return;
    }
    lastHeardTimeTable.put(sourceAddress, new Date().getTime());

    // if the source neighbor is set to close(INFINITE_COST), recover the link
    if (neighbors.get(sourceAddress) == PA2Util.INFINTE_COST) {
      neighbors.put(sourceAddress, neighborsBackup.get(sourceAddress));
    }

    String[] tmp = new String(msg.payloadData).split(";");
    ConcurrentHashMap<String, Double> neighborCostTable = new ConcurrentHashMap<String, Double>();
    for (int i = 0; i < tmp.length; i++) {
      String[] item = tmp[i].split("=");
      if (item[1].startsWith(PA2Util.INFINITY_TAG)) {
        neighborCostTable.put(item[0], PA2Util.INFINTE_COST);
      } else {
        neighborCostTable.put(item[0], Double.valueOf(item[1]));
      }
    }

    bfCostTable.replace(sourceAddress, neighborCostTable);

    if (refreshBFCostTable(sourceAddress)) {
      sendVectorsToNeighbors();
    }
  }
Exemplo n.º 5
0
 public FireJet(Player player) {
   if (instances.containsKey(player)) {
     // player.setAllowFlight(canfly);
     instances.remove(player);
     return;
   }
   if (timers.containsKey(player)) {
     if (System.currentTimeMillis()
         < timers.get(player)
             + (long) ((double) cooldown / Tools.getFirebendingDayAugment(player.getWorld()))) {
       return;
     }
   }
   factor = Tools.firebendingDayAugment(defaultfactor, player.getWorld());
   Block block = player.getLocation().getBlock();
   if (FireStream.isIgnitable(player, block)
       || block.getType() == Material.AIR
       || AvatarState.isAvatarState(player)) {
     player.setVelocity(
         player.getEyeLocation().getDirection().clone().normalize().multiply(factor));
     block.setType(Material.FIRE);
     this.player = player;
     // canfly = player.getAllowFlight();
     player.setAllowFlight(true);
     time = System.currentTimeMillis();
     timers.put(player, time);
     instances.put(player, this);
   }
 }
  public void processDiscoInfoResponse(JID from, String id, List<Element> identities)
      throws ComponentException {
    String originatingServer = remoteServerInfoRequestIds.get(id);
    if (originatingServer == null) {
      return;
    }
    remoteServerInfoRequestIds.remove(id);
    remoteServerItemsToProcess.put(
        originatingServer, remoteServerItemsToProcess.get(originatingServer) - 1);

    String identityType;
    for (Element identity : identities) {
      identityType = identity.attributeValue("type");
      if (identityType != null && identityType.equals(IDENTITY_TYPE_CHANNELS)) {
        setDiscoveredServer(originatingServer, from.toString());
        sendFederatedRequests(originatingServer);
      }
    }

    if (remoteServerItemsToProcess.get(originatingServer) < 1) {
      if (!discoveredServers.containsKey(originatingServer)) {
        sendRemoteChannelServerNotFoundErrorResponses(originatingServer);
        remoteChannelDiscoveryStatus.put(originatingServer, NO_CHANNEL_SERVER);
        waitingStanzas.remove(originatingServer);
      } else {
        remoteChannelDiscoveryStatus.put(originatingServer, DISCOVERED);
      }
    }
  }
  private ConcurrentHashMap<Long, Book> seedData() {
    ConcurrentHashMap<Long, Book> bookMap = new ConcurrentHashMap<Long, Book>();
    Book book = new Book();
    book.setIsbn(1);
    book.setCategory("computer");
    book.setTitle("Java Concurrency in Practice");
    try {
      book.setCoverimage(new URL("http://goo.gl/N96GJN"));
    } catch (MalformedURLException e) {
      // eat the exception
    }
    bookMap.put(book.getIsbn(), book);

    book = new Book();
    book.setIsbn(2);
    book.setCategory("computer");
    book.setTitle("Restful Web Services");
    try {
      book.setCoverimage(new URL("http://goo.gl/ZGmzoJ"));
    } catch (MalformedURLException e) {
      // eat the exception
    }
    bookMap.put(book.getIsbn(), book);

    return bookMap;
  }
Exemplo n.º 8
0
 public static boolean updateExpired(final String world) {
   updatingPlots.put(world, true);
   final long now = System.currentTimeMillis();
   if (now > getTimeStamp(world)) {
     timestamp.put(world, now + 86400000l);
     TaskManager.runTaskAsync(
         new Runnable() {
           @Override
           public void run() {
             try {
               final List<Plot> plots = getOldPlots(world);
               PS.debug(
                   "$2[&5Expire&dManager$2] $4Found "
                       + plots.size()
                       + " expired plots for "
                       + world
                       + "!");
               expiredPlots.put(world, plots);
               updatingPlots.put(world, false);
             } catch (Exception e) {
               e.printStackTrace();
             }
           }
         });
     return true;
   } else {
     updatingPlots.put(world, false);
     return false;
   }
 }
  public void processDiscoItemsResponse(JID from, List<Element> items) throws ComponentException {

    for (Element item : items) {
      Attribute name = item.attribute("name");
      if (name != null && name.getStringValue().equals(BUDDYCLOUD_SERVER)) {
        remoteChannelDiscoveryStatus.put(from.toString(), DISCOVERED);
        setDiscoveredServer(from.toString(), item.attributeValue("jid"));
        sendFederatedRequests(from.toString());
        return;
      }
    }
    IQ infoRequest = new IQ(IQ.Type.get);
    infoRequest.setFrom(localServer);
    infoRequest.getElement().addElement("query", JabberPubsub.NS_DISCO_INFO);

    remoteServerItemsToProcess.put(from.toString(), items.size());
    String infoRequestId;
    for (Element item : items) {
      infoRequestId = getId() + ":info";
      infoRequest.setTo(item.attributeValue("jid"));
      infoRequest.setID(infoRequestId);
      remoteServerInfoRequestIds.put(infoRequestId, from.toString());
      component.sendPacket(infoRequest.createCopy());
    }
    remoteChannelDiscoveryStatus.put(from.toString(), DISCO_INFO);
  }
Exemplo n.º 10
0
  public List<Events> getEventsByParams() {
    ConcurrentHashMap<Integer, Events> eventBeforeSearch =
        AppStorage.INSTANCE.getEventStorageCopy();
    ConcurrentHashMap<Integer, Events> eventAfterSearch = new ConcurrentHashMap<Integer, Events>();
    if (city != null && city.length() != 0) {
      for (Map.Entry<Integer, Events> entry : eventBeforeSearch.entrySet()) {
        if (city.equalsIgnoreCase(entry.getValue().getCity()))
          eventAfterSearch.put(entry.getKey(), entry.getValue());
      }
    }
    eventBeforeSearch.clear();
    eventBeforeSearch = AppStorage.INSTANCE.getEventStorageCopy();

    if (description != null && description.length() > 0 && !description.equals("")) {
      eventAfterSearch.clear();
      for (Map.Entry<Integer, Events> entry : eventBeforeSearch.entrySet()) {
        if (entry.getValue().getDescription().contains(description))
          eventAfterSearch.put(entry.getKey(), entry.getValue());
      }
    }
    eventBeforeSearch = new ConcurrentHashMap<Integer, Events>(eventAfterSearch);

    /*   if(date != null){
            for(Map.Entry<Integer,Events> entry : eventBeforeSearch.entrySet()){
                GregorianCalendar eventDate = entry.getValue().getDate();
                GregorianCalendar before = new GregorianCalendar(eventDate.get(1),eventDate.get(2),eventDate.get(4)+1);
                GregorianCalendar after = new GregorianCalendar(eventDate.get(1),eventDate.get(2),eventDate.get(4));
                if(date.after(after) && date.before(before)) eventAfterSearch.put(entry.getKey(),entry.getValue());
            }
        }
    */ return new ArrayList<Events>(eventAfterSearch.values());
  }
Exemplo n.º 11
0
  /** 解析Intent */
  private void parseIntent(final Intent intent) {
    final Bundle arguments = intent.getExtras();
    if (arguments != null) {
      if (arguments.containsKey(EXTRA_DIRECTORY)) {
        String directory = arguments.getString(EXTRA_DIRECTORY);
        Logger.i("onStartCommand:" + directory);
        // 扫描文件夹
        if (!mScanMap.containsKey(directory)) mScanMap.put(directory, "");
      } else if (arguments.containsKey(EXTRA_FILE_PATH)) {
        // 单文件
        String filePath = arguments.getString(EXTRA_FILE_PATH);
        Logger.i("onStartCommand:" + filePath);
        if (!StringUtils.isEmpty(filePath)) {
          if (!mScanMap.containsKey(filePath))
            mScanMap.put(filePath, arguments.getString(EXTRA_MIME_TYPE));
          //					scanFile(filePath, arguments.getString(EXTRA_MIME_TYPE));
        }
      }
    }

    if (mServiceStatus == SCAN_STATUS_NORMAL || mServiceStatus == SCAN_STATUS_END) {
      new Thread(this).start();
      // scan();
    }
  }
Exemplo n.º 12
0
  @EventHandler(priority = Byte.MAX_VALUE)
  public void onJoin(PostLoginEvent e) {

    Player player = new Player(e.getPlayer());
    uuidMap.put(e.getPlayer().getUniqueId(), player);
    nameMap.put(e.getPlayer().getName(), player);
  }
 public void testConcurrentHashMap() throws Exception {
   ConcurrentHashMap map = new ConcurrentHashMap();
   map.put(1, "v1");
   map.put(2, "v2");
   map.put(3, "v3");
   marshallAndAssertEquality(map);
 }
Exemplo n.º 14
0
  @Test
  public void testSocket2UserPersistence() throws IOException, ClassNotFoundException {
    socketid2user.put(
        UUID.randomUUID(),
        new User(new UsernamePasswordAuthenticationToken("ptsr00", UUID.randomUUID())));
    socketid2user.put(UUID.randomUUID(), new User(new AttributePrincipalImpl("ptstr0")));

    Map<String, Object> attributes = new HashMap<String, Object>();
    attributes.put(Google2AttributesDefinition.EMAIL, "*****@*****.**");
    Google2Profile profile = new Google2Profile("ptsr00", attributes);

    socketid2user.put(UUID.randomUUID(), new User(profile));
    List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
    authorities.add(new SimpleGrantedAuthority("ROLE_GUEST"));
    socketid2user.put(
        UUID.randomUUID(),
        new User(new AnonymousAuthenticationToken("ptsr00", UUID.randomUUID(), authorities)));

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ObjectOutputStream objOut = new ObjectOutputStream(out);
    objOut.writeObject(socketid2user);
    objOut.close();
    ObjectInputStream objIn = new ObjectInputStream(new ByteArrayInputStream(out.toByteArray()));
    Map<UUID, String> actual = (Map<UUID, String>) objIn.readObject();
    assertEquals(actual, socketid2user);
  }
Exemplo n.º 15
0
 public static boolean addVSensorInstance(VirtualSensor sensorPool) {
   try {
     if (logger.isInfoEnabled())
       logger.info(
           (new StringBuilder("Testing the pool for :"))
               .append(sensorPool.getConfig().getName())
               .toString());
     sensorPool.returnVS(sensorPool.borrowVS());
   } catch (Exception e) {
     logger.error(e.getMessage(), e);
     sensorPool.closePool();
     logger.error(
         "GSN can't load the virtual sensor specified at "
             + sensorPool.getConfig().getFileName()
             + " because the initialization of the virtual sensor failed (see above exception).");
     logger.error("Please fix the following error");
     return false;
   }
   TreeMap<String, Boolean> vsNameToOutputStructureFields = new TreeMap<String, Boolean>();
   vsNamesToOutputStructureFields.put(
       sensorPool.getConfig().getName(), vsNameToOutputStructureFields);
   for (DataField fields : sensorPool.getConfig().getOutputStructure())
     vsNameToOutputStructureFields.put(fields.getName(), Boolean.TRUE);
   vsNameToOutputStructureFields.put("timed", Boolean.TRUE);
   vsNameTOVSConfig.put(sensorPool.getConfig().getName(), sensorPool.getConfig());
   fileNameToVSInstance.put(sensorPool.getConfig().getFileName(), sensorPool);
   return true;
 }
Exemplo n.º 16
0
  /**
   * @param request
   * @param connection
   * @return
   */
  public LogicalNode handleSubscriberRequest(
      SubscribeRequestTuple request, AbstractLengthPrependerClient connection) {
    String identifier = request.getIdentifier();
    String type = request.getStreamType();
    String upstream_identifier = request.getUpstreamIdentifier();

    // Check if there is a logical node of this type, if not create it.
    LogicalNode ln;
    if (subscriberGroups.containsKey(type)) {
      // logger.debug("adding to exiting group = {}", subscriberGroups.get(type));
      /*
       * close previous connection with the same identifier which is guaranteed to be unique.
       */
      AbstractLengthPrependerClient previous = subscriberChannels.put(identifier, connection);
      if (previous != null) {
        eventloop.disconnect(previous);
      }

      ln = subscriberGroups.get(type);
      ln.boot(eventloop);
      ln.addConnection(connection);
    } else {
      /*
       * if there is already a datalist registered for the type in which this client is interested,
       * then get a iterator on the data items of that data list. If the datalist is not registered,
       * then create one and register it. Hopefully this one would be used by future upstream nodes.
       */
      DataList dl;
      if (publisherBuffers.containsKey(upstream_identifier)) {
        dl = publisherBuffers.get(upstream_identifier);
        // logger.debug("old list = {}", dl);
      } else {
        dl =
            Tuple.FAST_VERSION.equals(request.getVersion())
                ? new FastDataList(upstream_identifier, blockSize, numberOfCacheBlocks)
                : new DataList(upstream_identifier, blockSize, numberOfCacheBlocks);
        publisherBuffers.put(upstream_identifier, dl);
        // logger.debug("new list = {}", dl);
      }

      long skipWindowId = (long) request.getBaseSeconds() << 32 | request.getWindowId();
      ln =
          new LogicalNode(
              upstream_identifier, type, dl.newIterator(identifier, skipWindowId), skipWindowId);

      int mask = request.getMask();
      if (mask != 0) {
        for (Integer bs : request.getPartitions()) {
          ln.addPartition(bs, mask);
        }
      }

      subscriberGroups.put(type, ln);
      ln.addConnection(connection);
      dl.addDataListener(ln);
    }

    return ln;
  }
Exemplo n.º 17
0
 private void loadShops() {
   stopShopCheck();
   shops.clear();
   FileConfiguration sh = hc.gYH().gFC("shops");
   if (!useShops) {
     Shop shop =
         new ServerShop("GlobalShop", getGlobalShopAccount().getEconomy(), getGlobalShopAccount());
     shop.setGlobal();
     shops.put("GlobalShop", shop);
     return;
   }
   Iterator<String> it = sh.getKeys(false).iterator();
   while (it.hasNext()) {
     Object element = it.next();
     String name = element.toString();
     if (name.equalsIgnoreCase("GlobalShop")) {
       continue;
     }
     String owner = sh.getString(name + ".owner");
     String economy = sh.getString(name + ".economy");
     if (owner == null) {
       owner = getGlobalShopAccount().getName();
     }
     if (owner.equalsIgnoreCase(getGlobalShopAccount().getName())) {
       Shop shop = new ServerShop(name, economy, getHyperPlayer(owner));
       shop.setPoint1(
           sh.getString(name + ".world"),
           sh.getInt(name + ".p1.x"),
           sh.getInt(name + ".p1.y"),
           sh.getInt(name + ".p1.z"));
       shop.setPoint2(
           sh.getString(name + ".world"),
           sh.getInt(name + ".p2.x"),
           sh.getInt(name + ".p2.y"),
           sh.getInt(name + ".p2.z"));
       shop.setMessage1(sh.getString(name + ".shopmessage1"));
       shop.setMessage2(sh.getString(name + ".shopmessage2"));
       shops.put(name, shop);
     } else {
       if (hc.gYH().gFC("config").getBoolean("config.use-player-shops")) {
         Shop shop = new PlayerShop(name, economy, getHyperPlayer(owner));
         shop.setPoint1(
             sh.getString(name + ".world"),
             sh.getInt(name + ".p1.x"),
             sh.getInt(name + ".p1.y"),
             sh.getInt(name + ".p1.z"));
         shop.setPoint2(
             sh.getString(name + ".world"),
             sh.getInt(name + ".p2.x"),
             sh.getInt(name + ".p2.y"),
             sh.getInt(name + ".p2.z"));
         shop.setMessage1(sh.getString(name + ".shopmessage1"));
         shop.setMessage2(sh.getString(name + ".shopmessage2"));
         shops.put(name, shop);
       }
     }
   }
   startShopCheck();
 }
Exemplo n.º 18
0
 @Override
 public void add(T item) {
   if (!histogram.containsKey(item)) {
     histogram.put((Long) item, 0);
   }
   int currentCount = histogram.get(item);
   histogram.put((Long) item, currentCount + 1);
 }
Exemplo n.º 19
0
 public void add(String key) {
   Integer value = map.get(key);
   if (value == null) {
     map.put(key, 1);
   } else {
     map.put(key, value + 1);
   }
 }
Exemplo n.º 20
0
 @Override
 @JsonIgnore
 public void setPort(OFPhysicalPort port) {
   synchronized (portLock) {
     portsByNumber.put(port.getPortNumber(), port);
     portsByName.put(port.getName(), port);
   }
 }
Exemplo n.º 21
0
 static {
   enabledTags = new ConcurrentHashMap<String, Integer>();
   enabledTags.put(Log.TAG_SQLiteConnection, WARN);
   enabledTags.put(Log.TAG_SQLiteConnectionPool, WARN);
   enabledTags.put(Log.TAG_SQLiteDatabase, WARN);
   enabledTags.put(Log.TAG_SQLiteQueryBuilder, WARN);
   enabledTags.put(Log.TAG_SQLiteQueryCursor, WARN);
 }
Exemplo n.º 22
0
 /**
  * Authorizes a request token for given principal and roles and returns verifier.
  *
  * @param token Request token to authorize.
  * @param userPrincipal User principal to authorize the token for.
  * @param roles Set of roles to authorize the token for.
  * @return OAuth verifier value for exchanging this token for an access token.
  */
 public String authorizeToken(
     final Token token, final Principal userPrincipal, final Set<String> roles) {
   final Token authorized = token.authorize(userPrincipal, roles);
   requestTokenByTokenString.put(token.getToken(), authorized);
   final String verifier = newUUIDString();
   verifierByTokenString.put(token.getToken(), verifier);
   return verifier;
 }
Exemplo n.º 23
0
 public User createUser(String userName, String host) {
   if (getUserByName(userName) != null) {
     return null; // user already exists
   }
   User user = new User(userName, host);
   users.put(user.getId(), user);
   usersByName.put(userName, user);
   return user;
 }
Exemplo n.º 24
0
  public void deploy(URL url, boolean master, ClassLoader cL, String remoteHost) {
    try {
      FileObject filetoScan = fsManager.resolveFile("jar:" + url.toString() + "!/");
      HashSet<Class<?>>[] classes = new HashSet[] {new HashSet()};

      VFSClassLoader jarCL;

      if (cL != null) {
        jarCL = new VFSClassLoader(new FileObject[] {filetoScan}, fsManager, cL);
      } else {
        jarCL =
            new VFSClassLoader(
                new FileObject[] {filetoScan},
                fsManager,
                Thread.currentThread().getContextClassLoader());
      }
      Class[] annot = new Class[] {DeployRMI.class};
      scanJar(filetoScan, classes, annot, jarCL);
      for (Class<?> rmiClass : classes[0]) {
        DeployRMI rmiAnnot = rmiClass.getAnnotation(DeployRMI.class);
        if (master) {
          rmiProxyHandler = new RMIProxyHandler(rmiAnnot.jndiBinding(), remoteObjects);
          rmiproxy =
              Proxy.newProxyInstance(
                  rmiClass.getClassLoader(), rmiClass.getInterfaces(), rmiProxyHandler);
          remoteobj =
              UnicastRemoteObject.exportObject(
                  (Remote) rmiproxy, Integer.parseInt(serverConfig.getRmiregistryport()));
          rmiproxyObjs.put(rmiAnnot.jndiBinding(), rmiproxy);
          rmiproxyHandler.put(rmiAnnot.jndiBinding(), rmiProxyHandler);
          remoteProxyObjs.put(rmiAnnot.jndiBinding(), remoteobj);
          ic.bind("java:/" + rmiAnnot.jndiBinding(), remoteobj);
          registry.bind(rmiAnnot.jndiBinding(), (Remote) remoteobj);
          cLMap.put(rmiAnnot.jndiBinding(), jarCL);
        } else {
          Remote remoteObj = (Remote) rmiClass.newInstance();
          remoteSlaveObjs.put(rmiAnnot.jndiBinding(), remoteObj);
          Object remoteobj =
              UnicastRemoteObject.exportObject(
                  (Remote) remoteObj, Integer.parseInt(serverConfig.getRmiregistryport()));
          ic.bind("java:/" + rmiAnnot.jndiBinding(), remoteobj);
          registry.bind(rmiAnnot.jndiBinding(), (Remote) remoteobj);
          if (remoteObjects.get(rmiAnnot.jndiBinding()) != null) {
            ConcurrentMap<String, Remote> remoteObjs = remoteObjects.get(rmiAnnot.jndiBinding());
            remoteObjs.put(remoteHost, (Remote) remoteobj);
          } else {
            ConcurrentHashMap<String, Remote> remoteObjs = new ConcurrentHashMap<String, Remote>();
            remoteObjs.put(remoteHost, (Remote) remoteobj);
            remoteObjects.put(rmiAnnot.jndiBinding(), remoteObjs);
          }
        }
      }
    } catch (Exception e) {
      log.error("unable to deploy the package " + url, e);
    }
  }
Exemplo n.º 25
0
 @Override
 public void run() {
   if (!originalPath.equals(pathField.getText())
       || originalSize != ((Integer) sizeSpinner.getValue())) {
     ConcurrentHashMap map = new ConcurrentHashMap();
     map.put(fontPathKey, pathField.getText());
     map.put(fontSizeKey, sizeSpinner.getValue());
     Config.put(map);
   }
 }
 public void put(K1 key1, K2 key2, V value) {
   if (k1_k2V_map.containsKey(key1)) {
     ConcurrentHashMap<K2, V> k2V_map = k1_k2V_map.get(key1);
     k2V_map.put(key2, value);
   } else {
     ConcurrentHashMap<K2, V> k2V_map = new ConcurrentHashMap<K2, V>();
     k2V_map.put(key2, value);
     k1_k2V_map.put(key1, k2V_map);
   }
 }
Exemplo n.º 27
0
 /**
  * Add an {@link Album} to this object
  *
  * @param album the {@link Album} to be added
  */
 public void addAlbum(Album album, boolean isLocalAlbum) {
   String key = TomahawkUtils.getCacheKey(album);
   synchronized (this) {
     if (!mAlbums.containsKey(key)) {
       mAlbums.put(key, album);
       if (isLocalAlbum) {
         mLocalAlbums.put(key, album);
       }
     }
   }
 }
 @Override
 public void setup(Meeting m) {
   validateAttendees(m);
   Recipients r = new Recipients(m.getAttendees(), "");
   HashSet<String> allAttendees = r.getListOfAllTargetRecipients();
   attendees.put(m.getFrom(), InvitationStatus.ACCEPTED);
   for (String s : allAttendees) {
     attendees.put(s, InvitationStatus.INVITED);
   }
   meetingID = m.getId();
 }
Exemplo n.º 29
0
 public static synchronized void m7631a(String str) {
   synchronized (C1512c.class) {
     ConcurrentHashMap concurrentHashMap = MyApplication.m6445a().f4175f;
     if (concurrentHashMap.containsKey(str)) {
       concurrentHashMap.put(
           str, Integer.valueOf(((Integer) concurrentHashMap.remove(str)).intValue() + 1));
     } else {
       concurrentHashMap.put(str, Integer.valueOf(1));
     }
   }
 }
 public void printEncryptionMessage(EncryptionEvent event) {
   if (event.geteORd().equals("Encryption")) {
     if (!databaseE.containsKey(event.getFile())) {
       databaseE.put(event.getFile(), event);
       if (event.getFile().toLowerCase().endsWith(".txt")) {
         System.out.print("The Encryption of the file " + event.getFile() + " was started.\n");
       } else {
         System.out.print("The Encryption of the folder " + event.getFile() + " was started.\n");
       }
     } else {
       EncryptionEvent preEvent = databaseE.get(event.getFile());
       long t = event.getCurrentTime() - preEvent.getCurrentTime();
       String T = String.valueOf(t);
       if (event.getFile().toLowerCase().endsWith(".txt")) {
         System.out.println("The encryption for file " + preEvent.getFile());
         System.out.println("The encryption used the algorithm " + preEvent.getAlgorithm());
         System.out.println("The encryption took " + T + " milliseconds.");
         System.out.println("The encrtpted file is located in file " + preEvent.getOutputFile());
       } else {
         System.out.println("The encryption of the folder " + preEvent.getFile());
         System.out.println("The encryption used the algorithm " + preEvent.getAlgorithm());
         System.out.println("The whole encryption took " + T + " milliseconds.");
         System.out.println("The encrtpted folder is located in " + preEvent.getOutputFile());
       }
     }
   }
   if (event.geteORd() == "Decryption") {
     if (event.getAlgorithm() != null) {
       databaseD.put(event.getFile(), event);
       if (event.getFile().toLowerCase().endsWith(".txt")) {
         System.out.print("The Decryption of the file " + event.getFile() + " was started.\n");
       } else {
         System.out.print("The Decryption of the folder " + event.getFile() + " was started.\n");
       }
     } else {
       EncryptionEvent preEvent = databaseD.get(event.getFile());
       long t = event.getCurrentTime() - preEvent.getCurrentTime();
       String T = String.valueOf(t);
       if (event.getFile().toLowerCase().endsWith(".txt")) {
         System.out.println("The decryption for file " + preEvent.getFile());
         System.out.println("The decryption used the algorithm " + preEvent.getAlgorithm());
         System.out.println("The decryption took " + T + " milliseconds.");
         System.out.println("The decrtpted file is located in file " + preEvent.getOutputFile());
       } else {
         System.out.println("The decryption of the folder " + preEvent.getFile());
         System.out.println("The decryption used the algorithm " + preEvent.getAlgorithm());
         System.out.println("The whole decryption took " + T + " milliseconds.");
         System.out.println("The decrtpted folder is located in " + preEvent.getOutputFile());
       }
     }
   }
 }