当前位置: 首页>>代码示例>>Java>>正文


Java WatchRegistration类代码示例

本文整理汇总了Java中org.apache.zookeeper.ZooKeeper.WatchRegistration的典型用法代码示例。如果您正苦于以下问题:Java WatchRegistration类的具体用法?Java WatchRegistration怎么用?Java WatchRegistration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WatchRegistration类属于org.apache.zookeeper.ZooKeeper包,在下文中一共展示了WatchRegistration类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Packet

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
/** Convenience ctor */
Packet(RequestHeader requestHeader, ReplyHeader replyHeader,
       Record request, Record response,
       WatchRegistration watchRegistration) {
    this(requestHeader, replyHeader, request, response,
         watchRegistration, false);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:8,代码来源:ClientCnxn.java

示例2: submitRequest

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
public ReplyHeader submitRequest(RequestHeader h, Record request,
        Record response, WatchRegistration watchRegistration)
        throws InterruptedException {
    ReplyHeader r = new ReplyHeader();
    //客户端和服务器之间进行网络传输的最小通信单位
    Packet packet = queuePacket(h, r, request, response, null, null, null,
                null, watchRegistration);
    synchronized (packet) {
        while (!packet.finished) {
            packet.wait();
        }
    }
    return r;
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:15,代码来源:ClientCnxn.java

示例3: queuePacket

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
Packet queuePacket(RequestHeader h, ReplyHeader r, Record request,
        Record response, AsyncCallback cb, String clientPath,
        String serverPath, Object ctx, WatchRegistration watchRegistration)
{
    Packet packet = null;

    // Note that we do not generate the Xid for the packet yet. It is
    // generated later at send-time, by an implementation of ClientCnxnSocket::doIO(),
    // where the packet is actually sent.
    synchronized (outgoingQueue) {
        packet = new Packet(h, r, request, response, watchRegistration);
        packet.cb = cb;
        packet.ctx = ctx;
        packet.clientPath = clientPath;
        packet.serverPath = serverPath;
        if (!state.isAlive() || closing) {
            conLossPacket(packet);
        } else {
            // If the client is asking to close the session then
            // mark as closing
            if (h.getType() == OpCode.closeSession) {
                closing = true;
            }
            //放入发送队列中,等待客户端发送
            //Line1159:SendThread.run clientCnxnSocket.doTransport
            outgoingQueue.add(packet);
        }
    }
    sendThread.getClientCnxnSocket().wakeupCnxn();
    return packet;
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:32,代码来源:ClientCnxn.java

示例4: submitRequest

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
public ReplyHeader submitRequest(RequestHeader h, Record request,
        Record response, WatchRegistration watchRegistration,
        WatchDeregistration watchDeregistration)
        throws InterruptedException {
    ReplyHeader r = new ReplyHeader();
    Packet packet = queuePacket(h, r, request, response, null, null, null,
            null, watchRegistration, watchDeregistration);
    synchronized (packet) {
        while (!packet.finished) {
            packet.wait();
        }
    }
    return r;
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:15,代码来源:ClientCnxn.java

示例5: queuePacket

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
public Packet queuePacket(RequestHeader h, ReplyHeader r, Record request,
        Record response, AsyncCallback cb, String clientPath,
        String serverPath, Object ctx, WatchRegistration watchRegistration,
        WatchDeregistration watchDeregistration) {
    Packet packet = null;

    // Note that we do not generate the Xid for the packet yet. It is
    // generated later at send-time, by an implementation of ClientCnxnSocket::doIO(),
    // where the packet is actually sent.
    packet = new Packet(h, r, request, response, watchRegistration);
    packet.cb = cb;
    packet.ctx = ctx;
    packet.clientPath = clientPath;
    packet.serverPath = serverPath;
    packet.watchDeregistration = watchDeregistration;
    // The synchronized block here is for two purpose:
    // 1. synchronize with the final cleanup() in SendThread.run() to avoid race
    // 2. synchronized against each packet. So if a closeSession packet is added,
    // later packet will be notified.
    synchronized (state) {
        if (!state.isAlive() || closing) {
            conLossPacket(packet);
        } else {
            // If the client is asking to close the session then
            // mark as closing
            if (h.getType() == OpCode.closeSession) {
                closing = true;
            }
            outgoingQueue.add(packet);
        }
    }
    sendThread.getClientCnxnSocket().packetAdded();
    return packet;
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:35,代码来源:ClientCnxn.java

示例6: submitRequest

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
public ReplyHeader submitRequest(RequestHeader h, Record request,
        Record response, WatchRegistration watchRegistration)
        throws InterruptedException {
    ReplyHeader r = new ReplyHeader();
    Packet packet = queuePacket(h, r, request, response, null, null, null,
                null, watchRegistration);
    synchronized (packet) {
        while (!packet.finished) {
            packet.wait();
        }
    }
    return r;
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:14,代码来源:ClientCnxn.java

示例7: queuePacket

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
Packet queuePacket(RequestHeader h, ReplyHeader r, Record request,
        Record response, AsyncCallback cb, String clientPath,
        String serverPath, Object ctx, WatchRegistration watchRegistration)
{
    Packet packet = null;

    // Note that we do not generate the Xid for the packet yet. It is
    // generated later at send-time, by an implementation of ClientCnxnSocket::doIO(),
    // where the packet is actually sent.
    synchronized (outgoingQueue) {
        packet = new Packet(h, r, request, response, watchRegistration);
        packet.cb = cb;
        packet.ctx = ctx;
        packet.clientPath = clientPath;
        packet.serverPath = serverPath;
        if (!state.isAlive() || closing) {
            conLossPacket(packet);
        } else {
            // If the client is asking to close the session then
            // mark as closing
            if (h.getType() == OpCode.closeSession) {
                closing = true;
            }
            outgoingQueue.add(packet);
        }
    }
    sendThread.getClientCnxnSocket().wakeupCnxn();
    return packet;
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:30,代码来源:ClientCnxn.java

示例8: queuePacket

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
Packet queuePacket(RequestHeader h, ReplyHeader r, Record request,
        Record response, AsyncCallback cb, String clientPath,
        String serverPath, Object ctx, WatchRegistration watchRegistration)
{
    Packet packet = null;
    synchronized (outgoingQueue) {
        if (h.getType() != OpCode.ping && h.getType() != OpCode.auth) {
            h.setXid(getXid());
        }
        packet = new Packet(h, r, request, response, watchRegistration);
        packet.cb = cb;
        packet.ctx = ctx;
        packet.clientPath = clientPath;
        packet.serverPath = serverPath;
        if (!state.isAlive() || closing) {
            conLossPacket(packet);
        } else {
            // If the client is asking to close the session then
            // mark as closing
            if (h.getType() == OpCode.closeSession) {
                closing = true;
            }
            outgoingQueue.add(packet);
        }
    }
    sendThread.getClientCnxnSocket().wakeupCnxn();
    return packet;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:29,代码来源:ClientCnxn.java

示例9: Packet

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
/**
 * Convenience ctor
 */
Packet(RequestHeader requestHeader, ReplyHeader replyHeader,
       Record request, Record response,
       WatchRegistration watchRegistration) {
    this(requestHeader, replyHeader, request, response,
            watchRegistration, false);
}
 
开发者ID:blentle,项目名称:zookeeper-src-learning,代码行数:10,代码来源:ClientCnxn.java

示例10: submitRequest

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
public ReplyHeader submitRequest(RequestHeader h, Record request,
                                 Record response, WatchRegistration watchRegistration)
        throws InterruptedException {
    ReplyHeader r = new ReplyHeader();
    Packet packet = queuePacket(h, r, request, response, null, null, null,
            null, watchRegistration);
    synchronized (packet) {
        while (!packet.finished) {
            packet.wait();
        }
    }
    return r;
}
 
开发者ID:blentle,项目名称:zookeeper-src-learning,代码行数:14,代码来源:ClientCnxn.java

示例11: queuePacket

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
Packet queuePacket(RequestHeader h, ReplyHeader r, Record request,
                   Record response, AsyncCallback cb, String clientPath,
                   String serverPath, Object ctx, WatchRegistration watchRegistration) {
    Packet packet = null;

    // Note that we do not generate the Xid for the packet yet. It is
    // generated later at send-time, by an implementation of ClientCnxnSocket::doIO(),
    // where the packet is actually sent.
    synchronized (outgoingQueue) {
        packet = new Packet(h, r, request, response, watchRegistration);
        packet.cb = cb;
        packet.ctx = ctx;
        packet.clientPath = clientPath;
        packet.serverPath = serverPath;
        if (!state.isAlive() || closing) {
            conLossPacket(packet);
        } else {
            // If the client is asking to close the session then
            // mark as closing
            if (h.getType() == OpCode.closeSession) {
                closing = true;
            }
            outgoingQueue.add(packet);
        }
    }
    sendThread.getClientCnxnSocket().wakeupCnxn();
    return packet;
}
 
开发者ID:blentle,项目名称:zookeeper-src-learning,代码行数:29,代码来源:ClientCnxn.java

示例12: queuePacket

import org.apache.zookeeper.ZooKeeper.WatchRegistration; //导入依赖的package包/类
Packet queuePacket(RequestHeader h, ReplyHeader r, Record request,
        Record response, AsyncCallback cb, String clientPath,
        String serverPath, Object ctx, WatchRegistration watchRegistration,
        WatchDeregistration watchDeregistration) {
    Packet packet = null;

    // Note that we do not generate the Xid for the packet yet. It is
    // generated later at send-time, by an implementation of ClientCnxnSocket::doIO(),
    // where the packet is actually sent.
    packet = new Packet(h, r, request, response, watchRegistration);
    packet.cb = cb;
    packet.ctx = ctx;
    packet.clientPath = clientPath;
    packet.serverPath = serverPath;
    packet.watchDeregistration = watchDeregistration;
    // The synchronized block here is for two purpose:
    // 1. synchronize with the final cleanup() in SendThread.run() to avoid race
    // 2. synchronized against each packet. So if a closeSession packet is added,
    // later packet will be notified.
    synchronized (state) {
        if (!state.isAlive() || closing) {
            conLossPacket(packet);
        } else {
            // If the client is asking to close the session then
            // mark as closing
            if (h.getType() == OpCode.closeSession) {
                closing = true;
            }
            outgoingQueue.add(packet);
        }
    }
    sendThread.getClientCnxnSocket().packetAdded();
    return packet;
}
 
开发者ID:sereca,项目名称:SecureKeeper,代码行数:35,代码来源:ClientCnxn.java


注:本文中的org.apache.zookeeper.ZooKeeper.WatchRegistration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。