From: amwaterhouse Date: Tue, 13 Sep 2005 17:44:08 +0000 (+0000) Subject: Warn if out of memory X-Git-Tag: Release_2_05b~41 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e5c2e37b24f09c90f2f7c748f6be10ce025da261;p=jalview.git Warn if out of memory --- diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 474a158..d1005c2 100755 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -28,6 +28,7 @@ import java.awt.*; import java.awt.event.*; import java.util.*; +import javax.swing.JOptionPane; /** @@ -89,46 +90,59 @@ public class PCAPanel extends GPCAPanel implements Runnable */ public void run() { - pca = new PCA(seqs); - pca.run(); - - // Now find the component coordinates - int ii = 0; - - while ((ii < seqs.length) && (seqs[ii] != null)) - { - ii++; - } - - double[][] comps = new double[ii][ii]; - - for (int i = 0; i < ii; i++) - { - if (pca.getEigenvalue(i) > 1e-4) - { - comps[i] = pca.component(i); - } - } - - ////////////////// - xCombobox.setSelectedIndex(0); - yCombobox.setSelectedIndex(1); - zCombobox.setSelectedIndex(2); - - top = pca.getM().rows - 1; - - Vector points = new Vector(); - float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100); - - for (int i = 0; i < pca.getM().rows; i++) - { - SequencePoint sp = new SequencePoint(seqs[i], scores[i]); - points.addElement(sp); - } - - rc.setPoints(points, pca.getM().rows); - rc.repaint(); - seqs = null; + try{ + pca = new PCA(seqs); + pca.run(); + + // Now find the component coordinates + int ii = 0; + + while ( (ii < seqs.length) && (seqs[ii] != null)) + { + ii++; + } + + double[][] comps = new double[ii][ii]; + + for (int i = 0; i < ii; i++) + { + if (pca.getEigenvalue(i) > 1e-4) + { + comps[i] = pca.component(i); + } + } + + ////////////////// + xCombobox.setSelectedIndex(0); + yCombobox.setSelectedIndex(1); + zCombobox.setSelectedIndex(2); + + top = pca.getM().rows - 1; + + Vector points = new Vector(); + float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100); + + for (int i = 0; i < pca.getM().rows; i++) + { + SequencePoint sp = new SequencePoint(seqs[i], scores[i]); + points.addElement(sp); + } + + rc.setPoints(points, pca.getM().rows); + rc.repaint(); + seqs = null; + } + catch(OutOfMemoryError er) + { JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Out of memory calculating PCA!!" + + + "\nSee help files for increasing Java Virtual Machine memory." + , "Out of memory", + JOptionPane.WARNING_MESSAGE); + System.out.println("PCAPanel: "+er); + + } + } /** diff --git a/src/jalview/ws/JPredClient.java b/src/jalview/ws/JPredClient.java index 4302df2..80a66c3 100755 --- a/src/jalview/ws/JPredClient.java +++ b/src/jalview/ws/JPredClient.java @@ -248,6 +248,18 @@ public class JPredClient { } } + catch (OutOfMemoryError er) + { + jobComplete = true; + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Out of memory handling result!!" + + + "\nSee help files for increasing Java Virtual Machine memory." + , "Out of memory", + JOptionPane.WARNING_MESSAGE); + System.out.println("JPredClient: "+er); + } } if (result!=null) if (! (result.isJobFailed() || result.isServerError())) diff --git a/src/jalview/ws/MsaWSClient.java b/src/jalview/ws/MsaWSClient.java index 7f754e0..0d4b2c1 100755 --- a/src/jalview/ws/MsaWSClient.java +++ b/src/jalview/ws/MsaWSClient.java @@ -280,8 +280,9 @@ public class MsaWSClient { if (result.getStatus() != null) { - wsInfo.setProgressText(OutputHeader + "\n" + - result.getStatus()); + System.out.println("result "+result.getStatus().length()); + wsInfo.setProgressText(OutputHeader + "\n" ); + // result.getStatus()); } if (result.isServerError()) { @@ -325,6 +326,16 @@ public class MsaWSClient { } } + catch(OutOfMemoryError er) + { + jobComplete = true; + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Out of memory handling result!!" + +"\nSee help files for increasing Java Virtual Machine memory." + ,"Out of memory", JOptionPane.WARNING_MESSAGE ); + System.out.println("MsaWSClient: "+er); + } } if (allowedServerExceptions == 0) @@ -425,18 +436,21 @@ public class MsaWSClient if (result.getStatus() != null) { - OutputHeader += ("\n" + result.getStatus()); + System.out.println("get status " +result.getStatus().length()); + // OutputHeader += ("\n" + result.getStatus()); } if (result.getMsa() != null) { - OutputHeader += "\nAlignment Object Method Notes\n"; + System.out.println("get msa"); + // OutputHeader += "\nAlignment Object Method Notes\n"; String[] lines = result.getMsa().getMethod(); +System.out.println("lines "+lines.length); for (int line = 0; line < lines.length; line++) { - OutputHeader += (lines[line] + "\n"); + // OutputHeader += (lines[line] + "\n"); } // JBPNote The returned files from a webservice could be hidden behind icons in the monitor window that, when clicked, pop up their corresponding data