Exception during RedissonReference object creation doesn't decrease shutdownLatch counter

pull/660/head
Nikita 8 years ago
parent 52af1a004a
commit 4baea4c9f6

@ -464,7 +464,22 @@ public class CommandAsyncService implements CommandAsyncExecutor {
return;
}
final RPromise<R> attemptPromise = connectionManager.newPromise();
final AsyncDetails<V, R> details = AsyncDetails.acquire();
if (isRedissonReferenceSupportEnabled()) {
try {
for (int i = 0; i < params.length; i++) {
RedissonReference reference = redisson != null
? RedissonObjectFactory.toReference(redisson, params[i])
: RedissonObjectFactory.toReference(redissonReactive, params[i]);
params[i] = reference == null ? params[i] : reference;
}
} catch (Exception e) {
connectionManager.getShutdownLatch().release();
mainPromise.tryFailure(e);
return;
}
}
final RFuture<RedisConnection> connectionFuture;
if (readOnlyMode) {
@ -473,15 +488,7 @@ public class CommandAsyncService implements CommandAsyncExecutor {
connectionFuture = connectionManager.connectionWriteOp(source, command);
}
final AsyncDetails<V, R> details = AsyncDetails.acquire();
if (isRedissonReferenceSupportEnabled()) {
for (int i = 0; i < params.length; i++) {
RedissonReference reference = redisson != null
? RedissonObjectFactory.toReference(redisson, params[i])
: RedissonObjectFactory.toReference(redissonReactive, params[i]);
params[i] = reference == null ? params[i] : reference;
}
}
final RPromise<R> attemptPromise = connectionManager.newPromise();
details.init(connectionFuture, attemptPromise,
readOnlyMode, source, codec, command, params, mainPromise, attempt);

@ -43,6 +43,7 @@ import org.redisson.api.annotation.RCascade;
import org.redisson.api.annotation.REntity;
import org.redisson.api.annotation.RFieldAccessor;
import org.redisson.api.annotation.RId;
import org.redisson.client.RedisException;
import org.redisson.liveobject.resolver.DefaultNamingScheme;
import org.redisson.liveobject.resolver.LongGenerator;
import org.redisson.liveobject.resolver.UUIDGenerator;
@ -1339,7 +1340,7 @@ public class RedissonLiveObjectServiceTest extends BaseTest {
assertThat(se.getItem("2")).isEqualTo(2);
}
@Test(expected = IllegalArgumentException.class)
@Test(expected = RedisException.class)
public void testObjectShouldNotBeAttached() {
Customer customer = new Customer("12");
customer = redisson.getLiveObjectService().persist(customer);

Loading…
Cancel
Save