Examples of Hash


Examples of org.apache.hadoop.util.hash.Hash

    query = query.replaceAll("\\s+AND\\s+", " and ");
    query = query.replaceAll("\\s+OR\\s+", " or ");
    query = query.replaceAll("\\s+NOT\\s+", " not ");
   
    // Check to see if its in the cache
    Hash hash = MurmurHash.getInstance();
    this.hashVal = hash.hash(query.getBytes(), SEED);
    CacheEntry entry = null;
    synchronized (cache) {
      entry = (CacheEntry) cache.get(hashVal);
    }
    if (entry != null) {
View Full Code Here

Examples of org.apache.shiro.crypto.hash.Hash

    private AuthenticationInfo buildAuthenticationInfo(UsernamePasswordToken token, Object principal) {
        AuthenticationInfo authenticationInfo;
        HashingPasswordService hashService = getHashService();
        if (hashService != null) {
            Hash hash = hashService.hashPassword(token.getPassword());
            ByteSource salt = hash.getSalt();
            authenticationInfo = new SimpleAuthenticationInfo(principal, hash, salt, getName());
        } else {
            Object credentials = token.getCredentials();
            authenticationInfo = new SimpleAuthenticationInfo(principal, credentials, getName());
        }
View Full Code Here

Examples of org.auraframework.util.text.Hash

        File dest = File.createTempFile(getName(), "");

        try {
            TestCommonJavascriptGroupImpl test = new TestCommonJavascriptGroupImpl("test", newFile.getParentFile());
            Hash hash = test.getGroupHash();
            assertEquals("Unexpected hash", "1B2M2Y8AsgTpgAmY7PhCfg", hash.toString());

            // Need this sleep so the last modified time changes, otherwise the
            // test runs too fast and the test fails
            // because the last modified time was not updated by the OS
            Thread.sleep(2000);
            // Update a js file which is part of the group
            writer = new FileWriter(newFile, false);
            writer.append("var simple='bye';");
            writer.close();

            // hash value is retained after update, but recalculated when adding
            // file to the group
            hash = test.getGroupHash();
            assertEquals("Hash shouldn't be updated without a manual reset", "1B2M2Y8AsgTpgAmY7PhCfg", hash.toString());
            // just add same file to trigger
            test.addFile("testGetGroupHash.js");
            hash = test.getGroupHash();
            assertEquals("Hash should have been updated after file added to group", "4EZCacmVcFMwWJRaluefgw",
                    hash.toString());

            // hash value doesn't change when adding empty directory to group
            test.addDirectory("testDir");
            hash = test.getGroupHash();
            assertEquals("Hash should not have changed after adding empty directory to group",
                    "4EZCacmVcFMwWJRaluefgw", hash.toString());

            // hash value should change when adding non-empty directory to group
            writer = new FileWriter(nestedFile, false);
            try {
                writer.append("var simple='sayonara';");
                writer.flush();
            } finally {
                writer.close();
            }

            test.addDirectory("testDir");
            hash = test.getGroupHash();
            assertEquals("Hash should have been updated after adding non-empty directory to group",
                    "CUadD1uu9gF9HA_AFPb0Cg", hash.toString());
        } finally {
            IOUtil.delete(dest);
            IOUtil.delete(nestedFile.getParentFile());
            newFile.delete();
        }
View Full Code Here

Examples of org.cx4a.rsense.typing.runtime.Hash

                    Collection<IRubyObject> arg = null;
                    TypeSet ts = new TypeSet();
                    for (IRubyObject receiver : receivers) {
                        if (receiver instanceof Hash) {
                            if (args != null && args.length > 0) {
                                Hash hash = (Hash) receiver;
                                Object key = Hash.getRealKey(args[0].getNode());
                                if (!hash.isModified() && key != null) {
                                    Vertex v = hash.get(key);
                                    if (v != null) {
                                        ts.addAll(v.getTypeSet());
                                    }
                                }
                            }
View Full Code Here

Examples of org.infinispan.commons.hash.Hash

      int[] numSegments = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
      int[] numNodes = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000};
      int[] numOwners = {1, 2, 3, 5};

      ConsistentHashFactory<DefaultConsistentHash> chf = createConsistentHashFactory();
      Hash hashFunction = new MurmurHash3();

      for (int nn : numNodes) {
         List<Address> nodes = new ArrayList<Address>(nn);
         for (int j = 0; j < nn; j++) {
            nodes.add(new TestAddress(j));
View Full Code Here

Examples of org.infinispan.commons.hash.Hash

      // * num_owners(s) == numOwners, for each segment s
      // * floor(numSegments/numNodes) <= num_segments_primary_owned(n) for each node n
      // * num_segments_primary_owned(n) <= ceil(numSegments/numNodes) for each node n
      // * floor(numSegments*numOwners/numNodes) <= num_segments_owned(n) for each node n
      // * num_segments_owned(n) <= ceil(numSegments*numOwners/numNodes) for each node n
      Hash hashFunction = baseCH.getHashFunction();

      Builder builder = new Builder(baseCH);
      rebalanceBuilder(builder);

      DefaultConsistentHash balancedCH = builder.build(hashFunction);
View Full Code Here

Examples of org.infinispan.commons.hash.Hash

      @SuppressWarnings("unchecked")
      public DefaultConsistentHash readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         int numSegments = unmarshaller.readInt();
         int numOwners = unmarshaller.readInt();
         List<Address> members = (List<Address>) unmarshaller.readObject();
         Hash hash = (Hash) unmarshaller.readObject();
         List<Address>[] owners = (List<Address>[]) unmarshaller.readObject();

         return new DefaultConsistentHash(hash, numOwners, numSegments, members, owners);
      }
View Full Code Here

Examples of org.infinispan.commons.hash.Hash

      // * num_owners(s) == numOwners, for each segment s
      // * floor(numSegments/numNodes) <= num_segments_primary_owned(n) for each node n
      // * num_segments_primary_owned(n) <= ceil(numSegments/numNodes) for each node n
      // * floor(numSegments*numOwners/numNodes) <= num_segments_owned(n) for each node n
      // * num_segments_owned(n) <= ceil(numSegments*numOwners/numNodes) for each node n
      Hash hashFunction = baseCH.getHashFunction();

      Builder builder = new Builder(baseCH);
      rebalanceBuilder(builder);

      DefaultConsistentHash balancedCH = builder.build(hashFunction);
View Full Code Here

Examples of org.infinispan.commons.hash.Hash

      int[] numSegments = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
      int[] numNodes = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000};
      int[] numOwners = {1, 2, 3, 5};

      ConsistentHashFactory<DefaultConsistentHash> chf = createConsistentHashFactory();
      Hash hashFunction = new MurmurHash3();

      for (int nn : numNodes) {
         List<Address> nodes = new ArrayList<Address>(nn);
         for (int j = 0; j < nn; j++) {
            nodes.add(new TestAddress(j));
View Full Code Here

Examples of org.infinispan.commons.hash.Hash

      public DefaultConsistentHash readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         int numSegments = unmarshaller.readInt();
         int numOwners = unmarshaller.readInt();
         List<Address> members = (List<Address>) unmarshaller.readObject();
         Map<Address, Float> capacityFactors = (Map<Address, Float>)unmarshaller.readObject();
         Hash hash = (Hash) unmarshaller.readObject();
         List<Address>[] owners = (List<Address>[]) unmarshaller.readObject();

         return new DefaultConsistentHash(hash, numOwners, numSegments, members, capacityFactors, owners);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.