* returned\r
*/\r
public Limit<T> getLimitByName(String presetName) {\r
+ if (limit == null) {\r
+ return null;\r
+ }\r
if (Util.isEmpty(presetName)) {\r
// return default limit\r
return getDefaultLimit();\r
}\r
\r
@Override\r
- public Limit<T> getLimit(String presetName) {\r
-\r
+ public synchronized Limit<T> getLimit(String presetName) {\r
+ // Assume this function is called for the first time and thus need\r
+ // initialization\r
if (limits == null) {\r
limits = getLimits();\r
}\r
+ // Either the initialization failed or limits were not configured.\r
+ if (limits == null) {\r
+ return null;\r
+ }\r
\r
Limit<T> limit = null;\r
if (limits != null) {\r
*/\r
\r
public static <T> LimitsManager<T> getLimits(Class<Executable<T>> clazz) {\r
- LimitsManager<T> limits = new LimitsManager<T>();\r
+ LimitsManager<T> limits = null;\r
try {\r
limits = ConfExecutable.getRunnerLimits(clazz);\r
} catch (FileNotFoundException e) {\r
log.warn("IO exception while attempting to read limits for "\r
+ clazz + " executable! " + e.getLocalizedMessage(),\r
e.getCause());\r
- return null;\r
}\r
return limits;\r
}\r
\r
@Override\r
public Limit<AACon> getLimit(String presetName) {\r
+ if (limitMan == null) {\r
+ // Limit is not defined\r
+ return null;\r
+ }\r
return limitMan.getLimitByName(presetName);\r
}\r
\r
@Override\r
public Limit<ClustalW> getLimit(String presetName) {\r
Timer timer = Timer.getMilliSecondsTimer();\r
+ if (limitMan == null) {\r
+ // No limit is configured\r
+ return null;\r
+ }\r
Limit<ClustalW> limit = limitMan.getLimitByName(presetName);\r
getLogger().logAll(timer, "getLimit");\r
return limit;\r
}\r
+\r
@Override\r
public LimitsManager<ClustalW> getLimits() {\r
return limitMan;\r
\r
@Override\r
public Limit<Disembl> getLimit(String presetName) {\r
+ if (limitMan == null) {\r
+ // Limit is not defined\r
+ return null;\r
+ }\r
return limitMan.getLimitByName(presetName);\r
}\r
\r
\r
@Override\r
public Limit<GlobPlot> getLimit(String presetName) {\r
+ if (limitMan == null) {\r
+ // Limit is not defined\r
+ return null;\r
+ }\r
return limitMan.getLimitByName(presetName);\r
}\r
\r
\r
@Override\r
public Limit<Jronn> getLimit(String presetName) {\r
+ if (limitMan == null) {\r
+ return null;\r
+ }\r
return limitMan.getLimitByName(presetName);\r
}\r
\r
\r
@Override\r
public Limit<Mafft> getLimit(String presetName) {\r
+ if (limitMan == null) {\r
+ // Limit is not defined\r
+ return null;\r
+ }\r
return limitMan.getLimitByName(presetName);\r
}\r
\r
\r
@Override\r
public Limit<Muscle> getLimit(String presetName) {\r
+ if (limitMan == null) {\r
+ // No limit is configured\r
+ return null;\r
+ }\r
return limitMan.getLimitByName(presetName);\r
}\r
\r
\r
@Override\r
public Limit<Probcons> getLimit(String presetName) {\r
+ if (limitMan == null) {\r
+ // Limit is not defined\r
+ return null;\r
+ }\r
return limitMan.getLimitByName(presetName);\r
}\r
\r
\r
@Override\r
public Limit<Tcoffee> getLimit(String presetName) {\r
+ if (limitMan == null) {\r
+ // Limit is not defined\r
+ return null;\r
+ }\r
return limitMan.getLimitByName(presetName);\r
}\r
\r