Package net.sf.ehcache.concurrent

Examples of net.sf.ehcache.concurrent.Sync.unlock()


                return disk.containsKey(key) || memory.containsKey(key);
            } else {
                return memory.containsKey(key);
            }
        } finally {
            s.unlock(LockType.READ);
        }
    }

    /**
     * {@inheritDoc}
 
View Full Code Here


        Sync s = sync.getSyncForKey(key);
        s.lock(LockType.READ);
        try {
            return memory.containsKey(key);
        } finally {
            s.unlock(LockType.READ);
        }
    }

    /**
     * {@inheritDoc}
 
View Full Code Here

                return disk.containsKey(key);
            } else {
                return false;
            }
        } finally {
            s.unlock(LockType.READ);
        }
    }

    /**
     * {@inheritDoc}
 
View Full Code Here

                            eventListeners.notifyElementExpiry(e, false);
                        }
                    }
                }
            } finally {
                s.unlock(LockType.WRITE);
            }
        }

        //This is called regularly by the expiry thread, but call it here synchronously
        if (disk != null) {
View Full Code Here

                    memory.put(e);
                }
            }
            return e;
        } finally {
            s.unlock(LockType.READ);
        }
    }

    /**
     * {@inheritDoc}
 
View Full Code Here

                    memory.put(e);
                }
            }
            return e;
        } finally {
            s.unlock(LockType.READ);
        }
    }

    /**
     * {@inheritDoc}
 
View Full Code Here

        s.lock(LockType.WRITE);
        try {
            boolean notOnDisk = !containsKeyOnDisk(element.getObjectKey());
            return memory.put(element) && notOnDisk;
        } finally {
            s.unlock(LockType.WRITE);
        }
    }

    /**
     * {@inheritDoc}
 
View Full Code Here

        acquiredLockForKey(key, lock, LockType.READ);
        Element element;
        try {
            element = underlyingCache.get(key);
        } finally {
            lock.unlock(LockType.READ);
        }
        if (element == null) {
            acquiredLockForKey(key, lock, LockType.WRITE);
            element = underlyingCache.getQuiet(key);
            if (element != null) {
View Full Code Here

            element = underlyingCache.getQuiet(key);
            if (element != null) {
                if (underlyingCache.isStatisticsEnabled()) {
                    element = underlyingCache.get(key);
                }
                lock.unlock(LockType.WRITE);
            }
        }
        return element;
    }
View Full Code Here

            } else {
                underlyingCache.remove(key);
            }
        } finally {
            //Release the readlock here. This will have been acquired in the get, where the element was null
            lock.unlock(LockType.WRITE);
        }
    }

    /**
     * Gets an element from the cache. Updates Element Statistics
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.