short nextCollectionId = 0;
short nextCollectionId = getFreeCollectionId(); if(nextCollectionId > -1) return nextCollectionId;
	protected short getNextCollectionId() throws ReadOnlyException {		short nextCollectionId = 0;		Value key = new Value("__next_collection_id");		Value data;		Lock lock = collectionsDb.getLock();		try {			lock.acquire(Lock.WRITE_LOCK);			data = collectionsDb.get(key);			if (data != null) {				nextCollectionId = ByteConversion.byteToShort(data.getData(), 0);				++nextCollectionId;			}			byte[] d = new byte[2];			ByteConversion.shortToByte(nextCollectionId, d, 0);			collectionsDb.put(key, d, true);		} catch (LockException e) {			LOG.warn("failed to acquire lock on collections store", e);			return -1;		} finally {			lock.release();		}		return nextCollectionId;	}