handy源码阅读(六):udp类】的更多相关文章

首先是tcpconn和tcpserver类: struct TcpConn : public std::enable_shared_from_this<TcpConn>, private noncopyable { enum State { Invalid = 1, Handshaking, Connected, Closed, Failed, }; TcpConn(); virtual ~TcpConn(); template <class C = TcpConn> static…
源码层面整理下我们常用的操作RDD数据处理与分析的函数,从而能更好的应用于工作中. 连接Hbase,读取hbase的过程,首先代码如下: def tableInitByTime(sc : SparkContext,tableName : String,columns : String,fromdate: Date,todate : Date) : RDD[(ImmutableBytesWritable,Result)] = { val configuration = HBaseConfigura…
分为UdpServer类和UdpConn类. struct UdpServer : public std::enable_shared_from_this<UdpServer>, private noncopyable { UdpServer(EventBases* bases); int bind(const std::string& host, unsigned short port, bool reusePort = false); static UpdServerPtr sta…
通道,封装了可以进行epoll的一个fd. struct Channel: private noncopyable { Channel(EventBase* base, int fd, int events); ~Channel(); EventBase* getBase() { return base_; } int fd() { return fd_; } //通道id int64_d id() { return id_; } short events() { return events_;…
SafeQueue类继承与信号量mutex(用于加锁),nonocopyable 定义如下: template <typename T> struct SafeQueue : private std::mutex, private noncopyable { static const int wait_infinite = std::numeric_limits<int>::max(); SafeQueue(size_t capacity = ) : capacity_(capac…
EventsImp用于完成事件的处理. class EventsImp { EventBase* base_; PollerBase* poller_; std::atomic<bool> exit_; ]; int nextTimeout_; SafeQueue<Task> tasks_; std::map<TimerId, TimerRepeatable> timerReps_; std::map<TimerId, Task> timers_; std:…
类EventBase继承于类EventBases,继承于noncopyable.  其中noncopyable是一个去除了拷贝构造和赋值构造的类. noncopyable: class noncopyable { public: noncopyable() = default; virtual ~nonocopyable() = default; noncopyable(const noncopyable& non) = delete; noncopyable& operator=(con…
使用poll内核函数等待事件发生: struct PollerBase: private noncopyable { int64_t id_; int lastActive_; PollerBase(): lastActive_(-) { ); id_ = ++id; } ; ; ; virtual ~PollerBase() {}; }; struct PollerEpoll : public PollerBase { int fd_; std::set<Channel*> liveChan…
Object 1. @HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate public final native Class<?> getClass(); 使用@HotSpotIntrinsicCandidate注解标注的方法,表示JVM可能为该方法提供了一些基于CPU指令的高效实现,而非使用Java的实现. 2. native方法 getClass().hashCode().clone().notify()等方法的默认实现都是native…
初始化过程中四个数据成员中的两个数据成员被初始化: 一.vc被初始化为STP提供的C调用接口函数vc_createValidityChecker(): 二.optimizeDivides被初始化为false 重点探讨另外两个数据成员. 一.ExprHashMap constructed ExprHashMap< std::pair<ExprHandle, unsigned> > constructed; ExprHashMap为一个模板类, 继承unorderedmap,由于自定义…