public class BufferedMorphiumWriterImpl extends Object implements MorphiumWriter, ShutdownListener
Buffered Writer buffers all write requests (store, update, remove...) to mongo for a certain time. After that time the requests are issued en block to mongo. Attention: this is not using BULK-Requests yet!
| Constructor and Description |
|---|
BufferedMorphiumWriterImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addToWriteQueue(Class<?> type,
String collectionName,
de.caluga.morphium.writer.BufferedMorphiumWriterImpl.BufferedBulkOp r,
AsyncOperationCallback c,
AsyncOperationType t) |
void |
close()
information about closing of morphium and all connections
|
<T> void |
dropCollection(Class<T> cls,
String collection,
AsyncOperationCallback<T> c) |
<T> void |
ensureIndex(Class<T> cls,
String collection,
Map<String,Object> index,
AsyncOperationCallback<T> c) |
<T> void |
ensureIndex(Class<T> cls,
String collection,
Map<String,Object> index,
Map<String,Object> options,
AsyncOperationCallback<T> c) |
protected void |
finalize() |
void |
flush() |
<T> void |
inc(Query<T> query,
Map<String,Number> fieldsToInc,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> c) |
<T> void |
inc(Query<T> query,
String field,
Number amount,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> c) |
<T> void |
inc(T obj,
String collection,
String field,
Number amount,
AsyncOperationCallback<T> c)
Increases a value in an existing mongo collection entry - no reading necessary.
|
boolean |
isOrderedExecution() |
void |
onShutdown(Morphium m) |
<T> void |
pop(T obj,
String collection,
String field,
boolean first,
AsyncOperationCallback<T> c) |
<T> void |
pushPull(boolean push,
Query<T> q,
String field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> c) |
<T> void |
pushPullAll(boolean push,
Query<T> q,
String field,
List<?> value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> c) |
<T> void |
remove(List<T> lst,
AsyncOperationCallback<T> c) |
<T> void |
remove(Query<T> q,
AsyncOperationCallback<T> c)
deletes all objects matching the given query
|
<T> void |
remove(Query<T> q,
boolean multiple,
AsyncOperationCallback<T> c) |
<T> void |
remove(T o,
String collection,
AsyncOperationCallback<T> c) |
<T> void |
set(Query<T> query,
Map<String,Object> values,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> c)
will change an entry in mongodb-collection corresponding to given class object
if query is too complex, upsert might not work!
|
<T> void |
set(T toSet,
String collection,
String field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> c)
changes an object in DB AND in Memory...
|
void |
setMaximumQueingTries(int n) |
void |
setMorphium(Morphium m) |
void |
setOrderedExecution(boolean orderedExecution) |
void |
setPauseBetweenTries(int p) |
<T> void |
store(List<T> lst,
AsyncOperationCallback<T> c)
stores the given list of objects, should be entities or embedded.
|
<T> void |
store(List<T> lst,
String collectionName,
AsyncOperationCallback<T> c) |
<T> void |
store(T o,
String collection,
AsyncOperationCallback<T> c)
Stores the object, should be an entity
|
<T> void |
unset(Query<T> query,
AsyncOperationCallback<T> c,
boolean multiple,
Enum... fields) |
<T> void |
unset(Query<T> query,
AsyncOperationCallback<T> c,
boolean multiple,
String... fields) |
<T> void |
unset(Query<T> query,
String field,
boolean multiple,
AsyncOperationCallback<T> c) |
<T> void |
unset(T obj,
String collection,
String field,
AsyncOperationCallback<T> c)
Un-setting a value in an existing mongo collection entry - no reading necessary.
|
<T> void |
updateUsingFields(T ent,
String collection,
AsyncOperationCallback<T> c,
String... fields)
update an object using fields specified
|
int |
writeBufferCount() |
public void close()
MorphiumWriterclose in interface MorphiumWriterpublic boolean isOrderedExecution()
public void setOrderedExecution(boolean orderedExecution)
public void addToWriteQueue(Class<?> type, String collectionName, de.caluga.morphium.writer.BufferedMorphiumWriterImpl.BufferedBulkOp r, AsyncOperationCallback c, AsyncOperationType t)
public <T> void store(T o,
String collection,
AsyncOperationCallback<T> c)
MorphiumWriterstore in interface MorphiumWritero - - entitypublic <T> void store(List<T> lst, String collectionName, AsyncOperationCallback<T> c)
store in interface MorphiumWriterpublic <T> void updateUsingFields(T ent,
String collection,
AsyncOperationCallback<T> c,
String... fields)
MorphiumWriterupdateUsingFields in interface MorphiumWriterent - entityfields - - fieldspublic <T> void set(T toSet,
String collection,
String field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> c)
MorphiumWriterset in interface MorphiumWritertoSet - entity to set values in both in mongo and in memoryfield - fieldvalue - value to setpublic <T> void set(Query<T> query, Map<String,Object> values, boolean upsert, boolean multiple, AsyncOperationCallback<T> c)
MorphiumWriterset in interface MorphiumWriterquery - - query to specify which objects should be setvalues - - map fieldName->Value, which values are to be set!upsert - - insert, if it does not exist (query needs to be simple!)multiple - - update several documents, if false, only first hit will be updatedpublic <T> void inc(Query<T> query, Map<String,Number> fieldsToInc, boolean upsert, boolean multiple, AsyncOperationCallback<T> c)
inc in interface MorphiumWriterpublic <T> void inc(Query<T> query, String field, Number amount, boolean upsert, boolean multiple, AsyncOperationCallback<T> c)
inc in interface MorphiumWriterpublic <T> void inc(T obj,
String collection,
String field,
Number amount,
AsyncOperationCallback<T> c)
MorphiumWriterinc in interface MorphiumWriterpublic <T> void pop(T obj,
String collection,
String field,
boolean first,
AsyncOperationCallback<T> c)
pop in interface MorphiumWriterpublic void setMorphium(Morphium m)
setMorphium in interface MorphiumWriterpublic <T> void remove(List<T> lst, AsyncOperationCallback<T> c)
remove in interface MorphiumWriterpublic <T> void remove(Query<T> q, boolean multiple, AsyncOperationCallback<T> c)
remove in interface MorphiumWriterpublic <T> void remove(T o,
String collection,
AsyncOperationCallback<T> c)
remove in interface MorphiumWriterpublic <T> void remove(Query<T> q, AsyncOperationCallback<T> c)
MorphiumWriterremove in interface MorphiumWriterq - the querypublic <T> void pushPull(boolean push,
Query<T> q,
String field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> c)
pushPull in interface MorphiumWriterpublic <T> void pushPullAll(boolean push,
Query<T> q,
String field,
List<?> value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> c)
pushPullAll in interface MorphiumWriterpublic <T> void unset(T obj,
String collection,
String field,
AsyncOperationCallback<T> c)
MorphiumWriterunset in interface MorphiumWriterpublic <T> void unset(Query<T> query, String field, boolean multiple, AsyncOperationCallback<T> c)
unset in interface MorphiumWriterpublic <T> void unset(Query<T> query, AsyncOperationCallback<T> c, boolean multiple, String... fields)
unset in interface MorphiumWriterpublic <T> void unset(Query<T> query, AsyncOperationCallback<T> c, boolean multiple, Enum... fields)
unset in interface MorphiumWriterpublic <T> void dropCollection(Class<T> cls, String collection, AsyncOperationCallback<T> c)
dropCollection in interface MorphiumWriterpublic <T> void ensureIndex(Class<T> cls, String collection, Map<String,Object> index, AsyncOperationCallback<T> c)
public <T> void ensureIndex(Class<T> cls, String collection, Map<String,Object> index, Map<String,Object> options, AsyncOperationCallback<T> c)
ensureIndex in interface MorphiumWriterpublic int writeBufferCount()
writeBufferCount in interface MorphiumWriterpublic <T> void store(List<T> lst, AsyncOperationCallback<T> c)
MorphiumWriterstore in interface MorphiumWriterlst - - to storepublic void flush()
flush in interface MorphiumWriterprotected void finalize()
throws Throwable
public void onShutdown(Morphium m)
onShutdown in interface ShutdownListenerpublic void setMaximumQueingTries(int n)
setMaximumQueingTries in interface MorphiumWriterpublic void setPauseBetweenTries(int p)
setPauseBetweenTries in interface MorphiumWriterCopyright © 2016. All rights reserved.