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.bin.Console; |
24 |
|
import jalview.util.MessageManager; |
25 |
|
|
26 |
|
import java.awt.Component; |
27 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 5 |
Complexity Density: 0.45 |
|
28 |
|
public class OOMWarning implements Runnable |
29 |
|
{ |
30 |
|
String action = null; |
31 |
|
|
32 |
|
String instructions = ""; |
33 |
|
|
34 |
|
public static boolean oomInprogress = false; |
35 |
|
|
36 |
|
Component desktop = null; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
@param |
42 |
|
|
43 |
|
@param |
44 |
|
|
45 |
|
@param |
46 |
|
|
47 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
48 |
0 |
OOMWarning(final String action, final OutOfMemoryError oomex,... |
49 |
|
final Component instance) |
50 |
|
{ |
51 |
0 |
if (!oomInprogress) |
52 |
|
{ |
53 |
0 |
oomInprogress = true; |
54 |
0 |
this.action = action; |
55 |
0 |
desktop = instance; |
56 |
0 |
if (oomex != null) |
57 |
|
{ |
58 |
0 |
Console.error("Out of Memory when " + action, oomex); |
59 |
|
} |
60 |
0 |
javax.swing.SwingUtilities.invokeLater(this); |
61 |
0 |
System.gc(); |
62 |
|
} |
63 |
|
} |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
0 |
public OOMWarning(String string, OutOfMemoryError oomerror)... |
66 |
|
{ |
67 |
0 |
this(string, oomerror, Desktop.desktop); |
68 |
|
} |
69 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
70 |
0 |
@Override... |
71 |
|
public void run() |
72 |
|
{ |
73 |
0 |
oomInprogress = false; |
74 |
0 |
JvOptionPane.showInternalMessageDialog(desktop, MessageManager |
75 |
|
.formatMessage("warn.out_of_memory_when_action", new String[] |
76 |
|
{ action }), MessageManager.getString("label.out_of_memory"), |
77 |
|
JvOptionPane.WARNING_MESSAGE); |
78 |
|
|
79 |
|
} |
80 |
|
|
81 |
|
} |