Skip to content

Commit

Permalink
brianfrankcoopergh-37 removed slf4j dependency from MongoDbClient.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Michi Mutsuzaki committed Sep 5, 2011
1 parent 190f2e9 commit ef2c925
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions db/mongodb/src/com/yahoo/ycsb/db/MongoDbClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
import java.util.Set;
import java.util.Vector;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.bson.types.ObjectId;

import com.mongodb.BasicDBObject;
Expand Down Expand Up @@ -47,8 +44,6 @@
*/
public class MongoDbClient extends DB {

private static final Logger logger = LoggerFactory.getLogger(MongoDbClient.class);

private Mongo mongo;
private WriteConcern writeConcern;
private String database;
Expand Down Expand Up @@ -86,9 +81,9 @@ public void init() throws DBException {
mongo = new Mongo(new DBAddress(url));
System.out.println("mongo connection created with "+url);
} catch (Exception e1) {
logger.error(
System.err.println(
"Could not initialize MongoDB connection pool for Loader: "
+ e1, e1);
+ e1.toString());
return;
}

Expand Down Expand Up @@ -119,7 +114,7 @@ public int delete(String table, String key) {

return ((Integer) errors.get("n")) == 1 ? 0 : 1;
} catch (Exception e) {
logger.error(e + "", e);
System.err.println(e.toString());
return 1;
}
finally
Expand Down Expand Up @@ -159,11 +154,11 @@ public int insert(String table, String key, HashMap<String, String> values) {
// determine if record was inserted, does not seem to return
// n=<records affected> for insert
DBObject errors = db.getLastError();
System.out.println(errors.toString());
System.err.println(errors.toString());

return ((Double) errors.get("ok") == 1.0) && errors.get("err") == null ? 0 : 1;
} catch (Exception e) {
logger.error(e + "", e);
System.err.println(e.toString());
return 1;
} finally {
if (db!=null)
Expand Down Expand Up @@ -213,7 +208,7 @@ public int read(String table, String key, Set<String> fields,
}
return queryResult != null ? 0 : 1;
} catch (Exception e) {
logger.error(e + "", e);
System.err.println(e.toString());
return 1;
} finally {
if (db!=null)
Expand Down Expand Up @@ -264,7 +259,7 @@ public int update(String table, String key, HashMap<String, String> values) {

return (Integer) errors.get("n") == 1 ? 0 : 1;
} catch (Exception e) {
logger.error(e + "", e);
System.err.println(e.toString());
return 1;
} finally {
if (db!=null)
Expand Down Expand Up @@ -304,7 +299,7 @@ public int scan(String table, String startkey, int recordcount,

return 0;
} catch (Exception e) {
logger.error(e + "", e);
System.err.println(e.toString());
return 1;
}
finally
Expand Down

0 comments on commit ef2c925

Please sign in to comment.