11.07.2015 Views

System Introspection for System Analysis on Mobile Devices

System Introspection for System Analysis on Mobile Devices

System Introspection for System Analysis on Mobile Devices

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

stop all active processes of the corresp<strong>on</strong>ding client. The frequency of the loopand the count of maximum missing beac<strong>on</strong>s are defined in the XML c<strong>on</strong>figurati<strong>on</strong>file. To receive incoming beac<strong>on</strong>s the MainDispatcher also observesthe Communicator. When a new beac<strong>on</strong> is received the beac<strong>on</strong> count <str<strong>on</strong>g>for</str<strong>on</strong>g> thecorresp<strong>on</strong>ding client reseted to zero.Comp<strong>on</strong>entDispatcherThe Comp<strong>on</strong>entDispatcher class c<strong>on</strong>trols the communicati<strong>on</strong> between comp<strong>on</strong>entthreads and clients and observes the Communicator <str<strong>on</strong>g>for</str<strong>on</strong>g> new requestsfrom clients. The available commands are stored inside a C<strong>on</strong>stants class.To c<strong>on</strong>trol the different comp<strong>on</strong>ent threads the Comp<strong>on</strong>entDispatcher holdsa list of all available comp<strong>on</strong>ent threads and their current state. On requestthe list is <str<strong>on</strong>g>for</str<strong>on</strong>g>warded to the to clients. When a client requests the data of acomp<strong>on</strong>ent thread, the Comp<strong>on</strong>entDispatcher checks the current state of thecomp<strong>on</strong>ent thread. If the state is RUNNING, the client is added to the clientlist of the comp<strong>on</strong>ent thread. If the state is SLEEPING, the client is added tothe client list and a notify() event is executed to activate the comp<strong>on</strong>entthread. Whenever a client requests a disc<strong>on</strong>nect from a comp<strong>on</strong>ent thread,the dispatcher removes the client from the list of the corresp<strong>on</strong>ding comp<strong>on</strong>entthreads.Comp<strong>on</strong>entThread - Live Observati<strong>on</strong>For the implementati<strong>on</strong> of a comp<strong>on</strong>ent thread a Comp<strong>on</strong>entThreadInterfaceand a Comp<strong>on</strong>entThread base class where created. The idea of the base classis to capsule the methods <str<strong>on</strong>g>for</str<strong>on</strong>g> receiving and sending messages and <strong>on</strong>ly offersimpler functi<strong>on</strong>ality <str<strong>on</strong>g>for</str<strong>on</strong>g> the extending classes. For receiving messages thebase class observes the Communicator. New messages are handled inside theupdate() method by reading messages from the Communicator. The elementsof the messages are parsed and stored in the receivedProperties map <str<strong>on</strong>g>for</str<strong>on</strong>g>further processing. Due to the need of executing multiple comp<strong>on</strong>ent threadsin parallel the Comp<strong>on</strong>entThread extends the Thread class.The base class holds several lists. The c<strong>on</strong>nectedClients list c<strong>on</strong>tains allclients currently c<strong>on</strong>nected to this comp<strong>on</strong>ent thread and is used to <str<strong>on</strong>g>for</str<strong>on</strong>g>warddata to those clients. Whenever the list is empty the comp<strong>on</strong>ent thread is getsdeactivated. The globalClients list is a reference to the list of all clientsc<strong>on</strong>nected to the probe. Observati<strong>on</strong> of this list allows to remove clients fromthe c<strong>on</strong>nectedClients list whenever a client disc<strong>on</strong>nects from the probe. ThereceivedProperties list holds all properties extracted from a new message38

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!