Issue #2843 Harden recycle.
Former-commit-id: 364b818dbd055b13fd8d5bb9f40c16f730f30b53
This commit is contained in:
parent
f87a913017
commit
26c1a8e494
4 changed files with 57 additions and 12 deletions
|
@ -63,9 +63,11 @@ import com.raytheon.viz.ui.input.InputAdapter;
|
|||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Apr 19, 2012 mschenke Initial creation
|
||||
* Feb 19, 2014 2751 bclement added check for closed session
|
||||
* Mar 05, 2014 2843 bsteffen Prevent exceptions on dispose.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -250,7 +252,22 @@ public class CollaborationDispatcher extends Dispatcher {
|
|||
});
|
||||
// Need to immediately send eventObject
|
||||
if (immediateSend) {
|
||||
try {
|
||||
send(eventObject);
|
||||
} catch (RuntimeException e) {
|
||||
/*
|
||||
* Dispose events should never throw exceptions. Since
|
||||
* disposed objects are not used after dispose the exception
|
||||
* is not useful and it often corrupts the display
|
||||
* permanently so it is better to log it and ignore it.
|
||||
*/
|
||||
if (eventObject instanceof DisposeObjectEvent) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (eventObject instanceof IRenderEvent) {
|
||||
if (eventObject instanceof BeginFrameEvent && currentFrame == null) {
|
||||
|
|
|
@ -53,6 +53,8 @@ import com.raytheon.uf.viz.core.rsc.ResourceProperties;
|
|||
* Mar 22, 2013 mschenke Initial creation
|
||||
* Oct 10, 2013 2104 mschenke Switched to use MapScalesManager
|
||||
* Nov 20, 2013 2492 bsteffen Recycle resources in clear.
|
||||
* Mar 05, 2014 2843 bsteffen Catch recycle errors in clear.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -140,8 +142,16 @@ public class MapScaleRenderableDisplay extends PlainMapRenderableDisplay
|
|||
&& props.isSystemResource() == false) {
|
||||
list.remove(rp);
|
||||
} else {
|
||||
try {
|
||||
props.setVisible(true);
|
||||
rp.getResource().recycle();
|
||||
} catch (Throwable e) {
|
||||
props.setVisible(false);
|
||||
statusHandler.handle(Priority.PROBLEM, "Clear error: "
|
||||
+ e.getMessage() + ":: The resource ["
|
||||
+ rp.getResource().getSafeName()
|
||||
+ "] has been disabled.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,9 @@ import com.raytheon.uf.viz.core.rsc.capabilities.Capabilities;
|
|||
* Jun 24, 2013 2140 randerso Added getSafeName method
|
||||
* Nov 18, 2013 2544 bsteffen Add recycleInternal so IResourceGroups
|
||||
* can recycle better.
|
||||
* Mar 05, 2014 2843 bsteffen Set status to disposed during recycle and
|
||||
* when recycle fails.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -756,6 +759,7 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
|
|||
*/
|
||||
public final void recycle() {
|
||||
if (status == ResourceStatus.INITIALIZED) {
|
||||
status = ResourceStatus.DISPOSED;
|
||||
recycleInternal();
|
||||
}
|
||||
status = ResourceStatus.NEW;
|
||||
|
|
|
@ -24,6 +24,8 @@ import org.eclipse.swt.widgets.Canvas;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.opengis.coverage.grid.GridEnvelope;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.AbstractGraphicsFactoryAdapter;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
|
@ -46,8 +48,9 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 5, 2012 mschenke Initial creation
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Mar 05, 2012 mschenke Initial creation
|
||||
* Mar 05, 2014 2843 bsteffen Catch recycle errors.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,6 +60,9 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
|
||||
public class DispatchingGraphicsFactory extends AbstractGraphicsFactoryAdapter {
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(DispatchingGraphicsFactory.class);
|
||||
|
||||
private AbstractGraphicsFactoryAdapter delegate;
|
||||
|
||||
private Dispatcher dispatcher;
|
||||
|
@ -211,7 +217,15 @@ public class DispatchingGraphicsFactory extends AbstractGraphicsFactoryAdapter {
|
|||
|
||||
for (ResourcePair rp : descriptor.getResourceList()) {
|
||||
if (rp.getResource() != null) {
|
||||
try {
|
||||
rp.getResource().recycle();
|
||||
} catch (Throwable e) {
|
||||
rp.getProperties().setVisible(false);
|
||||
statusHandler.handle(Priority.PROBLEM, "Refresh error: "
|
||||
+ e.getMessage() + ":: The resource ["
|
||||
+ rp.getResource().getSafeName()
|
||||
+ "] has been disabled.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,7 +233,7 @@ public class DispatchingGraphicsFactory extends AbstractGraphicsFactoryAdapter {
|
|||
try {
|
||||
descriptor.getTimeMatcher().redoTimeMatching(descriptor);
|
||||
} catch (VizException e) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error redoing time matching", e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue