/** * Return a {@link TemporaryStore}. If there is no existing * {@link TemporaryStore} then a new instance is returned. If there is an * existing {@link TemporaryStore} and its extent is greater then the * configured maximum extent then a new {@link TemporaryStore} will be * created and returned. Otherwise the existing instance is returned. */ synchronized public TemporaryStore getTempStore() { TemporaryStore t = ref == null ? null : ref.get(); if (t == null || t.getBufferStrategy().getExtent() > maxExtent) { // create an empty backing file in the specified directory. final File file = TemporaryRawStore.getTempFile(tmpDir); // Create a temporary store using that backing file. t = new TemporaryStore(offsetBits, file); // put into the weak value cache. stores.put(t.getUUID(), t); // return weak reference. ref = new WeakReference<TemporaryStore>(t); } return t; }
/** * Return a {@link TemporaryStore}. If there is no existing * {@link TemporaryStore} then a new instance is returned. If there is an * existing {@link TemporaryStore} and its extent is greater then the * configured maximum extent then a new {@link TemporaryStore} will be * created and returned. Otherwise the existing instance is returned. */ synchronized public TemporaryStore getTempStore() { TemporaryStore t = ref == null ? null : ref.get(); if (t == null || t.getBufferStrategy().getExtent() > maxExtent) { // create an empty backing file in the specified directory. final File file = TemporaryRawStore.getTempFile(tmpDir); // Create a temporary store using that backing file. t = new TemporaryStore(offsetBits, file); // put into the weak value cache. stores.put(t.getUUID(), t); // return weak reference. ref = new WeakReference<TemporaryStore>(t); } return t; }