add callback so DB operations use same connection across multiple operations

This commit is contained in:
Mark Pollack
2010-10-17 02:22:31 -04:00
parent ec1e8a8c1c
commit f850239c7b
2 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
package org.springframework.datastore.document.analytics;
import java.util.Date;
import java.util.Map;
public class ControllerCounter {
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public Map<String, Integer> getMethods() {
return methods;
}
public void setMethods(Map<String, Integer> methods) {
this.methods = methods;
}
private String name;
private int count;
private Map<String, Integer> methods;
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.document.mongodb;
import org.springframework.dao.DataAccessException;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoException;
public interface DBCallback<T> {
T doInDB(DB db) throws MongoException, DataAccessException;
}