peer2me.network.bluetooth
Class PingQueueProcessor

java.lang.Object
  extended by peer2me.network.bluetooth.PingQueueProcessor
All Implemented Interfaces:
java.lang.Runnable

public class PingQueueProcessor
extends java.lang.Object
implements java.lang.Runnable

This class processes the pingqueue that is located in Bluetooth. This class constantly watches the queue, and when a pingmessage is added to the queue, this class tries to establish a connection to the node in the pingmessage. The connection is immediately closed if it was created.

Author:
Kim Saxlund

Constructor Summary
PingQueueProcessor(Bluetooth bluetooth)
          Constructor.
 
Method Summary
 boolean isProcessQue()
          If the queue is being checked at regular intervals, this method returns true
 void run()
          Runs as long as the private boolean processQueue is true.
 void setProcessQue(boolean processQue)
          Can be used to stop this thread.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PingQueueProcessor

public PingQueueProcessor(Bluetooth bluetooth)
Constructor. Starts this thread.

Parameters:
bluetooth - Reference to the Bluetooth class
Method Detail

run

public void run()
Runs as long as the private boolean processQueue is true. Checks the pingqueue at regular intervals. When a ping is added to the queue, this method creates an instance of BluetoothObjectPush and tries to establish a connection to the assosiated node.

Specified by:
run in interface java.lang.Runnable

isProcessQue

public boolean isProcessQue()
If the queue is being checked at regular intervals, this method returns true

Returns:
True if queue is being checked, false otherwise

setProcessQue

public void setProcessQue(boolean processQue)
Can be used to stop this thread. Use 'false' as parameter, and this thread will stop checking the queue, and finish

Parameters:
processQue - Use false to stop checking the queue