Class ServerApp

java.lang.Object
com.cloud.serverpak.ServerApp
All Implemented Interfaces:
Runnable

public class ServerApp extends Object implements Runnable
The class that starts the Netty Server. Performs server configuration, creates pipeline consisting of ObjectDecoder(), ObjectEncoder() and MainHandler().
See Also:
  • ServerBootstrap
  • NioEventLoopGroup
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static AuthService
    Authorization service.
    private io.netty.channel.Channel
    The current connection channel.
    private io.netty.channel.EventLoopGroup
    A thread pool for working with clients.
    private MainHandler
    The primary listener of incoming message objects.
    private io.netty.channel.EventLoopGroup
    A pool of threads for working with the data being sent.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run()
    The method of starting the server.
    void
    Stops the server and listener thread pools.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • authService

      private static AuthService authService
      Authorization service. AuthService
    • currentChannel

      private io.netty.channel.Channel currentChannel
      The current connection channel.
    • mainGroup

      private io.netty.channel.EventLoopGroup mainGroup
      A thread pool for working with clients.
    • workerGroup

      private io.netty.channel.EventLoopGroup workerGroup
      A pool of threads for working with the data being sent.
    • mainHandler

      private MainHandler 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.
      Specified by:
      run in interface Runnable
    • stop

      public void stop()
      Stops the server and listener thread pools.