Lots of code cleanup, proper documentation and removal of unneccessary methods.

This commit is contained in:
2012-04-23 15:25:57 +00:00
parent 17061b1475
commit 20c0c21c02
10 changed files with 219 additions and 289 deletions

View File

@@ -1,13 +1,9 @@
package eva2.client;
import javax.swing.*;
import eva2.gui.ExtAction;
import java.awt.event.WindowListener;
import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
/**
* Created by IntelliJ IDEA.
@@ -20,7 +16,7 @@ import java.awt.event.WindowEvent;
*
*/
class AppExitAction extends ExtAction implements WindowListener{
public AppExitAction(String s, String toolTip, KeyStroke key){
public AppExitAction(String s, String toolTip, javax.swing.KeyStroke key) {
super(s, toolTip, key);
}
private void exit(){

View File

@@ -11,22 +11,27 @@ import eva2.gui.GenericObjectEditor;
*
*/
public class ClassPreloader implements Runnable {
String[] clsNames = null;
private static boolean TRACE=false;
/**
* List of classes to load when ClassPreloader is started.
*/
private String[] classNames = null;
public ClassPreloader(String ... strs) {
setClassNames(strs);
}
private void setClassNames(String[] strs) {
clsNames = strs;
/* Creates a new ClassPreloader and sets the
* list of classes to load.
*
* @param classes List of classes to load
*/
public ClassPreloader(final String ... classes) {
this.classNames = classes;
}
/**
* Load classes via GenericObjectEditor in a thread.
*/
public void run() {
if (clsNames !=null) {
for (int i = 0; i < clsNames.length; i++) {
if (TRACE) System.out.println("Preloading " + clsNames[i]);
GenericObjectEditor.getClassesFromClassPath(clsNames[i], null);
if (classNames != null) {
for (int i = 0; i < classNames.length; i++) {
GenericObjectEditor.getClassesFromClassPath(classNames[i], null);
}
}
}

View File

@@ -10,27 +10,15 @@ package eva2.client;
* $Date: 2007-12-06 16:05:11 +0100 (Thu, 06 Dec 2007) $
* $Author: mkron $
*/
/*==========================================================================*
* IMPORTS
*==========================================================================*/
import java.rmi.RemoteException;
import eva2.EvAInfo;
import eva2.gui.LoggingPanel;
import eva2.server.EvAMainAdapter;
import eva2.server.EvAMainAdapterImpl;
import eva2.server.go.InterfaceGOParameters;
import eva2.server.modules.ModuleAdapter;
import eva2.tools.jproxy.ComAdapter;
import eva2.tools.jproxy.MainAdapter;
import eva2.tools.jproxy.MainAdapterClient;
import eva2.tools.jproxy.RMIConnection;
import eva2.tools.jproxy.RMIInvocationHandler;
import eva2.tools.jproxy.*;
import java.rmi.RemoteException;
/*==========================================================================*
* CLASS DECLARATION
*==========================================================================*/
/**
*
*/
@@ -134,5 +122,3 @@ public class EvAComAdapter extends ComAdapter {
this.runLocally = runLocally;
}
}
//

View File

@@ -54,14 +54,18 @@ public class JEFrame extends JFrame {
public void windowClosed(WindowEvent e) {
super.windowClosed(e);
JEFrameRegister.unregister((JEFrame) e.getWindow());
if (closeAllOnClose) JEFrameRegister.closeAll();
if (closeAllOnClose) {
JEFrameRegister.closeAll();
}
// ((JFrame) e.getWindow()).dispose();
}
@Override
public void windowOpened(WindowEvent e) {
super.windowOpened(e);
JEFrameRegister.register((JEFrame) e.getWindow());
}
@Override
public void windowActivated(WindowEvent e) {
JEFrameRegister.register((JEFrame) e.getWindow());

View File

@@ -21,32 +21,37 @@ public class EvAServer {
* MainAdapterImp object. This is need for the first connection between the
* server and the client program.
*/
public EvAMainAdapter m_MainRemoteObject;
private EvAMainAdapter mainRemoteObject;
//private EvAComAdapter m_ComAdapter;
public static String m_UserName;
public static int m_NumberOfVM = 0;
private RMIServerEvA m_RMIServer;
private static final Logger logger = Logger.getLogger(EvAInfo.defaultLogger);
private static String userName;
private RMIServerEvA rmiServer;
private static final Logger LOGGER = Logger.getLogger(EvAInfo.defaultLogger);
/**
* Constructor of EvAServer. Calls RMIConnection().
*/
public EvAServer(boolean insideClient, boolean Restart) {
logger.log(Level.INFO, "Number of CPUs :" + Runtime.getRuntime().availableProcessors());
logger.log(Level.INFO, "This is EvA Server Version: " + EvAInfo.getVersion());
logger.log(Level.INFO, "Java Version: " + System.getProperty("java.version"));
m_UserName = System.getProperty("user.name");
// RMIConnection();
// m_ComAdapter = new EvAComAdapter();
// RMIProxyRemote.setComAdaper(m_ComAdapter);
m_RMIServer = RMIServerEvA.getInstance();
public EvAServer(boolean insideClient, boolean restart) {
LOGGER.log(Level.INFO, "Number of CPUs :{0}", Runtime.getRuntime().availableProcessors());
LOGGER.log(Level.INFO, "This is EvA Server Version: {0}", EvAInfo.getVersion());
LOGGER.log(Level.INFO, "Java Version: {0}", System.getProperty("java.version"));
try {
userName = System.getProperty("user.name");
} catch (SecurityException ex) {
/*
* This exception is expected to happen in Java WebStart
*/
LOGGER.log(Level.WARNING, "Could not fetch username property. Setting username to 'WebStart'", ex);
userName = "WebStart";
}
rmiServer = RMIServerEvA.getInstance();
}
/**
* Main method of this class. Is the starting point of the server
* application.
*/
static public void main(String[] args) {
public static void main(String[] args) {
boolean restart = false;
boolean noMulti = false;
for (int i = 0; i < args.length; i++) {
@@ -121,7 +126,7 @@ public class EvAServer {
*
*/
public RMIServerEvA getRMIServer() {
return m_RMIServer;
return rmiServer;
}
/**

View File

@@ -33,6 +33,8 @@ import eva2.tools.Pair;
import eva2.tools.jproxy.MainAdapterClient;
import eva2.tools.jproxy.RMIProxyLocal;
import eva2.tools.jproxy.RMIProxyRemote;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* A statistics class to plot fitness curves in client-server mode. Mainly, arrays of GraphWindows
@@ -42,58 +44,58 @@ import eva2.tools.jproxy.RMIProxyRemote;
*/
public class StatisticsWithGUI extends AbstractStatistics implements Serializable, InterfaceStatistics {
private static final long serialVersionUID = 3213603978877954103L;
private static final Logger LOGGER = Logger.getLogger(eva2.EvAInfo.defaultLogger);
// Plot frames:
private GraphWindow[] m_FitnessFrame; // frame for the fitness plots
private Graph[][] m_FitnessGraph;
private Graph[][] m_StatGraph;
private GraphWindow[] fitnessFrame; // frame for the fitness plots
private Graph[][] fitnessGraph;
private Graph[][] statGraph;
private String m_GraphInfoString;
protected int m_PlotCounter;
private String graphInfoString;
protected int plotCounter;
private MainAdapterClient m_MainAdapterClient; // the connection to the client MainAdapter
private JTextoutputFrameInterface m_ProxyPrinter;
private transient List<Pair<String, Integer>> graphDesc=null; // list of descriptor strings and optional indices. strictly its redundant since super.lastGraphSelection is always available. However it spares some time.
private MainAdapterClient mainAdapterClient; // the connection to the client MainAdapter
private JTextoutputFrameInterface proxyPrinter;
//////////////
protected static String m_MyHostName = null;
/* List of descriptor strings and optional indices. strictly its
* redundant since super.lastGraphSelection is always available.
* However it spares some time.
*/
private transient List<Pair<String, Integer>> graphDesc = null;
protected static String hostName = null;
/**
*
*/
public MainAdapterClient getMainAdapterClient() {
return m_MainAdapterClient;
return mainAdapterClient;
}
/**
*
*/
public StatisticsWithGUI(MainAdapterClient Client) {
if (TRACE)
System.out.println("Constructor RMIStatistics");
m_MainAdapterClient = Client;
if (Client != null) { // were probably in rmi mode
public StatisticsWithGUI(MainAdapterClient client) {
mainAdapterClient = client;
if (client != null) { // We are probably in rmi mode
try {
m_MyHostName = InetAddress.getLocalHost().getHostName();
} catch (Exception e) {
System.err.println(
"InetAddress.getLocalHost().getHostAddress() --> ERROR" +
e.getMessage());
hostName = InetAddress.getLocalHost().getHostName();
} catch (Exception ex) {
LOGGER.log(Level.WARNING, "Could not retrieve hostname.", ex);
}
} else m_MyHostName = "localhost";
} else hostName = "localhost";
if ((Client == null) || Client.getHostName().equals(m_MyHostName)) {
if ((client == null) || client.getHostName().equals(hostName)) {
m_StatsParams = StatsParameter.getInstance(true);
m_ProxyPrinter = new JTextoutputFrame("TextOutput of " + m_MyHostName);
proxyPrinter = new JTextoutputFrame("TextOutput of " + hostName);
} else { // we use RMI
m_StatsParams = (InterfaceStatisticsParameter)RMIProxyLocal.newInstance(
StatsParameter.getInstance(true));
m_ProxyPrinter = (JTextoutputFrameInterface) RMIProxyRemote.newInstance(new
JTextoutputFrame("TextOutput " + m_MyHostName),
m_MainAdapterClient);
proxyPrinter = (JTextoutputFrameInterface) RMIProxyRemote.newInstance(new
JTextoutputFrame("TextOutput " + hostName),
mainAdapterClient);
}
addTextListener(m_ProxyPrinter);
if (TRACE) System.out.println("Constructor RMIStatistics --> end");
addTextListener(proxyPrinter);
}
/**
@@ -101,12 +103,12 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
*/
public synchronized void startOptPerformed(String infoString, int runNumber, Object goParams, List<InterfaceAdditionalPopulationInformer> informerList) {
super.startOptPerformed(infoString, runNumber, goParams, informerList);
m_GraphInfoString = infoString;
graphInfoString = infoString;
// m_TextCounter = m_StatisticsParameter.GetTextoutput();
// m_PlotCounter = m_StatsParams.GetPlotoutput();
if ((m_FitnessFrame!=null) && (m_FitnessFrame[0]!=null)) {
PlotInterface p = m_FitnessFrame[0].getPlotter();
if ((fitnessFrame!=null) && (fitnessFrame[0]!=null)) {
PlotInterface p = fitnessFrame[0].getPlotter();
if ((p!=null) && p.isValid()) ((Plot)p).getFunctionArea().clearLegend();
}
}
@@ -123,24 +125,22 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
if (!normal) fullRuns--;
// unite the graphs only if the break was "normal"
if ((m_StatsParams.getMultiRuns() > 1) && (m_StatGraph != null)) {
if ((m_StatsParams.getMultiRuns() > 1) && (statGraph != null)) {
// unite the point sets for a multirun
for (int i = 0; i < m_FitnessGraph.length; i++) {
for (int j = 0; j < m_FitnessGraph[i].length; j++) {
m_StatGraph[i][j].setInfoString(
(m_FitnessGraph[i][j].getInfo().length() > 0 ? (m_FitnessGraph[i][j].getInfo() + "_") : "" )
// + (m_StatsParams.GetInfoString().length() > 0 ? (m_StatsParams.GetInfoString() + "_") : "" )
// + m_StatsParams.GetInfoString()
for (int i = 0; i < fitnessGraph.length; i++) {
for (int j = 0; j < fitnessGraph[i].length; j++) {
statGraph[i][j].setInfoString(
(fitnessGraph[i][j].getInfo().length() > 0 ? (fitnessGraph[i][j].getInfo() + "_") : "" )
+ "Mean_of_" + fullRuns + " ",
(float) 2.0);
if (normal && m_FitnessFrame[i].isValid() && (m_FitnessGraph[i][j].getPointCount()>0)) {
m_StatGraph[i][j].addGraph(m_FitnessGraph[i][j]);
m_FitnessGraph[i][j].clear();
if (normal && fitnessFrame[i].isValid() && (fitnessGraph[i][j].getPointCount()>0)) {
statGraph[i][j].addGraph(fitnessGraph[i][j]);
fitnessGraph[i][j].clear();
}
}
}
}
PlotInterface p = m_FitnessFrame[0].getPlotter();
PlotInterface p = fitnessFrame[0].getPlotter();
if ((optRunsPerformed >= m_StatsParams.getMultiRuns()) || !normal) {
// update the legend after the last multirun or after a user break
if ((p!=null) && p.isValid()) {
@@ -150,7 +150,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
}
public void maybeShowProxyPrinter() {
if (m_ProxyPrinter != null) m_ProxyPrinter.setShow(m_StatsParams.isShowTextOutput());
if (proxyPrinter != null) proxyPrinter.setShow(m_StatsParams.isShowTextOutput());
}
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
@@ -168,63 +168,59 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
int windowCount = 1; // TODO this was earlier description.length for the 2-D String-Array returned by m_StatsParams.getPlotDescriptions, which however always returned an array of length 1 (in the first dim).
int graphCount = graphDesc.size();
// System.out.println("Initializing " + graphCount + " plots (StatisticsWithGUI)");
m_FitnessFrame = new GraphWindow[windowCount];
for (int i = 0; i < m_FitnessFrame.length; i++) {
// m_FitnessFrame[i] = GraphWindow.getInstance(m_MainAdapterClient, m_GraphInfoString + " " + i + " " + " on " + m_MyHostName + ", VM " + EvAServer.m_NumberOfVM, "function calls", "fitness");
m_FitnessFrame[i] = GraphWindow.getInstance(m_MainAdapterClient, "Optimization " + i + " " + " on " + m_MyHostName + ", VM " + EvAServer.m_NumberOfVM, "function calls", "fitness");
fitnessFrame = new GraphWindow[windowCount];
for (int i = 0; i < fitnessFrame.length; i++) {
fitnessFrame[i] = GraphWindow.getInstance(mainAdapterClient, "Optimization " + i + " " + " on " + hostName, "function calls", "fitness");
}
m_FitnessGraph = new Graph[windowCount][];
fitnessGraph = new Graph[windowCount][];
// contains one graph for every value to be plotted (best / worst / best+worst)
// TODO Im really not sure why this is a 2-dimensional array. shouldnt one be enough?
for (int i = 0; i < m_FitnessGraph.length; i++) {
m_FitnessGraph[i] = new Graph[graphCount];
for (int j = 0; j < m_FitnessGraph[i].length; j++) {
for (int i = 0; i < fitnessGraph.length; i++) {
fitnessGraph[i] = new Graph[graphCount];
for (int j = 0; j < fitnessGraph[i].length; j++) {
// String[] d = (String[]) description.get(i);
// this is where the column string for ascii export is created! Uah!
m_FitnessGraph[i][j] =
m_FitnessFrame[i].getNewGraph(graphDesc.get(j).head + "_" +
// m_StatsParams.GetInfoString() +
m_GraphInfoString);
// m_FitnessGraph[i][j] =
// m_FitnessFrame[i].getNewGraph(d[j] + "_" +
// m_StatsParams.GetInfoString() +
// m_GraphInfoString);
m_FitnessGraph[i][j].jump();
fitnessGraph[i][j] =
fitnessFrame[i].getNewGraph(graphDesc.get(j).head + "_"
+ graphInfoString);
fitnessGraph[i][j].jump();
}
}
if (m_StatsParams.getMultiRuns() > 1 &&
m_StatsParams.GetUseStatPlot() == true) {
// String Info = m_StatsParams.GetInfoString();
m_StatGraph = new Graph[windowCount][];
for (int i = 0; i < m_StatGraph.length; i++) {
m_StatGraph[i] = new Graph[graphCount];
for (int j = 0; j < m_StatGraph[i].length; j++) {
statGraph = new Graph[windowCount][];
for (int i = 0; i < statGraph.length; i++) {
statGraph[i] = new Graph[graphCount];
for (int j = 0; j < statGraph[i].length; j++) {
// String[] d = (String[]) description.get(i);
m_StatGraph[i][j] = m_FitnessFrame[i].getNewGraph(graphDesc.get(j).head + "_" + //Info +
m_GraphInfoString);
statGraph[i][j] = fitnessFrame[i].getNewGraph(graphDesc.get(j).head + "_" + //Info +
graphInfoString);
}
}
}
}
private void plotFitnessPoint(int graph, int subGraph, int x, double y) {
if (m_FitnessGraph == null) {
if (fitnessGraph == null) {
EVAERROR.WARNING("fitness graph is null! (StatisticsWithGUI)");
return;
}
if (graph >= m_FitnessGraph.length || subGraph >= m_FitnessGraph[graph].length) {
if (graph >= fitnessGraph.length || subGraph >= fitnessGraph[graph].length) {
EVAERROR.WARNING("tried to plot to invalid graph! (StatisticsWithGUI)");
return;
}
boolean isValidGraph = m_FitnessFrame[graph].isValid();
boolean isValidGraph = fitnessFrame[graph].isValid();
if (!isValidGraph) {
// this happens if the user closed the plot window.
// if the plots are reinitialized immediately, the user might get angry, so wait (till next opt start)
// EVAERROR.WARNING("fitness graph is invalid, trying to reinitialize...");
// initPlots(getDescription());
}
if (isValidGraph) m_FitnessGraph[graph][subGraph].setConnectedPoint(x, y);
if (isValidGraph) {
fitnessGraph[graph][subGraph].setConnectedPoint(x, y);
}
}
/**
@@ -290,8 +286,8 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
// if (m_PlotCounter == 0) {
// m_PlotCounter = m_StatsParams.GetPlotoutput();
int index = 0;
for (int i = 0; i < m_FitnessGraph.length; i++) {
for (int j = 0; j < m_FitnessGraph[i].length; j++) {
for (int i = 0; i < fitnessGraph.length; i++) {
for (int j = 0; j < fitnessGraph[i].length; j++) {
plotFitnessPoint(i, j, calls, specificData[index]);
index++;
}
@@ -300,6 +296,6 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
}
public String getHostName() {
return m_MyHostName;
return hostName;
}
}

View File

@@ -44,6 +44,8 @@ import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import eva2.EvAInfo;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -64,8 +66,7 @@ public class BasicResourceLoader implements ResourceLoader
/**
* Obtain a suitable logger.
*/
private static DummyCategory logger = DummyCategory.getInstance(
BasicResourceLoader.class.getName());
private static Logger logger = Logger.getLogger(eva2.EvAInfo.defaultLogger);
private static BasicResourceLoader resourceLoader;
//~ Constructors ///////////////////////////////////////////////////////////
@@ -158,21 +159,19 @@ public class BasicResourceLoader implements ResourceLoader
{
line = line.trim();
if (strStartsWithPrefix(line, ignorePrefix) < 0) {
if (lineCnt >= lOffset) lineData.add(line);
lineCnt++;
if ((lCnt > 0) && (lineData.size() == lCnt)) break;
if (lineCnt >= lOffset) {
lineData.add(line);
}
lineCnt++;
if ((lCnt > 0) && (lineData.size() == lCnt)) {
break;
}
}
// if (line.trim().length() > 0) {
// if ((ignorePrefix == null) || (strStartsWithPrefix(line, ignorePrefix) < 0)) {
// // if there are no prefixes given or none of them fits, add the line
// lineData.add(line);
// }
// }
}
}
catch (IOException ex)
{
logger.error(ex.getMessage());
logger.log(Level.SEVERE, ex.getMessage(), ex);
}
return lineData;
@@ -363,10 +362,11 @@ public class BasicResourceLoader implements ResourceLoader
// in = getStreamFromClassPath(resourceLocation);
}
if (logger.isDebugEnabled())
{
if (in == null) logger.debug("Unable to open stream for " + resourceLocation);
else logger.debug("Stream opened for " + resourceLocation);
if (in == null) {
logger.log(Level.FINER, "Unable to open stream for " + resourceLocation);
}
else {
logger.log(Level.FINER, "Stream opened for " + resourceLocation);
}
return in;
}
@@ -499,10 +499,9 @@ public class BasicResourceLoader implements ResourceLoader
}
}
}
catch (Exception e)
catch (Exception ex)
{
logger.error(e.getMessage());
logger.log(Level.SEVERE, ex.getMessage(), ex);
return null;
}
@@ -524,10 +523,7 @@ public class BasicResourceLoader implements ResourceLoader
fileName.substring(length + 1);
}
if (logger.isDebugEnabled())
{
logger.debug("Trying to get file from " + fileName);
}
logger.log(Level.FINER, "Trying to get file from " + fileName);
File file = new File(fileName);
FileInputStream fis = null;
@@ -537,10 +533,9 @@ public class BasicResourceLoader implements ResourceLoader
fis = new FileInputStream(file);
return fis;
}
catch (Exception e)
catch (Exception ex)
{
if (logger.isDebugEnabled()) logger.error(e.getMessage());
logger.log(Level.SEVERE, ex.getMessage(), ex);
return null;
}
@@ -581,9 +576,9 @@ public class BasicResourceLoader implements ResourceLoader
rb += chunk;
}
}
catch (Exception e)
catch (Exception ex)
{
logger.error(e.getMessage());
logger.log(Level.SEVERE, ex.getMessage(), ex);
return null;
}
@@ -604,11 +599,6 @@ public class BasicResourceLoader implements ResourceLoader
return null;
}
if (logger.isDebugEnabled())
{
logger.debug("Trying to get file from stream.");
}
BufferedInputStream bis = new BufferedInputStream(stream);
try
@@ -632,10 +622,9 @@ public class BasicResourceLoader implements ResourceLoader
return b;
}
catch (Exception e)
catch (Exception ex)
{
logger.error(e.getMessage());
logger.log(Level.SEVERE, ex.getMessage(), ex);
return null;
}
}

View File

@@ -1,41 +0,0 @@
package eva2.tools;
/**
* Dummy class replacing the log4j Category because log4j couldnt be included in a clean
* way and seemingly wasnt used in the main classes anyways.
*
* @author mkron, mpaly
*
*/
public class DummyCategory {
static DummyCategory dummy = new DummyCategory();
static boolean bDebugEnabled = false;
public void error() {
System.err.println("Error");
}
public void error(String msg) {
System.err.println(msg);
}
public static DummyCategory getInstance(String str) {
return dummy;
}
public boolean isDebugEnabled() {
return bDebugEnabled;
}
public void debug(String str) {
System.err.println(str);
}
public void info(String str) {
System.err.println(str);
}
public void warn(String str) {
System.err.println(str);
}
}

View File

@@ -1,6 +1,8 @@
package eva2.tools;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Title: EvA2
* Description:
@@ -16,66 +18,54 @@ import java.util.HashMap;
*
*/
public class EVAERROR {
static boolean MAIL_ON_ERROR = false;
static boolean MAIL_ON_WARNING = false;
transient static HashMap<String, Boolean> errMap = null;
private static final Logger logger = Logger.getLogger(eva2.EvAInfo.defaultLogger);
private static transient HashMap<String, Boolean> errorMap = null;
/**
*
*/
static public void EXIT(String Message) {
// if (MAIL_ON_ERROR)
// EVAMail.SendMail("EvA EXIT on ERROR !! ",Message,"ulmerh@informatik.uni-tuebingen.de");
System.err.println("ERROR: "+Message);
System.out.flush();
System.err.flush();
public static void EXIT(String message) {
logger.log(Level.SEVERE, message);
System.exit(-1);
}
/**
*
*/
static public void EXIT(String Message, Exception e) {
System.out.println("ERROR: "+Message);
System.out.println("Exception: ");
e.printStackTrace();
// if (MAIL_ON_ERROR)
// EVAMail.SendMail("EvA EXIT on ERROR !! ",Message+e.toString(),"ulmerh@informatik.uni-tuebingen.de");
System.out.flush();
System.err.flush();
public static void EXIT(String message, Exception ex) {
logger.log(Level.SEVERE, message, ex);
System.exit(-1);
}
/**
*
*/
static public void WARNING(String Message) {
// if (MAIL_ON_WARNING)
// EVAMail.SendMail("EvA EXIT on ERROR !! ",Message,"ulmerh@informatik.uni-tuebingen.de");
System.err.println("WARNING: "+Message);
System.out.flush();
System.err.flush();
public static void WARNING(String message) {
logger.log(Level.WARNING, message);
}
/**
* Send a message only once to System.err. Once means that the msg is
* stored for the lifetime of the VM or until clearMsgCache() is called.
* Send a message only once to System.err. Once means that the msg is stored for the lifetime of
* the VM or until clearMsgCache() is called.
*
* @param msg
*/
static public void errorMsgOnce(String msg) {
if (errMap == null) errMap = new HashMap<String, Boolean>();
public static void errorMsgOnce(String message) {
if (errorMap == null) {
errorMap = new HashMap<String, Boolean>();
}
if (!errMap.containsKey(msg)) {
System.err.println(msg);
errMap.put(msg, true);
if (!errorMap.containsKey(message)) {
logger.log(Level.SEVERE, message);
errorMap.put(message, true);
}
}
/**
* Clear the error message cache, so that any error messages are
* displayed at least once.
* Clear the error message cache, so that any error messages are displayed at least once.
*/
static public void clearMsgCache() {
if (errMap != null) errMap.clear();
public static void clearMsgCache() {
if (errorMap != null) {
errorMap.clear();
}
}
}

View File

@@ -68,7 +68,7 @@ public class RMIServer {
/**
* Launchs the RMIRegistry and makes the registration
* Launches the RMIRegistry and makes the registration
* of the MainAdapterImpl class at the rmiregistry.
* @param
*/