Refine search
protected boolean write_state (Uid objUid, String tName, OutputObjectState state, int ft) throws ObjectStoreException { /* * If there is already a write operation in the cache for exactly this * state and type, then remove it and any corresponding remove_state * there might be. This is because write_state overwrites the state * rather than appending some operational work. If we used an appender * log then obviously this isn't appropriate. */ int status = CacheStore._storeManager.removeWriteState(objUid, ft); return CacheStore._storeManager.addWork(this, AsyncStore.WRITE, objUid, tName, state, ft); }
public final void flush () { /* * Do it this way because by the time we get here the daemon thread has * been removed by the system. */ boolean stop = false; do { synchronized (_workList) { stop = _numberOfEntries <= 0; } if (!stop) { doWork(); } } while (!stop); _terminated = true; }
public void sync () throws java.io.SyncFailedException, ObjectStoreException { CacheStore._storeManager.flush(); }
public final OutputObjectState getState (Uid objUid, int ft) { LinkedList list = getList(objUid); synchronized (list) { for (int i = 0; i < list.size(); i++) { StoreElement element = (StoreElement) list.get(i); if ((element != null) && !element.removed && (element.objUid.equals(objUid))) { if (element.fileType == ft) return element.state; } } /* * If not in cache then maybe we're working on it? */ synchronized (_workList) { if ((_work != null) && (objUid.equals(_work.objUid))) return _work.state; } } return null; }
if (cacheIsFull()) StoreElement toAdd = new StoreElement(store, workType, objUid, tName, state, ft); getList(objUid).addFirst(toAdd); _currentCacheSize += state.size();
elements = getList(objUid).toArray(); && element.objUid.equals(objUid)) element.remove(); _currentCacheSize -= element.state.size(); element.remove(); if (cacheIsFull()) if (CacheStore._storeManager.currentWork(objUid, ft))
protected boolean remove_state (Uid objUid, String name, int ft) throws ObjectStoreException { /* * Is it in the cache? */ int status = CacheStore._storeManager.removeState(objUid, ft); if (status == AsyncStore.REMOVED) return true; /* * Check to see if there's a state on disk. If there is, then we still * need to add a remove work item to the cache queue. */ int fileState = currentState(objUid, name); if ((fileState != StateStatus.OS_UNKNOWN) || (status == AsyncStore.IN_USE)) { return CacheStore._storeManager.addWork(this, AsyncStore.REMOVE, objUid, name, null, fileState); } else { if (fileState == StateStatus.OS_UNKNOWN) return false; else return true; } }
while (!queueIsEmpty()) // drain the queue doWork(); if (!cacheIsFull())
public boolean commit_state (Uid objUid, String tName) throws ObjectStoreException { return CacheStore._storeManager.addWork(this, AsyncStore.COMMIT, objUid, tName, null, CacheStore.NO_STATE_TYPE); }
/** * Before we look at the disk let's look in the state cache first for the * state, just in case it hasn't been written out to persistent store yet. */ protected InputObjectState read_state (Uid objUid, String tName, int ft) throws ObjectStoreException { OutputObjectState state = CacheStore._storeManager.getState(objUid, ft); if (state == null) // not in the cache return super.read_state(objUid, tName, ft); else return new InputObjectState(state); }
public final OutputObjectState getState (Uid objUid, int ft) { LinkedList list = getList(objUid); synchronized (list) { for (int i = 0; i < list.size(); i++) { StoreElement element = (StoreElement) list.get(i); if ((element != null) && !element.removed && (element.objUid.equals(objUid))) { if (element.fileType == ft) return element.state; } } /* * If not in cache then maybe we're working on it? */ synchronized (_workList) { if ((_work != null) && (objUid.equals(_work.objUid))) return _work.state; } } return null; }
if (cacheIsFull()) StoreElement toAdd = new StoreElement(store, workType, objUid, tName, state, ft); getList(objUid).addFirst(toAdd); _currentCacheSize += state.size();
elements = getList(objUid).toArray(); && element.objUid.equals(objUid)) element.remove(); _currentCacheSize -= element.state.size(); element.remove(); if (cacheIsFull()) if (CacheStore._storeManager.currentWork(objUid, ft))
protected boolean remove_state (Uid objUid, String name, int ft) throws ObjectStoreException { /* * Is it in the cache? */ int status = CacheStore._storeManager.removeState(objUid, ft); if (status == AsyncStore.REMOVED) return true; /* * Check to see if there's a state on disk. If there is, then we still * need to add a remove work item to the cache queue. */ int fileState = currentState(objUid, name); if ((fileState != StateStatus.OS_UNKNOWN) || (status == AsyncStore.IN_USE)) { return CacheStore._storeManager.addWork(this, AsyncStore.REMOVE, objUid, name, null, fileState); } else { if (fileState == StateStatus.OS_UNKNOWN) return false; else return true; } }
while (!queueIsEmpty()) // drain the queue doWork(); if (!cacheIsFull())
public boolean commit_state (Uid objUid, String tName) throws ObjectStoreException { return CacheStore._storeManager.addWork(this, AsyncStore.COMMIT, objUid, tName, null, CacheStore.NO_STATE_TYPE); }
/** * Before we look at the disk let's look in the state cache first for the * state, just in case it hasn't been written out to persistent store yet. */ protected InputObjectState read_state (Uid objUid, String tName, int ft) throws ObjectStoreException { OutputObjectState state = CacheStore._storeManager.getState(objUid, ft); if (state == null) // not in the cache return super.read_state(objUid, tName, ft); else return new InputObjectState(state); }
public final OutputObjectState getState (Uid objUid, int ft) { LinkedList list = getList(objUid); synchronized (list) { for (int i = 0; i < list.size(); i++) { StoreElement element = (StoreElement) list.get(i); if ((element != null) && !element.removed && (element.objUid.equals(objUid))) ; { if (element.fileType == ft) return element.state; } } /* * If not in cache then maybe we're working on it? */ if ((_work != null) && (objUid.equals(_work.objUid))) return _work.state; } return null; }
if (cacheIsFull()) StoreElement toAdd = new StoreElement(store, workType, objUid, tName, state, ft); getList(objUid).addFirst(toAdd); _currentCacheSize += state.size();
elements = getList(objUid).toArray(); && element.objUid.equals(objUid)) element.remove(); _currentCacheSize -= element.state.size(); element.remove(); if (cacheIsFull()) if (CacheStore._storeManager.currentWork(objUid, ft))