public class MorphiumWriterImpl extends Object implements MorphiumWriter, ShutdownListener
default writer implementation - uses a ThreadPoolExecutor for execution of asynchornous calls maximum Threads are limited to 0.9* MaxConnections configured in MorphiumConfig
MorphiumWriter| Modifier and Type | Class and Description |
|---|---|
class |
MorphiumWriterImpl.WT<T> |
| Constructor and Description |
|---|
MorphiumWriterImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
information about closing of morphium and all connections
|
<T> void |
convertToCapped(Class<T> c)
automatically convert the collection for the given type to a capped collection
only works if @Capped annotation is given for type
|
<T> void |
convertToCapped(Class<T> c,
AsyncOperationCallback<T> callback) |
<T> void |
dropCollection(Class<T> cls,
String collection,
AsyncOperationCallback<T> callback) |
<T> void |
ensureIndex(Class<T> cls,
String collection,
Map<String,Object> index,
Map<String,Object> options,
AsyncOperationCallback<T> callback) |
void |
flush() |
void |
flush(Class type) |
<T> void |
inc(Query<T> query,
Map<String,Number> fieldsToInc,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> callback) |
<T> void |
inc(Query<T> query,
String field,
Number amount,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> callback) |
<T> void |
inc(T toInc,
String collection,
String field,
Number amount,
AsyncOperationCallback<T> callback)
Increases a value in an existing mongo collection entry - no reading necessary.
|
<T> void |
insert(List<T> lst,
AsyncOperationCallback<T> callback) |
<T> void |
insert(List<T> lst,
String cn,
AsyncOperationCallback<T> callback) |
<T> void |
insert(T obj,
String collection,
AsyncOperationCallback<T> callback) |
void |
onShutdown(Morphium m) |
<T> void |
pop(T obj,
String collection,
String field,
boolean first,
AsyncOperationCallback<T> callback) |
<T> void |
pushPull(boolean push,
Query<T> query,
String field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> callback) |
<T> void |
pushPullAll(boolean push,
Query<T> query,
String f,
List<?> v,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> callback) |
<T> void |
remove(List<T> lst,
AsyncOperationCallback<T> callback) |
<T> void |
remove(Query<T> q,
AsyncOperationCallback<T> callback)
deletes all objects matching the given query
|
<T> void |
remove(Query<T> q,
boolean multiple,
AsyncOperationCallback<T> callback) |
<T> void |
remove(T o,
String collection,
AsyncOperationCallback<T> callback) |
<T> void |
set(Query<T> query,
Map<String,Object> values,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> callback)
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 v,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> callback)
changes an object in DB AND in Memory...
|
void |
setMaximumQueingTries(int n) |
void |
setMorphium(Morphium m) |
void |
setPauseBetweenTries(int p) |
<T> void |
store(List<T> lst,
AsyncOperationCallback<T> callback)
stores the given list of objects, should be entities or embedded.
|
<T> void |
store(List<T> lst,
String cln,
AsyncOperationCallback<T> callback) |
<T> void |
store(T obj,
String collection,
AsyncOperationCallback<T> callback)
Stores the object, should be an entity
|
<T> void |
submitAndBlockIfNecessary(AsyncOperationCallback<T> callback,
WriterTask<T> r) |
<T> void |
unset(Query<T> query,
AsyncOperationCallback<T> callback,
boolean multiple,
Enum... fields) |
<T> void |
unset(Query<T> query,
AsyncOperationCallback<T> callback,
boolean multiple,
String... fields) |
<T> void |
unset(Query<T> query,
String field,
boolean multiple,
AsyncOperationCallback<T> callback) |
<T> void |
unset(T toSet,
String collection,
String field,
AsyncOperationCallback<T> callback)
Un-setting a value in an existing mongo collection entry - no reading necessary.
|
<T> void |
updateUsingFields(T ent,
String collection,
AsyncOperationCallback<T> callback,
String... fields)
update an object using fields specified
|
int |
writeBufferCount() |
public void setMaximumQueingTries(int n)
setMaximumQueingTries in interface MorphiumWriterpublic void setPauseBetweenTries(int p)
setPauseBetweenTries in interface MorphiumWriterpublic void setMorphium(Morphium m)
setMorphium in interface MorphiumWriterpublic void close()
MorphiumWriterclose in interface MorphiumWriterpublic <T> void insert(List<T> lst, AsyncOperationCallback<T> callback)
insert in interface MorphiumWriterpublic <T> void insert(List<T> lst, String cn, AsyncOperationCallback<T> callback)
insert in interface MorphiumWriterpublic <T> void insert(T obj,
String collection,
AsyncOperationCallback<T> callback)
insert in interface MorphiumWriterpublic <T> void store(T obj,
String collection,
AsyncOperationCallback<T> callback)
MorphiumWriterstore in interface MorphiumWriterobj - - object to storepublic <T> void store(List<T> lst, String cln, AsyncOperationCallback<T> callback)
store in interface MorphiumWriterpublic void flush()
flush in interface MorphiumWriterpublic void flush(Class type)
flush in interface MorphiumWriterpublic <T> void store(List<T> lst, AsyncOperationCallback<T> callback)
MorphiumWriterstore in interface MorphiumWriterlst - - to storepublic <T> void convertToCapped(Class<T> c)
c - - typepublic <T> void convertToCapped(Class<T> c, AsyncOperationCallback<T> callback)
public <T> void set(T toSet,
String collection,
String field,
Object v,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> callback)
MorphiumWriterset in interface MorphiumWritertoSet - entity to set values in both in mongo and in memoryfield - fieldv - value to setpublic <T> void submitAndBlockIfNecessary(AsyncOperationCallback<T> callback, WriterTask<T> r)
public <T> void updateUsingFields(T ent,
String collection,
AsyncOperationCallback<T> callback,
String... fields)
MorphiumWriterupdateUsingFields in interface MorphiumWriterent - entityfields - - fieldspublic <T> void remove(List<T> lst, AsyncOperationCallback<T> callback)
remove in interface MorphiumWriterpublic <T> void remove(Query<T> q, AsyncOperationCallback<T> callback)
remove in interface MorphiumWriterq - - querypublic <T> void remove(Query<T> q, boolean multiple, AsyncOperationCallback<T> callback)
remove in interface MorphiumWriterpublic <T> void remove(T o,
String collection,
AsyncOperationCallback<T> callback)
remove in interface MorphiumWriterpublic <T> void inc(T toInc,
String collection,
String field,
Number amount,
AsyncOperationCallback<T> callback)
inc in interface MorphiumWritertoInc: - object to set the value in (or better - the corresponding entry in mongo)field: - the field to changeamount: - the value to setpublic <T> void inc(Query<T> query, Map<String,Number> fieldsToInc, boolean upsert, boolean multiple, AsyncOperationCallback<T> callback)
inc in interface MorphiumWriterpublic <T> void inc(Query<T> query, String field, Number amount, boolean upsert, boolean multiple, AsyncOperationCallback<T> callback)
inc in interface MorphiumWriterpublic <T> void set(Query<T> query, Map<String,Object> values, boolean upsert, boolean multiple, AsyncOperationCallback<T> callback)
set 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 unset(Query<T> query, AsyncOperationCallback<T> callback, boolean multiple, Enum... fields)
unset in interface MorphiumWriterpublic <T> void unset(Query<T> query, AsyncOperationCallback<T> callback, boolean multiple, String... fields)
unset in interface MorphiumWriterpublic <T> void unset(T toSet,
String collection,
String field,
AsyncOperationCallback<T> callback)
unset in interface MorphiumWritertoSet: - object to set the value in (or better - the corresponding entry in mongo)field: - field to remove from documentpublic <T> void pop(T obj,
String collection,
String field,
boolean first,
AsyncOperationCallback<T> callback)
pop in interface MorphiumWriterpublic <T> void unset(Query<T> query, String field, boolean multiple, AsyncOperationCallback<T> callback)
unset in interface MorphiumWriterpublic <T> void pushPull(boolean push,
Query<T> query,
String field,
Object value,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> callback)
pushPull in interface MorphiumWriterpublic <T> void pushPullAll(boolean push,
Query<T> query,
String f,
List<?> v,
boolean upsert,
boolean multiple,
AsyncOperationCallback<T> callback)
pushPullAll in interface MorphiumWriterpublic <T> void dropCollection(Class<T> cls, String collection, AsyncOperationCallback<T> callback)
dropCollection in interface MorphiumWriterpublic <T> void ensureIndex(Class<T> cls, String collection, Map<String,Object> index, Map<String,Object> options, AsyncOperationCallback<T> callback)
ensureIndex in interface MorphiumWriterpublic int writeBufferCount()
writeBufferCount in interface MorphiumWriterpublic void onShutdown(Morphium m)
onShutdown in interface ShutdownListenerCopyright © 2019. All rights reserved.