Search in sources :

Example 1 with DefaultPsync

use of com.ctrip.xpipe.redis.core.protocal.cmd.DefaultPsync 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;
}
Also used : Psync(com.ctrip.xpipe.redis.core.protocal.Psync) DefaultPsync(com.ctrip.xpipe.redis.core.protocal.cmd.DefaultPsync) DefaultPsync(com.ctrip.xpipe.redis.core.protocal.cmd.DefaultPsync)

Example 2 with DefaultPsync

use of com.ctrip.xpipe.redis.core.protocal.cmd.DefaultPsync in project x-pipe by ctripcorp.

the class PsyncTest method beforePsyncTest.

@Before
public void beforePsyncTest() throws Exception {
    masterOffset = (long) randomInt(0, Integer.MAX_VALUE - 1);
    replicationStoreManager = createReplicationStoreManager();
    LifecycleHelper.initializeIfPossible(replicationStoreManager);
    replicationStore = (DefaultReplicationStore) replicationStoreManager.create();
    SimpleObjectPool<NettyClient> clientPool = NettyPoolUtil.createNettyPool(new InetSocketAddress("127.0.0.1", 1234));
    psync = new DefaultPsync(clientPool, new DefaultEndPoint("127.0.0.1", 1234), replicationStoreManager, scheduled);
    psync.future().addListener(new CommandFutureListener<Object>() {

        @Override
        public void operationComplete(CommandFuture<Object> commandFuture) throws Exception {
            if (!commandFuture.isSuccess()) {
                logger.error("[operationComplete]", commandFuture.cause());
            }
        }
    });
}
Also used : NettyClient(com.ctrip.xpipe.netty.commands.NettyClient) InetSocketAddress(java.net.InetSocketAddress) DefaultEndPoint(com.ctrip.xpipe.endpoint.DefaultEndPoint) IOException(java.io.IOException) XpipeException(com.ctrip.xpipe.exception.XpipeException) DefaultPsync(com.ctrip.xpipe.redis.core.protocal.cmd.DefaultPsync) Before(org.junit.Before)

Aggregations

DefaultPsync (com.ctrip.xpipe.redis.core.protocal.cmd.DefaultPsync)2 DefaultEndPoint (com.ctrip.xpipe.endpoint.DefaultEndPoint)1 XpipeException (com.ctrip.xpipe.exception.XpipeException)1 NettyClient (com.ctrip.xpipe.netty.commands.NettyClient)1 Psync (com.ctrip.xpipe.redis.core.protocal.Psync)1 IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 Before (org.junit.Before)1