Package com.google.common.collect

Examples of com.google.common.collect.MapMaker


    }

    private void pumpTheHeap( int ops, byte[] payload )
    {

        ConcurrentMap<String, byte[]> test = new MapMaker().concurrencyLevel( 4 ).makeMap();

        logger.info( Ram.inMb( ops * payload.length ) + " in " + ops + " slices to store" );

        double started = System.currentTimeMillis();

View Full Code Here


    @Test
    public void withMap()
    {

        ConcurrentMap<Long, Pointer<Object>> map = new MapMaker().concurrencyLevel( 4 ).initialCapacity( 500000 ).makeMap();

        String str = "This is the string to store into the off-heap memory";

        int size = str.length();
        int howMany = 1000000;
View Full Code Here

    public void close() {}

    public StorageEngine<ByteArray, byte[], byte[]> getStore(StoreDefinition storeDef,
                                                             RoutingStrategy strategy) {
        ConcurrentMap<ByteArray, List<Versioned<byte[]>>> backingMap = new MapMaker().softValues()
                                                                                     .makeMap();
        return new InMemoryStorageEngine<ByteArray, byte[], byte[]>(storeDef.getName(), backingMap);
    }
View Full Code Here

  private static class SimpleXAResourceProducer implements XAResourceProducer {
    private static final long serialVersionUID = 1L;
    private transient Map<XAResource, XAResourceHolder> xaresHolders = createXAResHoldersMap();

    private static final Map<XAResource, XAResourceHolder> createXAResHoldersMap() {
      return new MapMaker().weakKeys().weakValues().makeComputingMap(
        new Function<XAResource, XAResourceHolder>() {
          public XAResourceHolder apply(XAResource xares) {
            return createResHolder(xares);
          }
        }
View Full Code Here

        thread = new Thread(this, "Receiver");
        // TODO avoid starting the thread here
        thread.start();

        streams = new MapMaker().makeMap();
    }
View Full Code Here

    /** Save stream keyed by app id and stream id. */
    void addStream(Stream<? extends Event> stream) {
        int appId = stream.getApp().getId();
        Map<String, Stream<? extends Event>> appMap = streams.get(appId);
        if (appMap == null) {
            appMap = new MapMaker().makeMap();
            streams.put(appId, appMap);
        }
        appMap.put(stream.getName(), stream);
    }
View Full Code Here

            public ProcessingElement load(String key) throws Exception {
                return createPE(key);
            }
        });

        triggers = new MapMaker().makeMap();

        /*
         * Only the PE Prototype uses the constructor. The PEPrototype field will be cloned by the instances and point
         * to the prototype.
         */
 
View Full Code Here

    LazyStriped(int stripes, Supplier<L> supplier) {
      super(stripes);
      this.size = (mask == ALL_SET) ? Integer.MAX_VALUE : mask + 1;
      this.supplier = supplier;
      this.locks = new MapMaker().weakValues().makeMap();
    }
View Full Code Here

   * Hook into the post load event in JPA to take the database fields and load
   * the transient fields prior to making the object available to java.
   */
  @PostLoad
  public void loadTransientFields() {
    templateParams = new MapMaker().makeMap();
    for (Entry<String, ActivityTemplateParamsDb> e : templateParamsDb
        .entrySet()) {
      templateParams.put(e.getKey(), e.getValue().value);
    }
  }
View Full Code Here

  /**
   * set the state of the object after load
   */
  @PostLoad
  public void postLoad() {
    values = new MapMaker().makeMap();
    for (Entry<String, ApplicationDataMapValueDb> e : valuesDb.entrySet()) {
      values.put(e.getKey(), e.getValue().getValue());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.common.collect.MapMaker

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.