Merging MK branch rev 567 (forward exceptions from SerializerObject)
This commit is contained in:
parent
d22f4c3ef6
commit
fe36c2ee29
@ -448,7 +448,6 @@
|
||||
<exclude name="CVS" />
|
||||
</fileset>
|
||||
</copy>
|
||||
-->
|
||||
|
||||
<tar tarfile="${distribution.directory}/eva2-bin-${DSTAMP}.tar">
|
||||
<tarfileset dir="${bin.dist.dir}">
|
||||
@ -465,7 +464,7 @@
|
||||
<include name="**" />
|
||||
<exclude name="*.tar*, *.zip" />
|
||||
</zipfileset>
|
||||
</zip>
|
||||
</zip>-->
|
||||
</target>
|
||||
|
||||
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
@ -16,3 +16,6 @@ ModulePackage = eva2.server.modules
|
||||
|
||||
# filter class for modules. Do not alter!
|
||||
ModuleFilterClass = eva2.server.modules.AbstractModuleAdapter
|
||||
|
||||
# Full EvA2 version number
|
||||
EvA2Version = 2.043
|
@ -956,6 +956,8 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
lastSols = (opt!=null) ? new Population(opt.getAllSolutions().getSolutions()) : pop;
|
||||
// Pair<String,Double[]> addData = getOutputData(informerList, lastSols);
|
||||
// System.out.println("lastSols size: " + 500*PSymbolicRegression.getAvgIndySize(lastSols));
|
||||
// System.out.println("Mem use: " + getMemoryUse());
|
||||
Pair<String,Object[]> addData = getOutputData(informerList, lastSols);
|
||||
if (doTextOutput()) { // this is where the text output is actually written
|
||||
if (printLineByVerbosity(iterationCounter)) {
|
||||
@ -1007,6 +1009,32 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
iterationCounter++;
|
||||
}
|
||||
|
||||
private static long getMemoryUse(){
|
||||
putOutTheGarbage();
|
||||
long totalMemory = Runtime.getRuntime().totalMemory();
|
||||
|
||||
putOutTheGarbage();
|
||||
long freeMemory = Runtime.getRuntime().freeMemory();
|
||||
|
||||
return (totalMemory - freeMemory);
|
||||
}
|
||||
private static void putOutTheGarbage() {
|
||||
collectGarbage();
|
||||
collectGarbage();
|
||||
}
|
||||
|
||||
private static void collectGarbage() {
|
||||
try {
|
||||
System.gc();
|
||||
Thread.currentThread().sleep(100);
|
||||
System.runFinalization();
|
||||
Thread.currentThread().sleep(100);
|
||||
}
|
||||
catch (InterruptedException ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given iteration is a verbose one according to StatsParameter - meaning
|
||||
|
@ -72,22 +72,24 @@ public class SerializedObject implements Serializable {
|
||||
* will be a deep copy of the original stored object.
|
||||
*
|
||||
* @return the deserialized Object.
|
||||
* @throws IOException
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
public Object getObject() {
|
||||
try {
|
||||
InputStream is = new ByteArrayInputStream(m_Serialized);
|
||||
if (m_Compressed) {
|
||||
is = new GZIPInputStream(is);
|
||||
}
|
||||
is = new BufferedInputStream(is);
|
||||
ObjectInputStream oi = new ObjectInputStream(is);
|
||||
Object result = oi.readObject();
|
||||
oi.close();
|
||||
return result;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
public Object getObject() throws IOException, ClassNotFoundException {
|
||||
// try {
|
||||
InputStream is = new ByteArrayInputStream(m_Serialized);
|
||||
if (m_Compressed) {
|
||||
is = new GZIPInputStream(is);
|
||||
}
|
||||
return null;
|
||||
is = new BufferedInputStream(is);
|
||||
ObjectInputStream oi = new ObjectInputStream(is);
|
||||
Object result = oi.readObject();
|
||||
oi.close();
|
||||
return result;
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,7 +208,7 @@ public class Serializer {
|
||||
File f = new File(Filename);
|
||||
if (f.exists()) {
|
||||
try {
|
||||
s=(Object)load(new File(Filename));
|
||||
s=(Object)load(f);
|
||||
} catch (InvalidClassException e) {
|
||||
System.err.println("WARNING: loading object File "+Filename+ " not possible, this may happen on source code changes.");
|
||||
System.err.println(e.getMessage());
|
||||
@ -216,7 +216,8 @@ public class Serializer {
|
||||
System.err.println("ClassNotFoundException on loading object File " + Filename + ". This may happen on refactorings.");
|
||||
System.err.println(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("WARNING: loading object File "+Filename+ " not possible! ("+e.getMessage()+")");
|
||||
if (!casually) throw new RuntimeException("WARNING: loading object File "+Filename+ " not possible! ("+e.getMessage()+")");
|
||||
else return null;
|
||||
}
|
||||
return s;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user