1 17 package org.apache.servicemix.store.memory; 18 19 import java.io.IOException ; 20 import java.util.HashMap ; 21 import java.util.Map ; 22 23 import org.apache.servicemix.id.IdGenerator; 24 import org.apache.servicemix.store.Store; 25 import org.apache.servicemix.store.StoreFactory; 26 27 public class MemoryStoreFactory implements StoreFactory { 28 29 private IdGenerator idGenerator = new IdGenerator(); 30 private Map stores = new HashMap (); 31 32 35 public synchronized Store open(String name) throws IOException { 36 MemoryStore store = (MemoryStore) stores.get(name); 37 if (store == null) { 38 store = new MemoryStore(idGenerator); 39 stores.put(name, store); 40 } 41 return store; 42 } 43 44 47 public synchronized void close(Store store) throws IOException { 48 stores.remove(store); 49 } 50 51 } 52 | Popular Tags |