com.commsen.stopwatch.storages
Class StorageManager

java.lang.Object
  extended by com.commsen.stopwatch.storages.StorageManager
All Implemented Interfaces:
java.lang.Runnable

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

TODO Dokumentacja

Author:
Milen Dyankov

Field Summary
static int DELAYED_MODE
          Storage manager keeps in memory data gathered on "start" and stores all together when "end" is called.
static int NORMAL_MODE
          Storage manager will insert record into database when "start" method is called and update it when "stop" method is called.
static int THREAD_MODE
          Same as NORMAL_MODE but storage manager runs in separate thread, thus resulting in more correct measurements.
 
Constructor Summary
StorageManager(StopwatchStorage storage, int threadMode)
           
 
Method Summary
 boolean completeRecord(long id, java.lang.Object[] parameters)
           
 long newRecord(java.lang.Object[] parameters)
           
 void pause()
           
 boolean removeRecord(long id)
           
 void resume()
           
 void run()
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_MODE

public static final int NORMAL_MODE
Storage manager will insert record into database when "start" method is called and update it when "stop" method is called. NOTE: in this case the time taken to insert the record into database is added to measurements.

See Also:
Constant Field Values

THREAD_MODE

public static final int THREAD_MODE
Same as NORMAL_MODE but storage manager runs in separate thread, thus resulting in more correct measurements. NOTE: in this case getReport(...) methods may return null when called soon after "stop" since storage manager may have not managed to store its data.

See Also:
Constant Field Values

DELAYED_MODE

public static final int DELAYED_MODE
Storage manager keeps in memory data gathered on "start" and stores all together when "end" is called.

See Also:
Constant Field Values
Constructor Detail

StorageManager

public StorageManager(StopwatchStorage storage,
                      int threadMode)
Parameters:
storage -
threadMode -
Method Detail

start

public void start()

resume

public void resume()
See Also:
StopwatchEngine.resume()

stop

public void stop()

pause

public void pause()

run

public void run()
Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

newRecord

public long newRecord(java.lang.Object[] parameters)
Parameters:
parameters -
Returns:

completeRecord

public boolean completeRecord(long id,
                              java.lang.Object[] parameters)
Parameters:
id -
parameters -
Returns:

removeRecord

public boolean removeRecord(long id)
Parameters:
id -
Returns:


Copyright © 2006-2008 Commsen International. All Rights Reserved.