Class Server
- java.lang.Object
-
- org.drasyl.peer.connection.server.Server
-
- All Implemented Interfaces:
AutoCloseable
,DrasylNodeComponent
public class Server extends Object implements DrasylNodeComponent
The server binds to a defined port and thus allows the node to be discovered and contacted by other peers.
-
-
Constructor Summary
Constructors Constructor Description Server(Identity identity, Pipeline pipeline, PeersManager peersManager, DrasylConfig config, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, io.netty.channel.EventLoopGroup bossGroup, AtomicBoolean opened, BooleanSupplier acceptNewConnectionsSupplier, Set<Endpoint> nodeEndpoints)
Server for accepting connections from child peers and non-child peers.Server(Identity identity, Pipeline pipeline, PeersManager peersManager, DrasylConfig config, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, io.netty.channel.EventLoopGroup bossGroup, Set<Endpoint> nodeEndpoints, BooleanSupplier acceptNewConnectionsSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the server socket and all open client sockets.void
open()
Starts the server.
-
-
-
Constructor Detail
-
Server
public Server(Identity identity, Pipeline pipeline, PeersManager peersManager, DrasylConfig config, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, io.netty.channel.EventLoopGroup bossGroup, Set<Endpoint> nodeEndpoints, BooleanSupplier acceptNewConnectionsSupplier) throws ServerException
- Throws:
ServerException
-
Server
public Server(Identity identity, Pipeline pipeline, PeersManager peersManager, DrasylConfig config, PeerChannelGroup channelGroup, io.netty.channel.EventLoopGroup workerGroup, io.netty.channel.EventLoopGroup bossGroup, AtomicBoolean opened, BooleanSupplier acceptNewConnectionsSupplier, Set<Endpoint> nodeEndpoints) throws ServerException
Server for accepting connections from child peers and non-child peers.- Parameters:
identity
- the identity managerpipeline
- the pipeline objectpeersManager
- the peers managerconfig
- config that should be usedchannelGroup
- the channel groupworkerGroup
- netty shared worker groupbossGroup
- netty shared boss groupacceptNewConnectionsSupplier
- the accept new connections suppliernodeEndpoints
- the node endpoints- Throws:
ServerException
-
-
Method Detail
-
open
public void open() throws ServerException
Starts the server.- Specified by:
open
in interfaceDrasylNodeComponent
- Throws:
ServerException
-
close
public void close()
Closes the server socket and all open client sockets.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDrasylNodeComponent
-
-