Package org.jboss.errai.codegen.meta

Examples of org.jboss.errai.codegen.meta.MetaClassCache$CacheEntry


    if (context.equals(tOCache.populatedFrom)) {
      return;
    }

    final TypeOracle typeOracle = context.getTypeOracle();
    final MetaClassCache cache = MetaClassFactory.getMetaClassCache();

    // Clearing the LiteralFactory cache resolved https://issues.jboss.org/browse/ERRAI-456
    if (typeOracle != null) {
      final Map<String, MetaClass> classesToPush = new HashMap<String, MetaClass>(typeOracle.getTypes().length);
      final Set<String> translatable = new HashSet<String>(RebindUtils.findTranslatablePackages(context));
      translatable.remove("java.lang");
      translatable.remove("java.lang.annotation");

      for (final JClassType type : typeOracle.getTypes()) {
        if (!translatable.contains(type.getPackage().getName())) {
//         logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Skipping non-translatable " + type.getQualifiedSourceName());
          continue;
        }

        if (type.isAnnotation() != null || type.getQualifiedSourceName().equals("java.lang.annotation.Annotation")) {
   //       logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Caching annotation type " + type.getQualifiedSourceName());

          if (!MetaClassFactory.canLoadClass(type.getQualifiedBinaryName())) {
            throw new RuntimeException("a new annotation has been introduced (" + type.getQualifiedSourceName() + "); "
                + "you cannot currently introduce new annotations in devmode. Please restart.");
          }


          final MetaClass clazz = JavaReflectionClass
              .newUncachedInstance(MetaClassFactory.loadClass(type.getQualifiedBinaryName()));

          classesToPush.put(clazz.getFullyQualifiedName(), clazz);
        }
        else {
          logger.log(TreeLogger.Type.DEBUG, "Caching translatable type " + type.getQualifiedSourceName());
          final MetaClass clazz = GWTClass.newInstance(typeOracle, type);
          classesToPush.put(clazz.getFullyQualifiedName(), clazz);
        }
      }

      cache.pushCacheAll(classesToPush);
    }
    tOCache.populatedFrom = context;

    CacheUtil.getCache(EnvUtil.EnvironmentConfigCache.class).clear();
  }
View Full Code Here


    if (context.equals(tOCache.populatedFrom)) {
      return;
    }

    final TypeOracle typeOracle = context.getTypeOracle();
    final MetaClassCache cache = MetaClassFactory.getMetaClassCache();

    if (typeOracle != null) {
      final Map<String, MetaClass> classesToPush = new HashMap<String, MetaClass>(typeOracle.getTypes().length);
      final Set<String> translatable = new HashSet<String>(RebindUtils.findTranslatablePackages(context));
      final Set<String> reloadable = RebindUtils.getReloadablePackageNames(context);
      translatable.remove("java.lang");
      translatable.remove("java.lang.annotation");

      for (final JClassType type : typeOracle.getTypes()) {
        if (!translatable.contains(type.getPackage().getName())) {
//         logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Skipping non-translatable " + type.getQualifiedSourceName());
          continue;
        }

        if (type.isAnnotation() != null || type.getQualifiedSourceName().equals("java.lang.annotation.Annotation")) {
   //       logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Caching annotation type " + type.getQualifiedSourceName());

          if (!MetaClassFactory.canLoadClass(type.getQualifiedBinaryName())) {
            throw new RuntimeException("a new annotation has been introduced (" + type.getQualifiedSourceName() + "); "
                + "you cannot currently introduce new annotations in devmode. Please restart.");
          }

          final MetaClass clazz = JavaReflectionClass
              .newUncachedInstance(MetaClassFactory.loadClass(type.getQualifiedBinaryName()));

          if (isReloadable(clazz, reloadable))
            classesToPush.put(clazz.getFullyQualifiedName(), clazz);
          else
            cache.pushCache(clazz);
        }
        else {
          logger.log(TreeLogger.Type.DEBUG, "Caching translatable type " + type.getQualifiedSourceName());
          final MetaClass clazz = GWTClass.newInstance(typeOracle, type);

          if (isReloadable(clazz, reloadable))
            classesToPush.put(clazz.getFullyQualifiedName(), clazz);
          else
            cache.pushCache(clazz);
        }
      }

      cache.updateCache(classesToPush);
    }
    tOCache.populatedFrom = context;

    CacheUtil.getCache(EnvUtil.EnvironmentConfigCache.class).clear();
  }
View Full Code Here

    if (context.equals(tOCache.populatedFrom)) {
      return;
    }

    final TypeOracle typeOracle = context.getTypeOracle();
    final MetaClassCache cache = MetaClassFactory.getMetaClassCache();

    if (typeOracle != null) {
      final Map<String, MetaClass> classesToPush = new HashMap<String, MetaClass>(typeOracle.getTypes().length);
      final Set<String> translatable = new HashSet<String>(RebindUtils.findTranslatablePackages(context));
      translatable.remove("java.lang");
      translatable.remove("java.lang.annotation");

      for (final JClassType type : typeOracle.getTypes()) {
        if (!translatable.contains(type.getPackage().getName())) {
//         logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Skipping non-translatable " + type.getQualifiedSourceName());
          continue;
        }

        if (type.isAnnotation() != null || type.getQualifiedSourceName().equals("java.lang.annotation.Annotation")) {
   //       logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Caching annotation type " + type.getQualifiedSourceName());

          if (!MetaClassFactory.canLoadClass(type.getQualifiedBinaryName())) {
            throw new RuntimeException("a new annotation has been introduced (" + type.getQualifiedSourceName() + "); "
                + "you cannot currently introduce new annotations in devmode. Please restart.");
          }


          final MetaClass clazz = JavaReflectionClass
              .newUncachedInstance(MetaClassFactory.loadClass(type.getQualifiedBinaryName()));

          classesToPush.put(clazz.getFullyQualifiedName(), clazz);
        }
        else {
          logger.log(TreeLogger.Type.DEBUG, "Caching translatable type " + type.getQualifiedSourceName());
          final MetaClass clazz = GWTClass.newInstance(typeOracle, type);
          classesToPush.put(clazz.getFullyQualifiedName(), clazz);
        }
      }

      cache.updateCache(classesToPush);
    }
    tOCache.populatedFrom = context;

    CacheUtil.getCache(EnvUtil.EnvironmentConfigCache.class).clear();
  }
View Full Code Here

    if (context.equals(tOCache.populatedFrom)) {
      return;
    }

    final TypeOracle typeOracle = context.getTypeOracle();
    final MetaClassCache cache = MetaClassFactory.getMetaClassCache();

    if (typeOracle != null) {
      final Map<String, MetaClass> classesToPush = new HashMap<String, MetaClass>(typeOracle.getTypes().length);
      final Set<String> translatable = new HashSet<String>(RebindUtils.findTranslatablePackages(context));
      translatable.remove("java.lang");
      translatable.remove("java.lang.annotation");

      for (final JClassType type : typeOracle.getTypes()) {
        if (!translatable.contains(type.getPackage().getName())) {
//         logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Skipping non-translatable " + type.getQualifiedSourceName());
          continue;
        }

        if (type.isAnnotation() != null || type.getQualifiedSourceName().equals("java.lang.annotation.Annotation")) {
   //       logger.log(com.google.gwt.core.ext.TreeLogger.Type.DEBUG, "Caching annotation type " + type.getQualifiedSourceName());

          if (!MetaClassFactory.canLoadClass(type.getQualifiedBinaryName())) {
            throw new RuntimeException("a new annotation has been introduced (" + type.getQualifiedSourceName() + "); "
                + "you cannot currently introduce new annotations in devmode. Please restart.");
          }


          final MetaClass clazz = JavaReflectionClass
              .newUncachedInstance(MetaClassFactory.loadClass(type.getQualifiedBinaryName()));

          classesToPush.put(clazz.getFullyQualifiedName(), clazz);
        }
        else {
          logger.log(TreeLogger.Type.DEBUG, "Caching translatable type " + type.getQualifiedSourceName());
          final MetaClass clazz = GWTClass.newInstance(typeOracle, type);
          classesToPush.put(clazz.getFullyQualifiedName(), clazz);
        }
      }

      cache.pushCacheAll(classesToPush);
    }
    tOCache.populatedFrom = context;

    CacheUtil.getCache(EnvUtil.EnvironmentConfigCache.class).clear();
  }
View Full Code Here

*/
public class LeastRecentlyUsedEvictionAlgorithm implements EvictionAlgorithm {

    @SuppressWarnings("unchecked")
    public void evict(CacheImpl cache) {
        CacheEntry lruCacheEntry = null;
        for (Object o : cache.getAll()) {
            CacheEntry cacheEntry = (CacheEntry) o;
            if (lruCacheEntry == null) {
                lruCacheEntry = cacheEntry;
            } else if (lruCacheEntry.getLastAccessed() > cacheEntry.getLastAccessed()) {
                lruCacheEntry = cacheEntry;
            }
        }
        if (lruCacheEntry != null) {
            cache.evict(lruCacheEntry.getKey());
View Full Code Here

*/
public class MostRecentlyUsedEvictionAlgorithm implements EvictionAlgorithm {

    @SuppressWarnings("unchecked")
    public void evict(CacheImpl cache) {
        CacheEntry mruCacheEntry = null;
        for (Object o : cache.getAll()) {
            CacheEntry cacheEntry = (CacheEntry) o;
            if (mruCacheEntry == null) {
                mruCacheEntry = cacheEntry;
            } else if (mruCacheEntry.getLastAccessed() < cacheEntry.getLastAccessed()) {
                mruCacheEntry = cacheEntry;
            }
        }
        if (mruCacheEntry != null) {
            cache.evict(mruCacheEntry.getKey());
View Full Code Here

public class RandomEvictionAlgorithm implements EvictionAlgorithm {
    private static Random random = new Random();

    @SuppressWarnings("unchecked")
    public void evict(CacheImpl cache) {
        CacheEntry lruCacheEntry = null;
        Collection all = cache.getAll();
        int evictionIndex = random.nextInt(all.size());
        int index = 0;

        for (Object anAll : all) {
            CacheEntry cacheEntry = (CacheEntry) anAll;
            if (index == evictionIndex) {
                lruCacheEntry = cacheEntry;
                break;
            }
            index++;
View Full Code Here

TOP

Related Classes of org.jboss.errai.codegen.meta.MetaClassCache$CacheEntry

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.