-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHttpServletManager.h
53 lines (37 loc) · 1004 Bytes
/
HttpServletManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* File: HttpServletManager.h
* Author: try
*
* Created on 2011年7月11日, 上午8:58
*/
#ifndef HTTPSERVLETMANAGER_H
#define HTTPSERVLETMANAGER_H
#include <time.h>
#include <queue>
#include "ICleaner.h"
#include "HttpServletFactory.h"
#include "HttpServlet.h"
class HttpServletManager : public ICleaner{
private:
HttpServletManager();
virtual ~HttpServletManager();
public:
static HttpServletManager instance;
static void init(HttpServletFactory* factory);
HttpServlet* create(const char* path);
void recycle(HttpServlet* servlet);
/**
* @see Cleaner#cleanup()
*/
void cleanup();
private:
typedef struct Entry{
HttpServlet* servlet;
time_t t; //返还时间, 单位:秒
Entry(HttpServlet* servlet, time_t t):servlet(servlet), t(t){}
}Entry;
private:
HttpServletFactory* factory;
std::queue<Entry*> freeQueue;
};
#endif /* HTTPSERVLETMANAGER_H */