Package org.openmim.infrastructure

Examples of org.openmim.infrastructure.ObjectCache


    private static void cacheTest(int RELEASE_RATE) //0..8
    {
        System.out.println("creating " + OBJCOUNT + " objects using ObjectCache, release() rate: " + ((RELEASE_RATE + 0.0) / 8) + "...");
        gc();
        int oc = (int) OBJCOUNT;
        ObjectCache cache = ObjectCacheTest.cache;
        long start = System.currentTimeMillis();
        if (RELEASE_RATE == 8)
            for (int i = 0; i < oc; ++i) {
                cache.release(cache.get());
            }
        else if (RELEASE_RATE == 0)
            for (int i = 0; i < oc; ++i) {
                cache.get();
            }
        else
            for (int i = 0; i < oc; ++i) {
                Object o = cache.get();
                if ((i & 7) <= RELEASE_RATE) cache.release(o);
            }
        long end = System.currentTimeMillis();
        System.out.println("done.  Time spent: " + (end - start) + " millis");
        gc();
    }
View Full Code Here


    {
      synchronized (buffersLock)
      {
        if (buffers == null)
        {
          buffers = new ObjectCache(getNumberOfBuffers(), getNumberOfBuffers())
          {
            protected final Object create() { return new byte[32*1024]; }
          };
        }
      }
View Full Code Here

TOP

Related Classes of org.openmim.infrastructure.ObjectCache

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.