Changeset 3808
- Timestamp:
- Oct 8, 2007, 11:25:37 AM (16 years ago)
- Location:
- branches/2.4-stable/src/core/net/sf/basedb/core
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4-stable/src/core/net/sf/basedb/core/AnnotationRestriction.java
r3679 r3808 105 105 throws BaseException 106 106 { 107 SessionControl sc = dc.getSessionControl(); 107 108 String valueTable = null; 108 109 if (valueType == Type.INT) … … 168 169 { 169 170 if (debugSqlEnabled) logSql.debug("Executing annotation query: " + sql); 170 List<Object[]> twoIds = HibernateUtil.loadList(Object[].class, sqlQuery );171 List<Object[]> twoIds = HibernateUtil.loadList(Object[].class, sqlQuery, sc); 171 172 StringBuilder annotationSets = new StringBuilder("0"); 172 173 StringBuilder annotations = new StringBuilder("0"); … … 192 193 sqlQuery.addScalar("annotationset_id", org.hibernate.Hibernate.INTEGER); 193 194 if (debugSqlEnabled) logSql.debug("Executing annotation query: " + sql); 194 List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery );195 List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery, sc); 195 196 annotationSets = new StringBuilder(annotationSetIds); 196 197 for (Integer id : ids) … … 204 205 { 205 206 if (debugSqlEnabled) logSql.debug("Executing annotation query: " + sql); 206 List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery );207 List<Integer> ids = HibernateUtil.loadList(Integer.class, sqlQuery, sc); 207 208 StringBuilder annotationSets = new StringBuilder("0"); 208 209 for (Integer id : ids) -
branches/2.4-stable/src/core/net/sf/basedb/core/Application.java
r3679 r3808 33 33 import java.util.Calendar; 34 34 import java.util.GregorianCalendar; 35 import java.util.HashSet; 35 36 import java.util.Map; 36 37 import java.util.HashMap; … … 38 39 import java.util.Iterator; 39 40 import java.util.Random; 41 import java.util.Set; 40 42 import java.util.Timer; 41 43 import java.util.TimerTask; … … 453 455 454 456 // Adding a task that cleans the session control cache at regular intervale 455 long milliSeconds = 60 *1000*sessionCacheTimeout;457 long milliSeconds = 60 * 1000 * sessionCacheTimeout; 456 458 getScheduler().schedule(new SessionControlCacheCleaner(), milliSeconds, milliSeconds, false); 457 459 … … 840 842 private static void cleanSessionControlCache(boolean force) 841 843 { 844 if (!force) 845 { 846 // Ping all sessioncontrols in the pingers set 847 for (Pinger p : pingers) 848 { 849 p.ping(); 850 } 851 } 852 842 853 synchronized(sessionCache) 843 854 { 844 855 Iterator<SessionControl> i = sessionCache.values().iterator(); 845 856 long now = System.currentTimeMillis(); 857 long timout = 60 * 1000 * sessionCacheTimeout; 846 858 while (i.hasNext()) 847 859 { 848 860 SessionControl sc = i.next(); 849 if (force || ((now - sc.getLastAccess()) > 60*1000*sessionCacheTimeout))861 if (force || ((now - sc.getLastAccess()) > timout)) 850 862 { 851 863 log.info("cleanSessionControlCache: Remove[ID="+sc.getId()+"]"); … … 854 866 if (sc.isLoggedIn()) sc.logout(); 855 867 } 856 catch ( BaseException ex)868 catch (Throwable t) 857 869 { 858 log.error("Exception during cleanSessionControlCache", ex);870 log.error("Exception during cleanSessionControlCache", t); 859 871 } 860 872 finally 861 873 { 874 sc.close(); 862 875 i.remove(); 863 876 } … … 953 966 } 954 967 968 private static Set<Pinger> pingers = 969 Collections.synchronizedSet(new HashSet<Pinger>()); 970 971 /** 972 Create a new <code>Pinger</code> object that is used 973 to keep a session control alive. 974 975 @param sc The SessionControl that the pinger should protect 976 @return A pinger object 977 @since 2.4.5 978 */ 979 public static Pinger newPinger(SessionControl sc) 980 { 981 Pinger p = new Pinger(sc); 982 pingers.add(p); 983 return p; 984 } 985 986 private static void stopPinger(Pinger p) 987 { 988 pingers.remove(p); 989 } 990 991 /** 992 A <code>Pinger</code> is an object that is used to protect another 993 object from timing out by automatically pinging it. This can for 994 example be used by a client to override the timeout for SessionControl 995 items. 996 997 @since 2.4.5 998 */ 999 public static class Pinger 1000 { 1001 private final SessionControl sc; 1002 private Pinger(SessionControl sc) 1003 { 1004 this.sc = sc; 1005 } 1006 /** 1007 Ping the SessionControl by updating the last access time: 1008 {@link SessionControl#updateLastAccess()} 1009 */ 1010 public void ping() 1011 { 1012 if (!sc.isClosed()) sc.updateLastAccess(); 1013 } 1014 /** 1015 Stop this pinger. 1016 */ 1017 public void stop() 1018 { 1019 Application.stopPinger(this); 1020 } 1021 } 1022 955 1023 } -
branches/2.4-stable/src/core/net/sf/basedb/core/BasicItem.java
r3679 r3808 251 251 query.setInteger("toType", this.getType().getValue()); 252 252 Set<ItemProxy> using = new TreeSet<ItemProxy>(); 253 for (Object[] u : HibernateUtil.loadList(Object[].class, query ))253 for (Object[] u : HibernateUtil.loadList(Object[].class, query, getSessionControl())) 254 254 { 255 255 using.add(new ItemProxy((Integer)u[0], Item.fromValue((Integer)u[1]))); … … 268 268 protected void addUsingItems(Set<ItemProxy> using, Item itemType, org.hibernate.Query query) 269 269 { 270 for (Integer itemId : HibernateUtil.loadList(Integer.class, query ))270 for (Integer itemId : HibernateUtil.loadList(Integer.class, query, getSessionControl())) 271 271 { 272 272 using.add(new ItemProxy(itemId, itemType)); … … 282 282 protected void addUsingItems(Set<ItemProxy> using, org.hibernate.Query query) 283 283 { 284 for (BasicData item : HibernateUtil.loadList(BasicData.class, query ))284 for (BasicData item : HibernateUtil.loadList(BasicData.class, query, getSessionControl())) 285 285 { 286 286 using.add(new ItemProxy(item.getId(), Item.fromDataClass(item.getClass()))); -
branches/2.4-stable/src/core/net/sf/basedb/core/BioAssaySet.java
r3679 r3808 1209 1209 { 1210 1210 DbControl dc = getDbControl(); 1211 SessionControl sc = dc.getSessionControl(); 1211 1212 1212 1213 // 1. Find all child bioassaysets recursively … … 1227 1228 */ 1228 1229 query.setParameterList("basList", all); 1229 List<DataCubeData> possibleCubes = HibernateUtil.loadList(DataCubeData.class, query );1230 List<DataCubeData> possibleCubes = HibernateUtil.loadList(DataCubeData.class, query, sc); 1230 1231 1231 1232 // 2b. Among the found data cubes, find those that are also used by other bioassaysets … … 1242 1243 query.setParameterList("basList", all); 1243 1244 query.setParameterList("possibleCubes", possibleCubes); 1244 possibleCubes.removeAll(HibernateUtil.loadList(DataCubeData.class, query ));1245 possibleCubes.removeAll(HibernateUtil.loadList(DataCubeData.class, query, sc)); 1245 1246 1246 1247 … … 1279 1280 query.setParameterList("deletedCubes", possibleCubes); 1280 1281 } 1281 List<DataCubeLayerData> possibleLayers = HibernateUtil.loadList(DataCubeLayerData.class, query );1282 List<DataCubeLayerData> possibleLayers = HibernateUtil.loadList(DataCubeLayerData.class, query, sc); 1282 1283 1283 1284 if (possibleLayers.size() > 0) … … 1294 1295 query.setParameterList("basList", all); 1295 1296 query.setParameterList("possibleLayers", possibleLayers); 1296 possibleLayers.removeAll(HibernateUtil.loadList(DataCubeLayerData.class, query ));1297 possibleLayers.removeAll(HibernateUtil.loadList(DataCubeLayerData.class, query, sc)); 1297 1298 1298 1299 // 3c. Delete data from the remaining layers … … 1330 1331 query.setParameterList("deletedCubes", possibleCubes); 1331 1332 } 1332 List<DataCubeFilterData> possibleFilters = HibernateUtil.loadList(DataCubeFilterData.class, query );1333 List<DataCubeFilterData> possibleFilters = HibernateUtil.loadList(DataCubeFilterData.class, query, sc); 1333 1334 1334 1335 if (possibleFilters.size() > 0) … … 1345 1346 query.setParameterList("basList", all); 1346 1347 query.setParameterList("possibleFilters", possibleFilters); 1347 possibleFilters.removeAll(HibernateUtil.loadList(DataCubeFilterData.class, query ));1348 possibleFilters.removeAll(HibernateUtil.loadList(DataCubeFilterData.class, query, sc)); 1348 1349 1349 1350 // 4c. Delete data from the remaining layers … … 1381 1382 query.setParameterList("deletedCubes", possibleCubes); 1382 1383 } 1383 List<DataCubeExtraValueData> possibleExtraValues = HibernateUtil.loadList(DataCubeExtraValueData.class, query );1384 List<DataCubeExtraValueData> possibleExtraValues = HibernateUtil.loadList(DataCubeExtraValueData.class, query, sc); 1384 1385 1385 1386 if (possibleExtraValues.size() > 0) … … 1396 1397 query.setParameterList("basList", all); 1397 1398 query.setParameterList("possibleExtraValues", possibleExtraValues); 1398 possibleExtraValues.removeAll(HibernateUtil.loadList(DataCubeExtraValueData.class, query ));1399 possibleExtraValues.removeAll(HibernateUtil.loadList(DataCubeExtraValueData.class, query, sc)); 1399 1400 1400 1401 // 5c. Delete data from the remaining extra values … … 1430 1431 } 1431 1432 findChildren.setEntity("parent", parent); 1432 List<BioAssaySetData> children = HibernateUtil.loadList(BioAssaySetData.class, findChildren );1433 List<BioAssaySetData> children = HibernateUtil.loadList(BioAssaySetData.class, findChildren, null); 1433 1434 for (BioAssaySetData child : children) 1434 1435 { -
branches/2.4-stable/src/core/net/sf/basedb/core/DataQuery.java
r3679 r3808 82 82 enableFilters(dc); 83 83 long totalCount = -1; 84 SessionControl sc = dc.getSessionControl(); 84 85 85 86 // Load the total count if it is requested … … 90 91 91 92 // Load the results 92 ScrollIterator<I> result = HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc)); 93 ScrollIterator<I> result = 94 HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc), sc); 93 95 disableFilters(dc); 94 96 return new DataResultIterator<I>(result, dc.getSessionControl(), -
branches/2.4-stable/src/core/net/sf/basedb/core/DiskUsageStatistics.java
r3675 r3808 237 237 private void loadDiskUsage(org.hibernate.Query query) 238 238 { 239 List<Object[]> du = HibernateUtil.loadList(Object[].class, query );239 List<Object[]> du = HibernateUtil.loadList(Object[].class, query, null); 240 240 for (Object[] row : du) 241 241 { -
branches/2.4-stable/src/core/net/sf/basedb/core/Group.java
r3679 r3808 147 147 { 148 148 query.setParameterList("groups", allGroups, org.hibernate.Hibernate.INTEGER); 149 } while (allGroups.addAll(HibernateUtil.loadList(Integer.class, query )));149 } while (allGroups.addAll(HibernateUtil.loadList(Integer.class, query, null))); 150 150 } 151 151 return allGroups; -
branches/2.4-stable/src/core/net/sf/basedb/core/HibernateUtil.java
r3679 r3808 1449 1449 @param clazz The list should contain objects of this class 1450 1450 @param query The query to execute 1451 @param sc A optional SessionControl that is automatically protected from 1452 timeouts during the time the query is running 1451 1453 */ 1452 1454 @SuppressWarnings({"unchecked"}) 1453 static <T> List<T> loadList(Class<T> clazz, Query query )1455 static <T> List<T> loadList(Class<T> clazz, Query query, SessionControl sc) 1454 1456 throws BaseException 1455 1457 { 1456 1458 assert query != null : "query == null"; 1457 try 1458 { 1459 Application.Pinger pinger = null; 1460 try 1461 { 1462 if (sc != null) pinger = Application.newPinger(sc); 1459 1463 return (List<T>)query.list(); 1460 1464 } … … 1462 1466 { 1463 1467 throw new BaseException(ex); 1468 } 1469 finally 1470 { 1471 if (pinger != null) pinger.stop(); 1464 1472 } 1465 1473 } … … 1469 1477 @param clazz The iterator returns objects of this class 1470 1478 @param query The query to execute 1471 */ 1472 static <T> ScrollIterator<T> loadIterator(Class<T> clazz, Query query) 1479 @param sc A optional SessionControl that is automatically protected from 1480 timeouts during the time the query is running 1481 */ 1482 static <T> ScrollIterator<T> loadIterator(Class<T> clazz, Query query, SessionControl sc) 1473 1483 throws BaseException 1474 1484 { 1475 1485 assert query != null : "query == null"; 1476 try 1477 { 1486 Application.Pinger pinger = null; 1487 try 1488 { 1489 if (sc != null) pinger = Application.newPinger(sc); 1490 Thread.sleep(5000); 1478 1491 ScrollableResults result = query.scroll(ScrollMode.FORWARD_ONLY); 1479 1492 return new ScrollIterator<T>(clazz, result); … … 1482 1495 { 1483 1496 throw new BaseException(ex); 1497 } 1498 finally 1499 { 1500 if (pinger != null) pinger.stop(); 1484 1501 } 1485 1502 } -
branches/2.4-stable/src/core/net/sf/basedb/core/InternalJobQueue.java
r3679 r3808 253 253 query.setInteger("status", Job.Status.WAITING.getValue()); 254 254 query.setInteger("type", Job.Type.RUN_PLUGIN.getValue()); 255 List<JobData> jobs = HibernateUtil.loadList(JobData.class, query );255 List<JobData> jobs = HibernateUtil.loadList(JobData.class, query, null); 256 256 257 257 log.info("Found " + jobs.size() + " jobs waiting for execution"); -
branches/2.4-stable/src/core/net/sf/basedb/core/ItemKey.java
r3679 r3808 157 157 WHERE NOT sd.itemKey IS NULL 158 158 */ 159 Set<Integer> used = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));159 Set<Integer> used = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, null)); 160 160 if (used.size() == 0) used.add(0); 161 161 query = HibernateUtil.getPredefinedQuery(session, "SELECT_UNUSED_ITEMKEYS"); … … 165 165 */ 166 166 query.setParameterList("used", used, org.hibernate.Hibernate.INTEGER); 167 List<ItemKeyData> unused = HibernateUtil.loadList(ItemKeyData.class, query );167 List<ItemKeyData> unused = HibernateUtil.loadList(ItemKeyData.class, query, null); 168 168 for (ItemKeyData ik : unused) 169 169 { … … 363 363 */ 364 364 query.setInteger("numPermissions", numPermissions); 365 List<Integer> candidates = HibernateUtil.loadList(Integer.class, query );365 List<Integer> candidates = HibernateUtil.loadList(Integer.class, query, null); 366 366 if (candidates.size() > 0 && numPermissions > 0 && userPermissions != null) 367 367 { … … 385 385 query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER); 386 386 query.setInteger("numPermissions", numPermissions); 387 candidates = HibernateUtil.loadList(Integer.class, query );387 candidates = HibernateUtil.loadList(Integer.class, query, null); 388 388 } 389 389 … … 403 403 query.setInteger("numPermissions", numPermissions); 404 404 query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER); 405 candidates = HibernateUtil.loadList(Integer.class, query );405 candidates = HibernateUtil.loadList(Integer.class, query, null); 406 406 } 407 407 … … 428 428 query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER); 429 429 query.setInteger("numPermissions", numPermissions); 430 candidates = HibernateUtil.loadList(Integer.class, query );430 candidates = HibernateUtil.loadList(Integer.class, query, null); 431 431 } 432 432 -
branches/2.4-stable/src/core/net/sf/basedb/core/ItemQuery.java
r3679 r3808 90 90 { 91 91 enableFilters(dc); 92 SessionControl sc = dc.getSessionControl(); 92 93 93 List<? extends BasicData> result = HibernateUtil.loadList(dataClass, getMainHqlQuery(dc) );94 List<? extends BasicData> result = HibernateUtil.loadList(dataClass, getMainHqlQuery(dc), sc); 94 95 long totalCount = result.size(); 95 96 … … 115 116 enableFilters(dc); 116 117 long totalCount = -1; 118 SessionControl sc = dc.getSessionControl(); 117 119 118 120 // Load the total count if it is requested … … 122 124 } 123 125 124 ScrollIterator<? extends BasicData> result = HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc)); 126 ScrollIterator<? extends BasicData> result = 127 HibernateUtil.loadIterator(dataClass, getMainHqlQuery(dc), sc); 125 128 disableFilters(dc); 126 129 return new ItemResultIterator<I>(result, dc, itemClass, totalCount); -
branches/2.4-stable/src/core/net/sf/basedb/core/Keyring.java
r3679 r3808 323 323 */ 324 324 query.setInteger("userId", userId); 325 temp = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));325 temp = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, null)); 326 326 roles = Collections.unmodifiableSet(temp); 327 327 } … … 350 350 */ 351 351 query.setInteger("userId", userId); 352 temp = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));352 temp = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, null)); 353 353 354 354 query = HibernateUtil.getPredefinedQuery(session, "GET_QUOTA_GROUP_ID_FOR_USER"); … … 375 375 { 376 376 query.setParameterList("groups", temp, org.hibernate.Hibernate.INTEGER); 377 } while (temp.addAll(HibernateUtil.loadList(Integer.class, query )));377 } while (temp.addAll(HibernateUtil.loadList(Integer.class, query, null))); 378 378 // repeat until no more new groups are found 379 379 } … … 406 406 */ 407 407 query.setInteger("userId", userId); 408 for (Integer i : HibernateUtil.loadList(Integer.class, query ))408 for (Integer i : HibernateUtil.loadList(Integer.class, query, null)) 409 409 { 410 410 temp.put(i, ALL_ITEM); … … 419 419 */ 420 420 query.setInteger("userId", userId); 421 for (UserProjects up : HibernateUtil.loadList(UserProjects.class, query ))421 for (UserProjects up : HibernateUtil.loadList(UserProjects.class, query, null)) 422 422 { 423 423 Integer i = temp.get(up.getProjectId()); … … 435 435 */ 436 436 query.setParameterList("groups", groups, org.hibernate.Hibernate.INTEGER); 437 for (GroupProjects gp : HibernateUtil.loadList(GroupProjects.class, query ))437 for (GroupProjects gp : HibernateUtil.loadList(GroupProjects.class, query, null)) 438 438 { 439 439 Integer i = temp.get(gp.getProjectId()); … … 471 471 */ 472 472 query.setParameterList("groups", groups, org.hibernate.Hibernate.INTEGER); 473 temp.addAll(HibernateUtil.loadList(Integer.class, query ));473 temp.addAll(HibernateUtil.loadList(Integer.class, query, null)); 474 474 475 475 // Get the users that have a quota group among the same groups … … 481 481 */ 482 482 query.setParameterList("groups", groups, org.hibernate.Hibernate.INTEGER); 483 temp.addAll(HibernateUtil.loadList(Integer.class, query ));483 temp.addAll(HibernateUtil.loadList(Integer.class, query, null)); 484 484 } 485 485 … … 498 498 */ 499 499 query.setInteger("projectId", projectId); 500 temp.addAll(HibernateUtil.loadList(Integer.class, query ));500 temp.addAll(HibernateUtil.loadList(Integer.class, query, null)); 501 501 502 502 // Get groups that are direct members of the active project … … 509 509 query.setInteger("projectId", projectId); 510 510 // Load the direct groups and subgroups 511 Set<Integer> projectGroups = Group.getGroupsRecursive(session, HibernateUtil.loadList(Integer.class, query ));511 Set<Integer> projectGroups = Group.getGroupsRecursive(session, HibernateUtil.loadList(Integer.class, query, null)); 512 512 513 513 // Load users that are members of the project groups … … 541 541 */ 542 542 query.setInteger("userId", userId); 543 List<KeyPermission> keys = HibernateUtil.loadList(KeyPermission.class, query );543 List<KeyPermission> keys = HibernateUtil.loadList(KeyPermission.class, query, null); 544 544 545 545 // Load keys shared to any of the groups where the user is a member … … 553 553 */ 554 554 query.setParameterList("groups", groups, org.hibernate.Hibernate.INTEGER); 555 keys.addAll(HibernateUtil.loadList(KeyPermission.class, query ));555 keys.addAll(HibernateUtil.loadList(KeyPermission.class, query, null)); 556 556 } 557 557 … … 612 612 */ 613 613 query.setInteger("userId", userId); 614 List<RoleKeys> roleKeys = HibernateUtil.loadList(RoleKeys.class, query );614 List<RoleKeys> roleKeys = HibernateUtil.loadList(RoleKeys.class, query, null); 615 615 616 616 // Copy the permission from the list to the array … … 665 665 */ 666 666 query.setInteger("pluginId", pluginId); 667 List<PluginKeys> keys = HibernateUtil.loadList(PluginKeys.class, query );667 List<PluginKeys> keys = HibernateUtil.loadList(PluginKeys.class, query, null); 668 668 669 669 // Copy the permissions from the list to the array … … 701 701 */ 702 702 query.setInteger("projectId", projectId); 703 List<ProjectKeys> keys = HibernateUtil.loadList(ProjectKeys.class, query );703 List<ProjectKeys> keys = HibernateUtil.loadList(ProjectKeys.class, query, null); 704 704 705 705 // Copy the permissions from the List to the array -
branches/2.4-stable/src/core/net/sf/basedb/core/PluginDefinition.java
r3679 r3808 317 317 query.setParameterList("projectKeys", projectKeys, org.hibernate.Hibernate.INTEGER); 318 318 319 List<Object> pluginCount = HibernateUtil.loadList(Object.class, query );319 List<Object> pluginCount = HibernateUtil.loadList(Object.class, query, dc.getSessionControl()); 320 320 Map<Plugin.MainType, Integer> result = new HashMap<Plugin.MainType, Integer>(5); 321 321 for (Object cnt : pluginCount) … … 1129 1129 org.hibernate.Query query = HibernateUtil.createQuery( 1130 1130 getDbControl().getHibernateSession(), "SELECT pt FROM PluginTypeData pt"); 1131 List<PluginTypeData> types = HibernateUtil.loadList(PluginTypeData.class, query );1131 List<PluginTypeData> types = HibernateUtil.loadList(PluginTypeData.class, query, null); 1132 1132 1133 1133 for (PluginTypeData pt : types) -
branches/2.4-stable/src/core/net/sf/basedb/core/Project.java
r3679 r3808 393 393 */ 394 394 query.setInteger("projectId", this.getId()); 395 projectKeys = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));395 projectKeys = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, sc)); 396 396 397 397 include.remove(Include.OTHERS); … … 458 458 FROM net.sf.basedb.core.data.ShareableData item 459 459 */ 460 List<ShareableData> inProject = HibernateUtil.loadList(ShareableData.class, query );460 List<ShareableData> inProject = HibernateUtil.loadList(ShareableData.class, query, sc); 461 461 List<Shareable> items = new ArrayList<Shareable>(inProject.size()); 462 462 -
branches/2.4-stable/src/core/net/sf/basedb/core/ProjectKey.java
r3679 r3808 142 142 WHERE NOT sd.projectKey IS NULL 143 143 */ 144 Set<Integer> used = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query ));144 Set<Integer> used = new HashSet<Integer>(HibernateUtil.loadList(Integer.class, query, null)); 145 145 if (used.size() == 0) used.add(0); 146 146 query = HibernateUtil.getPredefinedQuery(session, "SELECT_UNUSED_PROJECTKEYS"); … … 150 150 */ 151 151 query.setParameterList("used", used, org.hibernate.Hibernate.INTEGER); 152 List<ProjectKeyData> unused = HibernateUtil.loadList(ProjectKeyData.class, query );152 List<ProjectKeyData> unused = HibernateUtil.loadList(ProjectKeyData.class, query, null); 153 153 for (ProjectKeyData pk : unused) 154 154 { … … 307 307 */ 308 308 query.setInteger("numPermissions", numPermissions); 309 List<Integer> candidates = HibernateUtil.loadList(Integer.class, query );309 List<Integer> candidates = HibernateUtil.loadList(Integer.class, query, null); 310 310 if (candidates.size() > 0) 311 311 { … … 330 330 query.setParameterList("candidates", candidates, org.hibernate.Hibernate.INTEGER); 331 331 query.setInteger("numPermissions", numPermissions); 332 candidates = HibernateUtil.loadList(Integer.class, query );332 candidates = HibernateUtil.loadList(Integer.class, query, null); 333 333 } 334 334 if (candidates.size() == 0) -
branches/2.4-stable/src/core/net/sf/basedb/core/RawBioAssay.java
r3748 r3808 783 783 */ 784 784 query.setInteger("arrayDesign", design.getId()); 785 ScrollIterator<FeatureData> si = HibernateUtil.loadIterator(FeatureData.class, query); 785 ScrollIterator<FeatureData> si = 786 HibernateUtil.loadIterator(FeatureData.class, query, dc.getSessionControl()); 786 787 while (si.hasNext()) 787 788 { -
branches/2.4-stable/src/core/net/sf/basedb/core/RawDataBatcher.java
r3747 r3808 192 192 */ 193 193 query.setInteger("arrayDesign", arrayDesign.getId()); 194 ScrollIterator<FeatureData> si = HibernateUtil.loadIterator(FeatureData.class, query); 194 ScrollIterator<FeatureData> si = 195 HibernateUtil.loadIterator(FeatureData.class, query, dc.getSessionControl()); 195 196 while (si.hasNext()) 196 197 { -
branches/2.4-stable/src/core/net/sf/basedb/core/ReporterScoreQuery.java
r2474 r3808 58 58 enableFilters(dc); 59 59 long totalCount = -1; 60 SessionControl sc = dc.getSessionControl(); 60 61 61 62 // Load the total count if it is requested … … 65 66 } 66 67 67 ScrollIterator<ReporterListScoreData> result = HibernateUtil.loadIterator(ReporterListScoreData.class, getMainHqlQuery(dc)); 68 ScrollIterator<ReporterListScoreData> result = 69 HibernateUtil.loadIterator(ReporterListScoreData.class, getMainHqlQuery(dc), sc); 68 70 disableFilters(dc); 69 71 return new ReporterScoreResultIterator(result, dc, totalCount); -
branches/2.4-stable/src/core/net/sf/basedb/core/SessionControl.java
r3679 r3808 112 112 113 113 /** 114 If the session control has been closed it can no longer be used. 115 */ 116 private boolean closed; 117 118 /** 114 119 Stores name and value from {@link ClientDefaultSettingData}. 115 120 */ … … 192 197 Get the time this object last was accessed. Used by the cleanup timer 193 198 in {@link Application#cleanSessionControlCache(boolean)} 194 */ 195 long getLastAccess() 199 @since 2.4.5 200 */ 201 public long getLastAccess() 196 202 { 197 203 return lastAccess; … … 204 210 public void updateLastAccess() 205 211 { 212 if (closed) throw new PermissionDeniedException("SessonControl is closed"); 206 213 lastAccess = System.currentTimeMillis(); 207 214 } 215 216 /** 217 If this session control has been closed or not. A closed session 218 control can't be used. 219 @return TRUE if the session control is closed 220 @since 2.4.5 221 */ 222 public boolean isClosed() 223 { 224 return closed; 225 } 226 227 /** 228 Close this session control so it can't be used again. 229 @since 2.4.5 230 */ 231 public void close() 232 { 233 if (isLoggedIn()) logout(); 234 closed = true; 235 } 236 208 237 209 238 /** … … 693 722 public boolean isLoggedIn() 694 723 { 695 updateLastAccess();696 724 return loginInfo != null; 697 725 } … … 1405 1433 query.setInteger("itemType", item.getValue()); 1406 1434 query.setString("subContext", subContext); 1407 for (Object ctx : HibernateUtil.loadList(Object.class, query ))1435 for (Object ctx : HibernateUtil.loadList(Object.class, query, null)) 1408 1436 { 1409 1437 Object[] o = (Object[])ctx; … … 1665 1693 */ 1666 1694 query.setInteger("client", clientId); 1667 return listToMap(HibernateUtil.loadList(ClientDefaultSettingData.class, query ));1695 return listToMap(HibernateUtil.loadList(ClientDefaultSettingData.class, query, null)); 1668 1696 } 1669 1697 … … 1680 1708 */ 1681 1709 query.setInteger("user", userId); 1682 return listToMap(HibernateUtil.loadList(UserDefaultSettingData.class, query ));1710 return listToMap(HibernateUtil.loadList(UserDefaultSettingData.class, query, null)); 1683 1711 } 1684 1712 … … 1696 1724 query.setInteger("user", userId); 1697 1725 query.setInteger("client", clientId); 1698 return listToMap(HibernateUtil.loadList(UserClientSettingData.class, query ));1726 return listToMap(HibernateUtil.loadList(UserClientSettingData.class, query, null)); 1699 1727 } 1700 1728 … … 1716 1744 { 1717 1745 // Load the existing settings from the database 1718 List<I> dbSettings = HibernateUtil.loadList(dataClass, query );1746 List<I> dbSettings = HibernateUtil.loadList(dataClass, query, null); 1719 1747 // Iterator the existing settings and check what has happened to them 1720 1748 for (SettingData s : dbSettings) … … 1786 1814 protected void cleanUp() 1787 1815 { 1788 if ( isLoggedIn()) logout();1816 if (!isClosed() && isLoggedIn()) logout(); 1789 1817 } 1790 1818 … … 1799 1827 cleanUp(); 1800 1828 } 1801 catch ( BaseException ex)1802 { 1803 log.warn("Exception during SessionControl.finalize()", ex);1829 catch (Throwable t) 1830 { 1831 log.warn("Exception during SessionControl.finalize()", t); 1804 1832 } 1805 1833 super.finalize(); 1806 1834 } 1807 1835 1808 1836 /** 1809 1837 Internal class to hold information about the logged in user. -
branches/2.4-stable/src/core/net/sf/basedb/core/Trashcan.java
r3675 r3808 73 73 { 74 74 org.hibernate.Session session = dc.getHibernateSession(); 75 SessionControl sc = dc.getSessionControl(); 75 76 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_REMOVED_ITEMS"); 76 77 /* … … 82 83 filter.setParameter("owner", dc.getSessionControl().getLoggedInUserId()); 83 84 84 List<RemovableData> removed = HibernateUtil.loadList(RemovableData.class, query );85 List<RemovableData> removed = HibernateUtil.loadList(RemovableData.class, query, sc); 85 86 List<Removable> items = new ArrayList<Removable>(removed.size()); 86 87 -
branches/2.4-stable/src/core/net/sf/basedb/core/Update.java
r3679 r3808 895 895 // Delete all affymetrix formulas 896 896 query = HibernateUtil.createQuery(session, "SELECT frm FROM FormulaData frm WHERE frm.rawDataType = 'affymetrix'"); 897 List<FormulaData> affyFormulas = HibernateUtil.loadList(FormulaData.class, query );897 List<FormulaData> affyFormulas = HibernateUtil.loadList(FormulaData.class, query, null); 898 898 for (FormulaData affyFormula : affyFormulas) 899 899 { … … 1134 1134 FROM FileData f 1135 1135 */ 1136 List<Integer> ids = HibernateUtil.loadList(Integer.class, query );1136 List<Integer> ids = HibernateUtil.loadList(Integer.class, query, null); 1137 1137 if (ids.size() > 0) 1138 1138 { … … 1149 1149 FROM ExperimentData xp 1150 1150 */ 1151 ids = HibernateUtil.loadList(Integer.class, query );1151 ids = HibernateUtil.loadList(Integer.class, query, null); 1152 1152 if (ids.size() > 0) 1153 1153 { … … 1164 1164 FROM RawBioAssayData rba 1165 1165 */ 1166 ids = HibernateUtil.loadList(Integer.class, query );1166 ids = HibernateUtil.loadList(Integer.class, query, null); 1167 1167 if (ids.size() > 0) 1168 1168 { … … 1213 1213 WHERE dcd.id = :dataCube 1214 1214 */ 1215 for (DataCubeData cubeData : HibernateUtil.loadList(DataCubeData.class, query ))1215 for (DataCubeData cubeData : HibernateUtil.loadList(DataCubeData.class, query, null)) 1216 1216 { 1217 1217 DataCube cube = dc.getItem(DataCube.class, cubeData); … … 1274 1274 JOIN evt.sources src 1275 1275 */ 1276 List<Object[]> events = HibernateUtil.loadList(Object[].class, eventQuery );1277 events.addAll(HibernateUtil.loadList(Object[].class, sourcesQuery ));1276 List<Object[]> events = HibernateUtil.loadList(Object[].class, eventQuery, null); 1277 events.addAll(HibernateUtil.loadList(Object[].class, sourcesQuery, null)); 1278 1278 1279 1279 // Calculate the remaining quantity for each biomaterial … … 1355 1355 WHERE f.lastUpdate IS NULL AND NOT f.internalName IS NULL 1356 1356 */ 1357 List<FileData> files = HibernateUtil.loadList(FileData.class, query );1357 List<FileData> files = HibernateUtil.loadList(FileData.class, query, null); 1358 1358 for (FileData fData : files) 1359 1359 { … … 1398 1398 "SELECT f FROM FileData f"); 1399 1399 1400 List<FileData> files = HibernateUtil.loadList(FileData.class, query );1400 List<FileData> files = HibernateUtil.loadList(FileData.class, query, null); 1401 1401 for (FileData fData : files) 1402 1402 { … … 1450 1450 "SELECT t FROM TransformationData t"); 1451 1451 1452 List<TransformationData> transformations = HibernateUtil.loadList(TransformationData.class, query );1452 List<TransformationData> transformations = HibernateUtil.loadList(TransformationData.class, query, null); 1453 1453 Map<JobData, Set<ExperimentData>> experiments = new HashMap<JobData, Set<ExperimentData>>(); 1454 1454 for (TransformationData transformation : transformations) … … 1524 1524 query.setEntity("pluginDefinition", base1Executer); 1525 1525 List<PluginConfigurationData> configurations = 1526 HibernateUtil.loadList(PluginConfigurationData.class, query );1526 HibernateUtil.loadList(PluginConfigurationData.class, query, null); 1527 1527 1528 1528 // Delete AnyToAny for each configuration … … 1676 1676 ) 1677 1677 */ 1678 List<PlateMappingData> mappings = HibernateUtil.loadList(PlateMappingData.class, pmQuery );1678 List<PlateMappingData> mappings = HibernateUtil.loadList(PlateMappingData.class, pmQuery, null); 1679 1679 if (mappings != null && mappings.size() > 0) 1680 1680 { … … 1695 1695 { 1696 1696 pQuery.setEntity("plateMapping", mapping); 1697 List<PlateData> plates = HibernateUtil.loadList(PlateData.class, pQuery );1697 List<PlateData> plates = HibernateUtil.loadList(PlateData.class, pQuery, null); 1698 1698 if (plates != null && plates.size() > 0) 1699 1699 { -
branches/2.4-stable/src/core/net/sf/basedb/core/User.java
r3679 r3808 146 146 */ 147 147 query.setParameterList("groups", groupIds, org.hibernate.Hibernate.INTEGER); 148 userIds.addAll(HibernateUtil.loadList(Integer.class, query ));148 userIds.addAll(HibernateUtil.loadList(Integer.class, query, null)); 149 149 150 150 // Get the users that have a quota group among the same groups … … 156 156 */ 157 157 query.setParameterList("groups", groupIds, org.hibernate.Hibernate.INTEGER); 158 userIds.addAll(HibernateUtil.loadList(Integer.class, query ));158 userIds.addAll(HibernateUtil.loadList(Integer.class, query, null)); 159 159 } 160 160 return userIds; … … 174 174 WHERE grp.default = true 175 175 */ 176 List<GroupData> defaultGroups = HibernateUtil.loadList(GroupData.class, query );176 List<GroupData> defaultGroups = HibernateUtil.loadList(GroupData.class, query, null); 177 177 for (GroupData group : defaultGroups) 178 178 { … … 185 185 WHERE rle.default = true 186 186 */ 187 List<RoleData> defaultRoles = HibernateUtil.loadList(RoleData.class, query );187 List<RoleData> defaultRoles = HibernateUtil.loadList(RoleData.class, query, null); 188 188 for (RoleData role : defaultRoles) 189 189 { … … 1090 1090 query.setEntity("user", this.getData()); 1091 1091 1092 List<OwnableData> ownedBy = HibernateUtil.loadList(OwnableData.class, query );1092 List<OwnableData> ownedBy = HibernateUtil.loadList(OwnableData.class, query, sc); 1093 1093 List<Ownable> items = new ArrayList<Ownable>(ownedBy.size()); 1094 1094
Note: See TracChangeset
for help on using the changeset viewer.