1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import jalview.util.MessageManager; |
24 |
|
|
25 |
|
import java.awt.Component; |
26 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 6 |
Complexity Density: 0.43 |
|
27 |
|
public class OOMWarning implements Runnable |
28 |
|
{ |
29 |
|
String action = null; |
30 |
|
|
31 |
|
String instructions = ""; |
32 |
|
|
33 |
|
public static boolean oomInprogress = false; |
34 |
|
|
35 |
|
Component desktop = null; |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
@param |
41 |
|
|
42 |
|
@param |
43 |
|
|
44 |
|
@param |
45 |
|
|
46 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
47 |
0 |
OOMWarning(final String action, final OutOfMemoryError oomex,... |
48 |
|
final Component instance) |
49 |
|
{ |
50 |
0 |
if (!oomInprogress) |
51 |
|
{ |
52 |
0 |
oomInprogress = true; |
53 |
0 |
this.action = action; |
54 |
0 |
desktop = instance; |
55 |
0 |
if (oomex != null) |
56 |
|
{ |
57 |
0 |
if (jalview.bin.Cache.log != null) |
58 |
|
{ |
59 |
0 |
jalview.bin.Cache.log.error("Out of Memory when " + action, |
60 |
|
oomex); |
61 |
|
} |
62 |
|
else |
63 |
|
{ |
64 |
0 |
System.err.println("Out of Memory when " + action); |
65 |
0 |
oomex.printStackTrace(); |
66 |
|
} |
67 |
|
} |
68 |
0 |
javax.swing.SwingUtilities.invokeLater(this); |
69 |
0 |
System.gc(); |
70 |
|
} |
71 |
|
} |
72 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
73 |
0 |
public OOMWarning(String string, OutOfMemoryError oomerror)... |
74 |
|
{ |
75 |
0 |
this(string, oomerror, Desktop.desktop); |
76 |
|
} |
77 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
78 |
0 |
@Override... |
79 |
|
public void run() |
80 |
|
{ |
81 |
0 |
oomInprogress = false; |
82 |
0 |
JvOptionPane.showInternalMessageDialog(desktop, MessageManager |
83 |
|
.formatMessage("warn.out_of_memory_when_action", new String[] |
84 |
|
{ action }), MessageManager.getString("label.out_of_memory"), |
85 |
|
JvOptionPane.WARNING_MESSAGE); |
86 |
|
|
87 |
|
} |
88 |
|
|
89 |
|
} |