Package java.util

Examples of java.util.WeakHashMap


    /**
     * Puts an ElementsByTagName object in the cache.
     */
    public void putElementsByTagName(Node n, String ln, ElementsByTagName l) {
        if (elementsByTagNames == null) {
            elementsByTagNames = new WeakHashMap(11);
        }
        SoftDoublyIndexedTable t;
        t = (SoftDoublyIndexedTable)elementsByTagNames.get(n);
        if (t == null) {
            elementsByTagNames.put(n, t = new SoftDoublyIndexedTable());
View Full Code Here


     * Puts an ElementsByTagNameNS object in the cache.
     */
    public void putElementsByTagNameNS(Node n, String ns, String ln,
                                       ElementsByTagNameNS l) {
        if (elementsByTagNamesNS == null) {
            elementsByTagNamesNS = new WeakHashMap(11);
        }
        SoftDoublyIndexedTable t;
        t = (SoftDoublyIndexedTable)elementsByTagNamesNS.get(n);
        if (t == null) {
            elementsByTagNamesNS.put(n, t = new SoftDoublyIndexedTable());
View Full Code Here

    {
        checkShutdownState();

        if (typeCodeForClassMap == null)
            typeCodeForClassMap = Collections.synchronizedMap(
                new WeakHashMap(64));
        // Store only one TypeCode per class.
        if ( ! typeCodeForClassMap.containsKey(c))
            typeCodeForClassMap.put(c, tci);
    }
View Full Code Here

    {
        fontSearch = new FontKey(null, 0, 0);
        fontTable = new Hashtable();
        search = new SimpleAttributeSet();
        attributesPool = Collections.
      synchronizedMap(new WeakHashMap());
        s.defaultReadObject();
    }
View Full Code Here

        s.defaultWriteObject();
    }

    // Initialization of transient variables.
    private void initTransients() {
  rmbscMap = new WeakHashMap();
        connected = false;
        terminated = false;

  connectionBroadcaster = new NotificationBroadcasterSupport();
    }
View Full Code Here

        // Depending on option
        if (!factory.useThreadLocalTransactions()) {
            this.transaction = new TransactionImpl(this, factory.newDatastoreDriver(), jdoOptions);
        } else {
            this.jdoOptions = jdoOptions;
            this.transaction = new WeakHashMap();
        }
    }
View Full Code Here

        // Give users the option to use thread-local transactions
        // with a single PersistenceManager.
        Transaction txn = null;
        if (transaction instanceof WeakHashMap) {
            WeakHashMap threadTransactionMap = (WeakHashMap)transaction;
            Thread currentThread = Thread.currentThread();
            synchronized(threadTransactionMap) {
                txn = (Transaction)threadTransactionMap.get(currentThread);
                if(txn == null) {
                    txn = new TransactionImpl(this, factory.newDatastoreDriver(), jdoOptions);
                    threadTransactionMap.put(currentThread, txn);
                }
            }
        } else {
            txn = (Transaction) transaction;
        }
View Full Code Here

        closed = true;
    }

    private void closeImpl(boolean failIfActive) {
        if (transaction instanceof WeakHashMap) {
            WeakHashMap threadTransactionMap = (WeakHashMap)transaction;
            for (Iterator it = threadTransactionMap.values().iterator(); it.hasNext();) {
                TransactionImpl txn = (TransactionImpl) it.next();
                if (txn.isActive()) {
                    if (failIfActive) {
                        throw new JDOUserException(I18N.msg("E_open_txn"));
                    }
View Full Code Here

    int cacheType = webSite.getConfiguration().getCacheType();
   
    if (cacheType == Configuration.IN_MEMORY_CACHE) {
      pageCache = new HashMap();
    } else if (cacheType == Configuration.MIXED_CACHE) {
      pageCache = new WeakHashMap();
    }
  }
View Full Code Here

    * @param element
    * @param idValue
    */
   public static void registerElementById(Element element, String idValue) {
      Document doc = element.getOwnerDocument();
      WeakHashMap elementMap;
      synchronized (docMap) {
          elementMap = (WeakHashMap) docMap.get(doc);
          if (elementMap == null) {
              elementMap = new WeakHashMap();
              docMap.put(doc, elementMap);
          }
      }
      elementMap.put(idValue, new WeakReference(element));
   }
View Full Code Here

TOP

Related Classes of java.util.WeakHashMap

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.