/** * Accessor for whether the cache contains the specified id. * @see org.jpox.cache.Level2Cache#containsOid(java.lang.Object) */ public boolean containsOid(Object oid) { try { return cache.getKeys().contains(oid); } catch (IllegalStateException e) { e.printStackTrace(); } catch (CacheException e) { e.printStackTrace(); } return false; }
/** * Accessor for whether the cache is empty * @see org.jpox.cache.Level2Cache#isEmpty() */ public boolean isEmpty() { try { return cache.getSize() == 0; } catch (IllegalStateException e) { e.printStackTrace(); } catch (CacheException e) { e.printStackTrace(); } return true; }
/** * Accessor for the size of the cache. * @see org.jpox.cache.Level2Cache#getSize() */ public int getSize() { try { return cache.getSize(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (CacheException e) { e.printStackTrace(); } return 0; }
/** * Accessor for an object in the cache. * @see org.jpox.cache.Level2Cache#get(java.lang.Object) */ public CachedPC get(Object oid) { try { Element element = cache.get((Serializable) oid); if (element == null) { return null; } return toPC(element); } catch (IllegalStateException e) { e.printStackTrace(); } catch (CacheException e) { e.printStackTrace(); } return null; }
/** * Accessor for the size of the cache. * @see org.jpox.cache.Level2Cache#getSize() */ public int getSize() { try { int size = defaultCache.getSize(); for (Iterator i = caches.values().iterator(); i.hasNext();) { size += ((Cache) i.next()).getSize(); } return size; } catch (IllegalStateException e) { e.printStackTrace(); } catch (CacheException e) { e.printStackTrace(); } return 0; }
/** * Accessor for whether the cache contains the specified id. * @see org.jpox.cache.Level2Cache#containsOid(java.lang.Object) */ public boolean containsOid(Object oid) { try { return getCacheForId(oid).getKeys().contains(oid); } catch (IllegalStateException e) { e.printStackTrace(); } catch (CacheException e) { e.printStackTrace(); } return false; }
/** * Accessor for an object in the cache. * @see org.jpox.cache.Level2Cache#get(java.lang.Object) */ public CachedPC get(Object oid) { try { Element element = getCacheForId(oid).get((Serializable) oid); if (element == null) { return null; } return toPC(element); } catch (IllegalStateException e) { e.printStackTrace(); } catch (CacheException e) { e.printStackTrace(); } return null; }
} catch (CacheException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace();
e.printStackTrace(); throw new JDOException("Cant create cache");