Examples of Hash


Examples of org.infinispan.commons.hash.Hash

      }

      @Override
      @SuppressWarnings("unchecked")
      public ReplicatedConsistentHash readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         Hash hashFunction = (Hash) unmarshaller.readObject();
         List<Address> members = (List<Address>) unmarshaller.readObject();
         int[] primaryOwners = (int[]) unmarshaller.readObject();
         return new ReplicatedConsistentHash(hashFunction, members, primaryOwners);
      }
View Full Code Here

Examples of org.infinispan.commons.hash.Hash

      }

      @Override
      public CacheJoinInfo readObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException {
         ConsistentHashFactory consistentHashFactory = (ConsistentHashFactory) unmarshaller.readObject();
         Hash hashFunction = (Hash) unmarshaller.readObject();
         int numSegments = unmarshaller.readInt();
         int numOwners = unmarshaller.readInt();
         long timeout = unmarshaller.readLong();
         boolean totalOrder = unmarshaller.readBoolean();
         boolean distributed = unmarshaller.readBoolean();
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.util.hash.Hash

   }

   private static ConsistentHash constructConsistentHashInstance(Configuration c) {
      ConsistentHash ch = (ConsistentHash) Util.getInstance(c.getConsistentHashClass(), c.getClassLoader());
      if (ch instanceof AbstractWheelConsistentHash) {
         Hash h = (Hash) Util.getInstance(c.getHashFunctionClass(), c.getClassLoader());
         AbstractWheelConsistentHash wch = (AbstractWheelConsistentHash) ch;
         wch.setHashFunction(h);
         wch.setNumVirtualNodes(c.getNumVirtualNodes());
      }
      if (ch instanceof AbstractConsistentHash) {
View Full Code Here

Examples of org.infinispan.util.hash.Hash

    * @param template An older consistent hash instance to clone
    * @param addresses with which to populate the consistent hash
    * @return a new consistent hash instance
    */
   public static ConsistentHash createConsistentHash(ConsistentHash template, Collection<Address> addresses) {
      Hash hf = null;
      int numVirtualNodes = 1;
      GroupManager groupManager = null;
      if (template instanceof AbstractWheelConsistentHash) {
         AbstractWheelConsistentHash wTemplate = (AbstractWheelConsistentHash) template;
         hf = wTemplate.hashFunction;
View Full Code Here

Examples of org.infinispan.util.hash.Hash

   }

   private static ConsistentHash constructConsistentHashInstance(Configuration c) {
      ConsistentHash ch = (ConsistentHash) Util.getInstance(c.getConsistentHashClass());
      if (ch instanceof AbstractWheelConsistentHash) {
         Hash h = (Hash) Util.getInstance(c.getHashFunctionClass());
         ((AbstractWheelConsistentHash) ch).setHashFunction(h);
      }
      return ch;
   }
View Full Code Here

Examples of org.infinispan.util.hash.Hash

    * @param addresses with which to populate the consistent hash
    * @param topologyInfo
    * @return a new consistent hash instance
    */
   public static ConsistentHash createConsistentHash(ConsistentHash template, List<Address> addresses, TopologyInfo topologyInfo) {
      Hash hf = null;
      if (template instanceof AbstractWheelConsistentHash) {
         hf = ((AbstractWheelConsistentHash) template).hashFunction;
      }
      ConsistentHash ch = constructConsistentHashInstance(template.getClass(), hf);
      if (addresses != null && !addresses.isEmpty())  ch.setCaches(addresses);
View Full Code Here

Examples of org.jboss.seam.wiki.util.Hash

    public String getArchiveCacheKeyAppendix() {
        StringBuilder builder = new StringBuilder();
        if (tag != null && Math.abs(tag.hashCode()) != 0) builder.append(Math.abs(tag.hashCode()));
        builder.append(WikiUtil.dateAsString(year, month, day));
        Hash hash = (Hash)Component.getInstance(Hash.class);
        return hash.hash(builder.toString());
    }
View Full Code Here

Examples of org.jboss.seam.wiki.util.Hash

    }

    public String getCacheKey(Object... objects) {
        WikiDocument currentDocument = (WikiDocument)Component.getInstance("currentDocument");
        Integer accessLevel = (Integer) Component.getInstance("currentAccessLevel");
        Hash hash = (Hash)Component.getInstance(Hash.class);

        log.debug("generating cache key for document: " + currentDocument + " and macro: " + this + " and access level: " + accessLevel);
        StringBuilder builder = new StringBuilder();

        if (log.isDebugEnabled()) log.debug("including id of document: " + currentDocument.getId());
        builder.append( currentDocument.getId() );

        int namePositionHash = (getName() + "_" + getPosition()).hashCode();
        if (log.isDebugEnabled()) log.debug("including name/position of this macro: " + Math.abs(namePositionHash));
        builder.append( Math.abs(namePositionHash) );

        if (log.isDebugEnabled()) log.debug("including hashCode of macro params: " + Math.abs(getParams().hashCode()));
        builder.append( Math.abs(getParams().hashCode()) );

        if (log.isDebugEnabled()) log.debug("including accessLevel: " + accessLevel);
        builder.append( accessLevel );

        // This needs to be empty-String safe (the additional objects might be some of the
        // JSF "oh let's map a non-existant request parameter to an empty string" genius behavior...
        if (objects != null && objects.length > 0) {
            for (Object o : objects) {
                if (o != null && Math.abs(o.hashCode()) != 0) {
                    log.debug("including hashCode of object: " + Math.abs(o.hashCode()));
                    builder.append( Math.abs(o.hashCode()) );
                }
            }
        }
        return hash.hash(builder.toString());
    }
View Full Code Here

Examples of org.jboss.seam.wiki.util.Hash

        return syndFeed;
    }

    private String calculateEtag(Date date) {
        Hash hash = new Hash();
        return hash.hash(date.toString());
    }
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.