use of com.ctrip.xpipe.redis.core.protocal.Psync in project x-pipe by ctripcorp.
the class ReplconfTest method test.
@Test
public void test() throws Exception {
for (int i = 0; i < 100; i++) {
FixedObjectPool<NettyClient> clientPool = null;
try {
clientPool = createClientPool(host, port);
Replconf replconf = new Replconf(clientPool, ReplConfType.LISTENING_PORT, scheduled, String.valueOf(1234));
replconf.execute().addListener(new CommandFutureListener<Object>() {
@Override
public void operationComplete(CommandFuture<Object> commandFuture) throws Exception {
logger.info("{}", commandFuture.get());
}
});
Psync psync = new InMemoryPsync(clientPool, "?", -1L, scheduled);
try {
psync.execute().get(100, TimeUnit.MILLISECONDS);
Assert.fail();
} catch (TimeoutException e) {
}
} finally {
if (clientPool != null) {
clientPool.getObject().channel().close();
}
}
}
}
use of com.ctrip.xpipe.redis.core.protocal.Psync in project x-pipe by ctripcorp.
the class RdbonlyRedisMasterReplication method createPsync.
@Override
protected Psync createPsync() {
Psync psync = new RdbOnlyPsync(clientPool, rdbOnlyReplicationStore, scheduled);
psync.addPsyncObserver(this);
return psync;
}
use of com.ctrip.xpipe.redis.core.protocal.Psync in project x-pipe by ctripcorp.
the class AbstractRedisMasterReplication method psyncCommand.
protected Psync psyncCommand() {
if (getLifecycleState().isStopping() || getLifecycleState().isStopped()) {
logger.info("[psyncCommand][stopped]{}", this);
return null;
}
Psync psync = createPsync();
psync.future().addListener(new CommandFutureListener<Object>() {
@Override
public void operationComplete(CommandFuture<Object> commandFuture) throws Exception {
if (!commandFuture.isSuccess()) {
logger.error("[operationComplete][psyncCommand][fail]" + AbstractRedisMasterReplication.this, commandFuture.cause());
dumpFail(commandFuture.cause());
psyncFail(commandFuture.cause());
}
}
});
return psync;
}
use of com.ctrip.xpipe.redis.core.protocal.Psync in project x-pipe by ctripcorp.
the class DefaultRedisMasterReplication method createPsync.
@Override
protected Psync createPsync() {
Psync psync = new DefaultPsync(clientPool, redisMaster.masterEndPoint(), redisMaster.getReplicationStoreManager(), scheduled);
psync.addPsyncObserver(this);
psync.addPsyncObserver(redisKeeperServer);
return psync;
}
Aggregations