Examples of LFUMap


Examples of org.pentaho.reporting.libraries.base.util.LFUMap

  }

  public Expression getInstance()
  {
    final MetaDataStyleEvaluator eval = (MetaDataStyleEvaluator) super.getInstance();
    eval.expressionsCache = new LFUMap(500);
    eval.attributeContext = null;
    return eval;
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.util.LFUMap

  public static synchronized DataSource createDataSource(final String jdbcUrl, final Properties properties)
  {
    if (cache == null)
    {
      cache = new LFUMap(20);
    }
   
    final DriverConnectionKey key = new DriverConnectionKey(jdbcUrl, properties);
    final Object o = cache.get(key);
    if (o instanceof DataSource)
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.util.LFUMap

   */
  private DataSource findDataSource(final Context initialContext, final String connectionPath) throws SQLException
  {
    final Configuration config = ClassicEngineBoot.getInstance().getGlobalConfig();

    final LFUMap map = getDataSourceCache();
    final boolean cacheEnabled = "true".equals(config.getConfigProperty
        ("org.pentaho.reporting.engine.classic.extensions.datasources.mondrian.CacheJndiDataSources"));
    if (cacheEnabled)
    {
      synchronized (map)
      {
        final DataSource o1 = (DataSource) map.get(connectionPath);
        if (o1 != null)
        {
          return o1;
        }
      }
    }
    try
    {
      final Object o = initialContext.lookup(connectionPath);
      if (o instanceof DataSource)
      {
        if (cacheEnabled)
        {
          synchronized (map)
          {
            map.put(connectionPath, o);
          }
        }
        return (DataSource) o;
      }
    }
    catch (NamingException e)
    {
      // ignored ..
    }

    final Iterator keys = config.findPropertyKeys
        ("org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.jndi-prefix.");
    while (keys.hasNext())
    {
      final String key = (String) keys.next();
      final String prefix = config.getConfigProperty(key);
      try
      {
        final Object o = initialContext.lookup(prefix + connectionPath);
        if (o instanceof DataSource)
        {
          if (cacheEnabled)
          {
            synchronized (map)
            {
              map.put(connectionPath, o);
            }
          }
          return (DataSource) o;
        }
      }
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.util.LFUMap

  public static synchronized LFUMap getDataSourceCache()
  {
    if (cachedDataSources == null)
    {
      cachedDataSources = new LFUMap(40);
    }
    return cachedDataSources;
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.util.LFUMap

    {
      throw new NullPointerException();
    }

    this.resourceManager = resourceManager;
    this.cachedImages = new LFUMap(100);
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.util.LFUMap

  public static synchronized DataSource createDataSource(final String jdbcUrl, final Properties properties)
  {
    if (cache == null)
    {
      cache = new LFUMap(20);
    }

    final DriverConnectionKey key = new DriverConnectionKey(jdbcUrl, properties);
    final Object o = cache.get(key);
    if (o instanceof DataSource)
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.util.LFUMap

    super(s);
  }

  public void testAdd ()
  {
    final LFUMap lfuMap = new LFUMap(10);
    lfuMap.put("1", "1");
    lfuMap.validate();
    lfuMap.put("2", "2");
    lfuMap.validate();
    lfuMap.put("3", "3");
    lfuMap.validate();
    lfuMap.put("4", "4");
    lfuMap.validate();
    lfuMap.put("1", "5");
    lfuMap.validate();
    lfuMap.put("3", "6");
    lfuMap.validate();
    lfuMap.put("4", "7");
    lfuMap.validate();
    lfuMap.put("2", "8");
    lfuMap.validate();

    DebugLog.logHere();
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.util.LFUMap

    DebugLog.logHere();
  }

  public void testAdd2 ()
  {
    final LFUMap lfuMap = new LFUMap(10);
    lfuMap.put("1", "1");
    lfuMap.validate();
    lfuMap.put("2", "2");
    lfuMap.validate();
    lfuMap.put("3", "3");
    lfuMap.validate();
    lfuMap.put("4", "4");
    lfuMap.validate();
    lfuMap.put("1", "5");
    lfuMap.validate();
    lfuMap.put("3", "6");
    lfuMap.validate();
    lfuMap.put("4", "7");
    lfuMap.validate();
    lfuMap.put("a2", "8");
    lfuMap.validate();
    lfuMap.put("a4", "4");
    lfuMap.validate();
    lfuMap.put("a1", "5");
    lfuMap.validate();
    lfuMap.put("a3", "6");
    lfuMap.validate();
    lfuMap.put("b4", "7");
    lfuMap.validate();
    lfuMap.put("b4", "4");
    lfuMap.validate();
    lfuMap.put("b1", "5");
    lfuMap.validate();
    lfuMap.put("b3", "6");
    lfuMap.validate();
    lfuMap.put("c4", "7");
    lfuMap.validate();

    lfuMap.get("a2");
    lfuMap.validate();
    lfuMap.get("a4");
    lfuMap.validate();
    lfuMap.get("a1");
    lfuMap.validate();
    lfuMap.get("a3");
    lfuMap.validate();
    lfuMap.get("b4");
    lfuMap.validate();
    lfuMap.get("b4");
    lfuMap.validate();

  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.util.LFUMap

  private LFUMap lexicalValueCache;

  public StyleSheetParserUtil()
  {
    registry = StyleKeyRegistry.getRegistry();
    lexicalValueCache = new LFUMap(100);
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.base.util.LFUMap

  private LFUMap map;

  public LeastFrequentlyUsedCache(final int cacheSize)
  {
    // having at least 3 entries saves me a lot of coding and thus gives more performance ..
    this.map = new LFUMap(cacheSize);
  }
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.