wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/attribute/core/AbstractAttribute.java
protected Collection<ReadLock> lockAndGetReadLocks() {

        // internally ownerTags.size() (WeakHashMap) contains synchronization
        // better avoid calling it
        // normally there will be one sharedObject so the capacity may be
        // considered as 2 because the load factor is 0.75f
        final Collection<ReadLock> readLocks = new HashSet<>(2);

        for (final AbstractHtml ownerTag : ownerTags) {
            final ReadLock readLock = ownerTag.getSharedObject()
                    .getLock(ACCESS_OBJECT).readLock();
            if (readLock != null) {
                readLocks.add(readLock);
            }
        }

        // must be separately locked
        for (final ReadLock readLock : readLocks) {
            try {
                readLock.lock();
                readLocks.add(readLock);
            } catch (final Exception e) {
                e.printStackTrace();
            }
        }

        return readLocks;
    }
protected Collection<ReadLock> lockAndGetReadLocks() {

        // internally ownerTags.size() (WeakHashMap) contains synchronization
        // better avoid calling it
        // normally there will be one sharedObject so the capacity may be
        // considered as 2 because the load factor is 0.75f
        final Collection<ReadLock> readLocks = new HashSet<>(2);

        for (final AbstractHtml ownerTag : ownerTags) {
            final ReadLock readLock = ownerTag.getSharedObject()
                    .getLock(ACCESS_OBJECT).readLock();
            if (readLock != null) {
                readLocks.add(readLock);
            }
        }

        // must be separately locked
        for (final ReadLock readLock : readLocks) {
            try {
                readLock.lock();
                readLocks.add(readLock);
            } catch (final Exception e) {
                e.printStackTrace();
            }
        }

        return readLocks;
    }
NB: this may not return the same locks as there could be the its
ownerTags change. Use it for only unlock.

@return the set of read locks after locking