public class VbsClientShutdown
extends java.lang.Object
implements java.lang.Runnable
VbsClientShutdown is responsible for shutting down the client application
nicely. It does so by closing all threads with their own stop() methods.VbsClientShutdown is meant to be run when the application is shut down
and should therefore be added as a shutdown hook thread (Runtime.getRuntime().addShutdownHook()).
Note: shutdown hooks cannot be tested in Eclipse! | Modifier and Type | Field and Description |
|---|---|
private static org.apache.log4j.Logger |
log
Used to log different events.
|
private DatabaseHandler |
myDatabaseHandler
DatabaseHandler module of the VBS client. |
private DataTransmitter |
myDataTransmitter
DataTransmitter module of the VBS client. |
private FlowGenerator |
myFlowGenerator
FlowGenerator module of the VBS client. |
private PacketCapturer |
myPacketCapturer
PacketCapturer module of the VBS client. |
private PerformanceMonitor |
myPerformanceMonitor
PerformanceMonitor module of the VBS client. |
private SocketMonitor |
mySocketMonitor
SocketMonitor module of the VBS client. |
private java.lang.Thread |
shutdownThread
Thread used by this class.
|
| Constructor and Description |
|---|
VbsClientShutdown()
Constructs the class
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isAlive()
Checks if
VbsClientShutdown is alive. |
void |
run()
Sequentially stops all the modules of the VBS client, then stores values to a XML file and exits.
|
void |
setDatabaseHandler(DatabaseHandler myDatabaseHandler)
Sets reference to the
DatabaseHandler module. |
void |
setDataTransmitter(DataTransmitter myDataTransmitter)
Sets reference to the
DataTransmitter module. |
void |
setFlowGenerator(FlowGenerator myFlowGenerator)
Sets reference to the
FlowGenerator module. |
void |
setPacketCapturer(PacketCapturer myPacketCapturer)
Sets reference to the
PacketCapturer module. |
void |
setPerformanceMonitor(PerformanceMonitor myPerformanceMonitor)
Sets reference to the
PerformanceMonitor module. |
void |
setSocketMonitor(SocketMonitor mySocketMonitor)
Sets reference to the
SocketMonitor module. |
void |
start()
Starts the thread.
|
private void |
stopDatabaseHandler()
Stops the
DatabaseHandler module. |
private void |
stopDataTransmitter()
Stops the
DataTransmitter module. |
private void |
stopFlowGenerator()
Stops the
FlowGenerator module. |
private void |
stopPacketCapturer()
Stops the
PacketCapturer module. |
private void |
stopPerformanceMonitor()
Stops the
PerformanceMonitor module. |
private void |
stopSocketMonitor()
Stops the
SocketMonitor module. |
private static org.apache.log4j.Logger log
private java.lang.Thread shutdownThread
private PacketCapturer myPacketCapturer
PacketCapturer module of the VBS client.private SocketMonitor mySocketMonitor
SocketMonitor module of the VBS client.private FlowGenerator myFlowGenerator
FlowGenerator module of the VBS client.private DatabaseHandler myDatabaseHandler
DatabaseHandler module of the VBS client.private DataTransmitter myDataTransmitter
DataTransmitter module of the VBS client.private PerformanceMonitor myPerformanceMonitor
PerformanceMonitor module of the VBS client.public void start()
public boolean isAlive()
VbsClientShutdown is alive. It means that the thread must exist.true if the thread is operational, false otherwisepublic void run()
run in interface java.lang.Runnablepublic void setPacketCapturer(PacketCapturer myPacketCapturer)
PacketCapturer module.myPacketCapturer - reference to the PacketCapturer module.public void setSocketMonitor(SocketMonitor mySocketMonitor)
SocketMonitor module.mySocketMonitor - reference to the SocketMonitor module.public void setFlowGenerator(FlowGenerator myFlowGenerator)
FlowGenerator module.myFlowGenerator - reference to the FlowGenerator module.public void setDataTransmitter(DataTransmitter myDataTransmitter)
DataTransmitter module.myDataTransmitter - reference to the DataTransmitter module.public void setPerformanceMonitor(PerformanceMonitor myPerformanceMonitor)
PerformanceMonitor module.myPerformanceMonitor - reference to the PerformanceMonitor module.public void setDatabaseHandler(DatabaseHandler myDatabaseHandler)
DatabaseHandler module.myDatabaseHandler - reference to the DatabaseHandler module.private void stopPacketCapturer()
PacketCapturer module.private void stopSocketMonitor()
SocketMonitor module.private void stopFlowGenerator()
FlowGenerator module.private void stopDataTransmitter()
DataTransmitter module.private void stopPerformanceMonitor()
PerformanceMonitor module.private void stopDatabaseHandler()
DatabaseHandler module.