RLiveObjectService.persist optimization

pull/2382/head
Nikita Koksharov 5 years ago
parent 10bfcac10b
commit 8b8cbab950

@ -212,10 +212,11 @@ public class RedissonLiveObjectService implements RLiveObjectService {
continue;
}
String idFieldName = getRIdFieldName(detachedObject.getClass());
validateAnnotation(detachedObject, field.getName());
copy(detachedObject, attachedObject, Arrays.asList(idFieldName));
}
String idFieldName = getRIdFieldName(detachedObject.getClass());
copy(detachedObject, attachedObject, Arrays.asList(idFieldName));
}
commandExecutor.execute();

@ -199,9 +199,11 @@ public class AccessorInterceptor {
NamingScheme namingScheme = connectionManager.getCommandExecutor().getObjectBuilder().getNamingScheme(me.getClass().getSuperclass());
String indexName = namingScheme.getIndexName(me.getClass().getSuperclass(), field.getName());
boolean skipExecution = false;
CommandBatchService ce;
if (commandExecutor instanceof CommandBatchService) {
ce = (CommandBatchService) commandExecutor;
skipExecution = true;
} else {
ce = new CommandBatchService(connectionManager);
}
@ -213,7 +215,10 @@ public class AccessorInterceptor {
RMultimapAsync<Object, Object> map = new RedissonSetMultimap<>(namingScheme.getCodec(), ce, indexName);
map.putAsync(arg, ((RLiveObject) me).getLiveObjectId());
}
ce.execute();
if (!skipExecution) {
ce.execute();
}
}
}

Loading…
Cancel
Save