Skip to content

Commit f48665a

Browse files
committed
version 0.0.1.0 update Normal alpha 13
1 parent 379454b commit f48665a

14 files changed

+67
-45
lines changed

src/top/gunplan/netty/GunBootServer.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* server interface ,has kinds of implements but now we have only one
11-
* {@link top.gunplan.netty.impl.GunBootServerImpl}
11+
* it is NioStdServerImpl
1212
*
1313
* @author dosdrtt
1414
* @since 0.0.0.1
@@ -41,28 +41,30 @@ public interface GunBootServer {
4141
GunBootServer setExecuters(@NotNull ExecutorService acceptExecuters, @NotNull ExecutorService requestExecuters);
4242

4343
/**
44-
* set a deal handel implement {@link GunNettyHandle }
45-
*
46-
* @param handel Execute Class
47-
* @return GunBootServer:this chain style
44+
* this method return a {@link GunPilelineInterface} implements
45+
* @return GunPilelineInterface
4846
*/
4947
GunPilelineInterface getPipeline();
5048

51-
/**
52-
* the function is used to add filter
53-
*
54-
* @param filter filter, filter the request
55-
* @return GunBootServer chain style
56-
*/
57-
49+
// /**
50+
// * the function is used to add filter
51+
// *
52+
// * @param filter filter, filter the request
53+
// * @return GunBootServer chain style
54+
// */
55+
//
56+
//
57+
// /**
58+
// * @param clazz class to deal
59+
// * @throws ClassNotFoundException class not found
60+
// * @apiNote
61+
// */
62+
// void inintObject(@NotNull Class<? extends GunHandle> clazz) throws Exception;
5863

5964
/**
60-
* @param clazz class to deal
61-
* @throws ClassNotFoundException class not found
62-
* @apiNote
65+
* check it can or not be boot
66+
* @return check result true is can be boot
6367
*/
64-
// void inintObject(@NotNull Class<? extends GunHandle> clazz) throws Exception;
65-
6668
boolean initCheck();
6769

6870
}

src/top/gunplan/netty/GunCoreEventLoopInterface.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
import java.nio.channels.SelectionKey;
44

55
/**
6-
*GunCoreEventLoopInterface event loop deal class
6+
* GunCoreEventLoopInterface event loop deal class
7+
* when event happened, function `dealEvent` will be
8+
* execute
9+
* @author dosdrtt
710
*/
811
public interface GunCoreEventLoopInterface {
912
/**
1013
* when the event come ,the method will be call back
1114
* @param key SelectionKey input the SelectionKey
12-
* @throws Exception SelectionKey
15+
* @throws Exception Kinds of Exception
1316
*/
1417
void dealEvent(SelectionKey key) throws Exception;
1518
}

src/top/gunplan/netty/GunException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package top.gunplan.netty;
22

33
/**
4-
* std exception
4+
* std exception in gun netty
55
* @author dosdrtt
66
*/
77
public class GunException extends RuntimeException {

src/top/gunplan/netty/GunHandle.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package top.gunplan.netty;
22

33
/**
4-
* this is a handle interface
4+
* this is a handle interface ,include {@link GunNettyFilter }
5+
* and {@link GunNettyHandle}
56
* @author dosdrtt
67
* @since 0.0.0.3
78
*/

src/top/gunplan/netty/GunNettyFilter.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package top.gunplan.netty;
22

33

4-
import top.gunplan.netty.impl.GunRequestFilterDto;
4+
import top.gunplan.netty.impl.GunInputFilterChecker;
55
import top.gunplan.netty.impl.example.GunOutputFilterDto;
66

77
/**
@@ -10,21 +10,26 @@
1010
* @author dosdrtt
1111
*/
1212
public interface GunNettyFilter extends GunHandle {
13-
/**
14-
* doing filter when the request occur
15-
*
16-
* @param filterDto input to the filter's deal Object
17-
* @return filter result true:next false:break
18-
*/
1913

20-
public enum DealResult {
14+
15+
enum DealResult {
2116
/**
22-
*
17+
* NOTDEALINPUT :do not deal input filter ,go for handle right away
18+
* CLOSE :do not deal any filter or handle
19+
* NEXT :nothing will happened
20+
* NOTDEALOUTPUT :exit output filter chain and handle but it wasn't close
21+
* NOTDEALALLNEXT:ecit all filter chain and handle but it wasn't close
2322
*/
2423
NOTDEALINPUT, CLOSE, NEXT, NOTDEALOUTPUT, NOTDEALALLNEXT;
2524
}
2625

27-
DealResult doInputFilter(GunRequestFilterDto filterDto) throws Exception;
26+
/**
27+
*
28+
* @param filterDto input filter dto
29+
* @return deal result {@link DealResult};
30+
* @throws Exception kinds of exception
31+
*/
32+
DealResult doInputFilter(GunInputFilterChecker filterDto) throws Exception;
2833

2934
/**
3035
* doing filter when the response occur

src/top/gunplan/netty/GunPilelineCheckResult.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package top.gunplan.netty;
22

33
/**
4-
*
4+
* @author dosdrtt
5+
* Thread safe
56
*/
67
public class GunPilelineCheckResult {
78
public enum CheckResult {
89
/**
9-
*
10+
* ERROR : do not have any filters or handls
11+
* SAFE : have been sat
12+
* WARNNING :
13+
* UNSAFE :
1014
*/
1115
ERROR, SAFE, WARNNING, UNSAFE
1216
}

src/top/gunplan/netty/common/GunNettyPropertyManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313

1414
/**
15+
* analyzing config information by reference
1516
* @author dosdrtt
1617
*/
1718
public final class GunNettyPropertyManager {

src/top/gunplan/netty/filters/GunHttpdHostCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import top.gunplan.netty.GunNettyFilter;
44
import top.gunplan.netty.anno.GunNetFilterOrder;
55
import top.gunplan.netty.common.GunNettyPropertyManager;
6-
import top.gunplan.netty.impl.GunRequestFilterDto;
6+
import top.gunplan.netty.impl.GunInputFilterChecker;
77
import top.gunplan.netty.impl.example.GunOutputFilterDto;
88
import top.gunplan.netty.protocol.GunHttp2InputProtocl;
99

1010
@GunNetFilterOrder(index = 2)
1111
public class GunHttpdHostCheck implements GunNettyFilter {
1212
@Override
13-
public DealResult doInputFilter(GunRequestFilterDto filterDto) {
13+
public DealResult doInputFilter(GunInputFilterChecker filterDto) {
1414
GunHttp2InputProtocl httpmessage = (GunHttp2InputProtocl) filterDto.getObject();
1515
return httpmessage.getRequstHead().get("Host").equals(GunNettyPropertyManager.getHttp().getHttphost()) ? DealResult.NEXT : DealResult.NOTDEALALLNEXT;
1616
}

src/top/gunplan/netty/filters/GunNettyStdFirstFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import top.gunplan.netty.anno.GunNetFilterOrder;
55
import top.gunplan.netty.common.GunNettyPropertyManager;
66
import top.gunplan.netty.impl.CunCoreDataEventLoop;
7-
import top.gunplan.netty.impl.GunRequestFilterDto;
7+
import top.gunplan.netty.impl.GunInputFilterChecker;
88
import top.gunplan.netty.impl.example.GunOutputFilterDto;
99
import top.gunplan.utils.AbstractGunBaseLogUtil;
1010
import top.gunplan.utils.GunBytesUtil;
@@ -29,7 +29,7 @@ private void dealCloseEvent(SelectionKey key) throws IOException {
2929
}
3030

3131
@Override
32-
public DealResult doInputFilter(GunRequestFilterDto filterDto) throws Exception {
32+
public DealResult doInputFilter(GunInputFilterChecker filterDto) throws Exception {
3333
byte[] readbata;
3434
SelectionKey key = filterDto.getKey();
3535

src/top/gunplan/netty/filters/GunStdHttp2Filter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package top.gunplan.netty.filters;
22

3-
import top.gunplan.netty.impl.GunRequestFilterDto;
3+
import top.gunplan.netty.impl.GunInputFilterChecker;
44
import top.gunplan.netty.GunNettyFilter;
55
import top.gunplan.netty.impl.example.GunOutputFilterDto;
66
import top.gunplan.netty.anno.GunNetFilterOrder;
@@ -13,7 +13,7 @@
1313
@GunNetFilterOrder(index = 1)
1414
public class GunStdHttp2Filter implements GunNettyFilter {
1515
@Override
16-
public DealResult doInputFilter(GunRequestFilterDto filterDto) {
16+
public DealResult doInputFilter(GunInputFilterChecker filterDto) {
1717
GunNetInputInterface protocl = new GunHttp2InputProtocl();
1818
protocl.unSerialize(filterDto.getSrc());
1919
filterDto.setObject(protocl);

src/top/gunplan/netty/filters/GunStdToStringFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package top.gunplan.netty.filters;
22

33
import top.gunplan.netty.GunNettyFilter;
4-
import top.gunplan.netty.impl.GunRequestFilterDto;
4+
import top.gunplan.netty.impl.GunInputFilterChecker;
55
import top.gunplan.netty.impl.example.GunOutputFilterDto;
66
import top.gunplan.netty.anno.GunNetFilterOrder;
77
import top.gunplan.netty.protocol.GunStdString;
@@ -12,7 +12,7 @@
1212
@GunNetFilterOrder
1313
public class GunStdToStringFilter implements GunNettyFilter {
1414
@Override
15-
public DealResult doInputFilter(GunRequestFilterDto filterDto) {
15+
public DealResult doInputFilter(GunInputFilterChecker filterDto) {
1616
GunStdString s = new GunStdString();
1717
s.unSerialize(filterDto.getSrc());
1818
filterDto.setObject(s);

src/top/gunplan/netty/impl/GunCoreCalculatorWorker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public final class GunCoreCalculatorWorker extends BaseGunNettyWorker {
2626

2727
@Override
2828
public synchronized void run() {
29-
final GunRequestFilterDto gunFilterObj = new GunRequestFilterDto(key);
29+
final GunInputFilterChecker gunFilterObj = new GunInputFilterChecker(key);
3030
for (GunNettyFilter filter : this.pileline.getFilters()) {
3131
GunNettyFilter.DealResult result = null;
3232
try {

src/top/gunplan/netty/impl/GunRequestFilterDto.java renamed to src/top/gunplan/netty/impl/GunInputFilterChecker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
/**
1212
* @author dosdrtt
1313
*/
14-
public final class GunRequestFilterDto {
14+
public final class GunInputFilterChecker {
1515
private SelectionKey key;
1616
private AtomicInteger size;
1717

1818

1919

20-
public GunRequestFilterDto(SelectionKey key) {
20+
public GunInputFilterChecker(SelectionKey key) {
2121
this.key = key;
2222
this.size = size;
2323
}
@@ -49,7 +49,7 @@ public GunNetInputInterface getObject() {
4949
return object;
5050
}
5151

52-
public GunRequestFilterDto(@NotNull byte[] src, GunNetInputInterface object) {
52+
public GunInputFilterChecker(@NotNull byte[] src, GunNetInputInterface object) {
5353
this.src = src;
5454
this.object = object;
5555
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package top.gunplan.netty.protocol;
2+
/**
3+
all of class in {@link top.gunplan.netty.protocol} is thread safe
4+
because it was not used by mult thread
5+
**/
6+

0 commit comments

Comments
 (0)