Package com.cloud.serverpak
Class ServerApp
java.lang.Object
com.cloud.serverpak.ServerApp
- All Implemented Interfaces:
Runnable
The class that starts the Netty Server. Performs server configuration, creates
pipeline consisting of
ObjectDecoder(),
ObjectEncoder() and MainHandler().- See Also:
-
ServerBootstrapNioEventLoopGroup
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static AuthServiceAuthorization service.private io.netty.channel.ChannelThe current connection channel.private io.netty.channel.EventLoopGroupA thread pool for working with clients.private MainHandlerThe primary listener of incoming message objects.private io.netty.channel.EventLoopGroupA pool of threads for working with the data being sent. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
authService
Authorization service.AuthService -
currentChannel
private io.netty.channel.Channel currentChannelThe current connection channel. -
mainGroup
private io.netty.channel.EventLoopGroup mainGroupA thread pool for working with clients. -
workerGroup
private io.netty.channel.EventLoopGroup workerGroupA pool of threads for working with the data being sent. -
mainHandler
The primary listener of incoming message objects.
-
-
Constructor Details
-
ServerApp
public ServerApp()
-
-
Method Details
-
run
public void run()The method of starting the server. To run, creates 2 thread pools, creates a server object, Defines a data processing pipeline for it. In the conveyor, defines maximum size of bytes to send (10 mb). When creating the main listener passes him a link to the authorization service in the constructor. -
stop
public void stop()Stops the server and listener thread pools.
-