ZetaGrid v1.9

zeta.util
Class CachedQueries

java.lang.Object
  |
  +--zeta.util.CachedQueries

public class CachedQueries
extends java.lang.Object

Cache for some frequently used queries.


Field Summary
private static long lastMaxDays
           
private static java.lang.String lastMaxDaysUpdate
           
private static long lastTeamNamesRefresh
           
private static long lastUserDataTableRefresh
           
private static long lastUserNamesRefresh
           
private static int lastUsersForRecomputationServerId
           
private static java.lang.String lastUsersForRecomputationUpdate
           
private static int numberOfComputers
           
private static java.util.Map teamNames
           
private static Table userDataTable
          Contains the data about the top producers.
private static java.util.Map userMinStartDays
           
private static java.util.Map userNames
           
private static java.lang.String usersForRecomputation
           
private static Table workstationTable
           
 
Constructor Summary
CachedQueries()
           
 
Method Summary
static int getMaxComputersUsed(java.lang.String name)
          Returns the maximum number of computers which are used by the specified user name simultaneously.
static long getMaxDays(java.sql.Statement stmt)
          Returns the latest days of the result table.
static int getNumberOfComputers()
          Returns the current number of computers.
static java.util.Map getTeamNames(java.sql.Connection con)
          Maps all defined team names in lower case to the first typed team name.
static Table getUserData(java.sql.Connection con)
          Returns the data about the top producers.
static java.lang.Object[] getUserData(java.lang.String name, java.lang.String teamname)
          Returns an array of objects: 1.
static java.lang.Long getUserMinStartDays(java.sql.Connection con, java.lang.String userName)
          Returns the starting timestamp in DAYS of the specified user name.
static java.util.Map getUserNames(java.sql.Connection con)
          Maps all defined user names in lower case to the first typed user name.
static java.lang.String getUsersForRecomputation(java.sql.Statement stmt, int serverId)
          Returns a list of user ID for the specified server ID that can be used for recomputation of work units.
static Table getWorkstationTable()
          Returns the data about the workstations.
static void setNumberOfComputers(int numberOfComputers)
          Defines the current number of computers.
static void setWorkstationTable(Table table)
          Set the data about the workstations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

workstationTable

private static Table workstationTable

userDataTable

private static Table userDataTable
Contains the data about the top producers.


lastUserDataTableRefresh

private static long lastUserDataTableRefresh

lastUserNamesRefresh

private static long lastUserNamesRefresh

userNames

private static java.util.Map userNames

userMinStartDays

private static java.util.Map userMinStartDays

lastTeamNamesRefresh

private static long lastTeamNamesRefresh

teamNames

private static java.util.Map teamNames

lastMaxDays

private static long lastMaxDays

lastMaxDaysUpdate

private static java.lang.String lastMaxDaysUpdate

usersForRecomputation

private static java.lang.String usersForRecomputation

lastUsersForRecomputationUpdate

private static java.lang.String lastUsersForRecomputationUpdate

lastUsersForRecomputationServerId

private static int lastUsersForRecomputationServerId

numberOfComputers

private static int numberOfComputers
Constructor Detail

CachedQueries

public CachedQueries()
Method Detail

getUserNames

public static java.util.Map getUserNames(java.sql.Connection con)
                                  throws java.sql.SQLException
Maps all defined user names in lower case to the first typed user name. The map will be cached for about 20 minutes.

Parameters:
con - connection to the back-end database
Returns:
map which maps all defined user names in lower case to the first typed user name.
java.sql.SQLException

getUserMinStartDays

public static java.lang.Long getUserMinStartDays(java.sql.Connection con,
                                                 java.lang.String userName)
                                          throws java.sql.SQLException
Returns the starting timestamp in DAYS of the specified user name.

Parameters:
con - connection to the back-end database
userName - user name
Returns:
the starting timestamp in DAYS of the specified user name.
java.sql.SQLException

getTeamNames

public static java.util.Map getTeamNames(java.sql.Connection con)
                                  throws java.sql.SQLException
Maps all defined team names in lower case to the first typed team name. The map will be cached for about 10 minutes.

Parameters:
con - connection to the back-end database
Returns:
map which maps all defined team names in lower case to the first typed team name.
java.sql.SQLException

getMaxDays

public static long getMaxDays(java.sql.Statement stmt)
                       throws java.sql.SQLException
Returns the latest days of the result table. Value will be cached for one day.

Parameters:
stmt - statement object's database
Returns:
the latest days of the result table.
java.sql.SQLException

getUsersForRecomputation

public static java.lang.String getUsersForRecomputation(java.sql.Statement stmt,
                                                        int serverId)
                                                 throws java.sql.SQLException
Returns a list of user ID for the specified server ID that can be used for recomputation of work units. The user ID's are separated by ',' and the returned string has an upper bound of 4000 characters. Value will be cached for one day.

Parameters:
stmt - statement object's database
serverId - server ID
Returns:
a list of user ID for the specified server ID that can be used for recomputation of work units.
java.sql.SQLException

getUserData

public static Table getUserData(java.sql.Connection con)
                         throws java.sql.SQLException
Returns the data about the top producers. The columns of the table are 'user', 'email', 'number of redistributions', 'last redistributed work unit', 'last redistributed timestamp', 'team', 'messages', 'properties', 'server_id', 'id'. where the last two columns are declared to be hidden. This table will be cached for about 10 minutes.

Parameters:
con - connection to the back-end database
Returns:
the data about the top producers.
java.sql.SQLException

setWorkstationTable

public static void setWorkstationTable(Table table)
Set the data about the workstations. The columns of the table are 'user,email,hostname', 'age (days)', 'work units', 'zeros', 'number of active work units', 'last work unit was requested at', 'number of redistributed work units', 'last redistributed work unit ID', 'last redistributed work unit at', 'min start', 'max stop', 'team' where the last three columns are declared to be hidden.

Parameters:
table - the data about the workstations.

getWorkstationTable

public static Table getWorkstationTable()
Returns the data about the workstations. The columns of the table are 'user,email,hostname', 'age (days)', 'work units', 'zeros', 'number of active work units', 'last work unit was requested at', 'number of redistributed work units', 'last redistributed work unit ID', 'last redistributed work unit at', 'min start', 'max stop', 'team' where the last three columns are declared to be hidden.

Returns:
the data about the workstations.

getUserData

public static java.lang.Object[] getUserData(java.lang.String name,
                                             java.lang.String teamname)
Returns an array of objects: 1. Integer: the maximum number of computers which are used by the specified user name simultaneously. 2. Integer: number of computed work units 3. Long: number of computed zeros

Parameters:
name - user name in lower case
teamname - only users that are members of the specified team name (trim and in lower case) are considered if teamname is not null
Returns:
an array of objects.

getMaxComputersUsed

public static int getMaxComputersUsed(java.lang.String name)
Returns the maximum number of computers which are used by the specified user name simultaneously.

Parameters:
name - user name
Returns:
the maximum number of computers which are used by the specified user name simultaneously.

setNumberOfComputers

public static void setNumberOfComputers(int numberOfComputers)
Defines the current number of computers.

Parameters:
numberOfComputers - number of computers

getNumberOfComputers

public static int getNumberOfComputers()
Returns the current number of computers.

Returns:
the current number of computers.

ZetaGrid v1.9

For further technical papers, see ZetaGrid Technical Documentation.
 
Copyright © 2001,2002 Sebastian Wedeniwski. All Rights Reserved.