public void putWithTry(int numOps) { try { setup(true); for (int i = 0; i < numOps; i++) { TestObject object = new TestObject(); String s = new Integer(i).toString(); object.setSid(s); object.setName("hero" + s); object.setCountry("China"); objectList.add(object); if (objectList.size() >= CACHE_LIMIT) { close(); boolean success = false; while (!success) { success = setup(false); } for (int j = 0; j < objectList.size(); j++) { objectBySid.putNoReturn(objectList.get(j)); } close(); setup(true); objectList = new ArrayList<TestObject>(); } } } catch (DatabaseException e) { e.printStackTrace(); } }
public void putNoTry(int numOps) { setup(false); try { for (int i = 0; i < numOps; i++) { TestObject object = new TestObject(); String sId = new Integer(i).toString(); object.setSid(sId); object.setName("hero" + sId); object.setCountry("China"); objectBySid.putNoReturn(object); } } catch (DatabaseException e) { e.printStackTrace(); } }