/** * Locks access to all the collections until init is called. */ public static bool closeAllCollections() { bool worked = false; // if transaction in process, cannot close, throw exception if (transactionInProgress) { //JSONStoreLoggerError(@"Error: JSON_STORE_TRANSACTION_FAILURE_DURING_CLOSE_ALL, code: %d", JSON_STORE_TRANSACTION_FAILURE_DURING_CLOSE_ALL); throw new JSONStoreException(JSONStoreConstants.JSON_STORE_TRANSACTION_FAILURE_DURING_CLOSE_ALL); } JSONStoreSQLLite store = JSONStoreSQLLite.sharedManager(); if (store == null) { // if can't get a store, then we are already closed worked = true; } else if (!store.isOpen()) { // already closed! worked = true; } else { // not closed, so do the close worked = store.close(); } if (worked) { // clear the collections globalJSONStoreCollectionAccessors = null; } else { //JSONStoreLoggerError(@"Error: JSON_STORE_ERROR_CLOSING_ALL, code: %d", rc); throw new JSONStoreException(JSONStoreConstants.JSON_STORE_ERROR_CLOSING_ALL); } return(worked); }