bwLehrpool Masterserver
Manages authentication and sharing of virtual machines between participating institutions
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.openslx.imagemaster.localrpc.NetworkHandler Class Reference

The network listener that will receive incoming UDP packets, try to process them, and then send a reply. More...

+ Inheritance diagram for org.openslx.imagemaster.localrpc.NetworkHandler:
+ Collaboration diagram for org.openslx.imagemaster.localrpc.NetworkHandler:

Classes

class  Sender
 Private sending thread. More...
 

Public Member Functions

 NetworkHandler (int port, InetAddress listenAddress) throws SocketException
 Initialize the NetworkHandler by starting threads and opening the socket. More...
 
void shutdown ()
 
void run ()
 Main loop of receiving thread - wait until a packet arrives, then try to handle/decode. More...
 

Private Member Functions

void send (SocketAddress destination, byte[] buffer)
 Prepare and enqueue reply for client request. More...
 
String handle (String payload)
 

Private Attributes

Thread sendThread = null
 
final Sender sender
 Sender instance (Runnable handling outgoing packets) More...
 
final DatagramSocket socket
 UDP socket for sending and receiving. More...
 
final Gson gson = new Gson()
 Gson class. More...
 

Static Private Attributes

static final Logger log = LogManager.getLogger( NetworkHandler.class )
 

Detailed Description

The network listener that will receive incoming UDP packets, try to process them, and then send a reply.

Definition at line 27 of file NetworkHandler.java.

Constructor & Destructor Documentation

org.openslx.imagemaster.localrpc.NetworkHandler.NetworkHandler ( int  port,
InetAddress  listenAddress 
) throws SocketException

Initialize the NetworkHandler by starting threads and opening the socket.

Definition at line 49 of file NetworkHandler.java.

Member Function Documentation

String org.openslx.imagemaster.localrpc.NetworkHandler.handle ( String  payload)
private

Definition at line 125 of file NetworkHandler.java.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void org.openslx.imagemaster.localrpc.NetworkHandler.run ( )

Main loop of receiving thread - wait until a packet arrives, then try to handle/decode.

Definition at line 88 of file NetworkHandler.java.

+ Here is the call graph for this function:

void org.openslx.imagemaster.localrpc.NetworkHandler.send ( SocketAddress  destination,
byte[]  buffer 
)
private

Prepare and enqueue reply for client request.

Only ever to be called from the receiving thread. The reply message is crafted and then handed over to the sending thread.

Parameters
destinationSocketAddress of the client
messageIdThe same ID the client used in it's request. It's echoed back to the client to enable request bursts, and has no meaning for the server.
statusA TaskStatus instance to be serialized to json and sent to the client.

Definition at line 71 of file NetworkHandler.java.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void org.openslx.imagemaster.localrpc.NetworkHandler.shutdown ( )

Definition at line 55 of file NetworkHandler.java.

Member Data Documentation

final Gson org.openslx.imagemaster.localrpc.NetworkHandler.gson = new Gson()
private

Gson class.

Definition at line 44 of file NetworkHandler.java.

final Logger org.openslx.imagemaster.localrpc.NetworkHandler.log = LogManager.getLogger( NetworkHandler.class )
staticprivate

Definition at line 30 of file NetworkHandler.java.

final Sender org.openslx.imagemaster.localrpc.NetworkHandler.sender
private

Sender instance (Runnable handling outgoing packets)

Definition at line 36 of file NetworkHandler.java.

Thread org.openslx.imagemaster.localrpc.NetworkHandler.sendThread = null
private

Definition at line 32 of file NetworkHandler.java.

final DatagramSocket org.openslx.imagemaster.localrpc.NetworkHandler.socket
private

UDP socket for sending and receiving.

Definition at line 40 of file NetworkHandler.java.


The documentation for this class was generated from the following file: