Merge "Issue #1515: Better handle notifications received after disposing VCParms." into development
Former-commit-id:11212b51db
[formerlye04322f7ad
] [formerly11212b51db
[formerlye04322f7ad
] [formerly96fee6ea56
[formerly 1f5fbc207e533be5a7dde9651dd35743a0fc3a34]]] Former-commit-id:96fee6ea56
Former-commit-id:377e85913f
[formerlyb5ff9b6998
] Former-commit-id:0fd4810cfa
This commit is contained in:
commit
7203cc6531
1 changed files with 52 additions and 3 deletions
|
@ -26,6 +26,7 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
|
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
|
||||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
|
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
|
||||||
|
@ -76,6 +77,9 @@ import com.raytheon.viz.gfe.core.parm.vcparm.VCModule.VCInventory;
|
||||||
* separate thread to prevent backup
|
* separate thread to prevent backup
|
||||||
* in ParmListener's notification job
|
* in ParmListener's notification job
|
||||||
* pool.
|
* pool.
|
||||||
|
* Feb 13, 2013 #1515 dgilling Handle RejectedExecutionExceptions
|
||||||
|
* if notification is received after
|
||||||
|
* Parm disposal.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -156,6 +160,12 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void gridDataChanged(final ParmID parmId, final TimeRange validTime) {
|
public void gridDataChanged(final ParmID parmId, final TimeRange validTime) {
|
||||||
|
synchronized (this) {
|
||||||
|
if (disposed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Runnable onNotificationTask = new Runnable() {
|
Runnable onNotificationTask = new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -200,7 +210,16 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
notificationWorkers.submit(onNotificationTask);
|
try {
|
||||||
|
notificationWorkers.submit(onNotificationTask);
|
||||||
|
} catch (RejectedExecutionException e) {
|
||||||
|
// received a notification after thread pool shutdown
|
||||||
|
// do nothing, but log
|
||||||
|
String message = "Parm "
|
||||||
|
+ toString()
|
||||||
|
+ " received GridDataChange notification after VCParm.dispose().";
|
||||||
|
statusHandler.handle(Priority.EVENTB, message, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -215,6 +234,12 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
||||||
@Override
|
@Override
|
||||||
public void parmListChanged(final Parm[] parms, Parm[] deletions,
|
public void parmListChanged(final Parm[] parms, Parm[] deletions,
|
||||||
Parm[] additions) {
|
Parm[] additions) {
|
||||||
|
synchronized (this) {
|
||||||
|
if (disposed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Runnable onNotificationTask = new Runnable() {
|
Runnable onNotificationTask = new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -239,7 +264,16 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
notificationWorkers.submit(onNotificationTask);
|
try {
|
||||||
|
notificationWorkers.submit(onNotificationTask);
|
||||||
|
} catch (RejectedExecutionException e) {
|
||||||
|
// received a notification after thread pool shutdown
|
||||||
|
// do nothing, but log
|
||||||
|
String message = "Parm "
|
||||||
|
+ toString()
|
||||||
|
+ " received ParmListChange notification after VCParm.dispose().";
|
||||||
|
statusHandler.handle(Priority.EVENTB, message, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -251,6 +285,12 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void parmInventoryChanged(Parm parm, TimeRange timeRange) {
|
public void parmInventoryChanged(Parm parm, TimeRange timeRange) {
|
||||||
|
synchronized (this) {
|
||||||
|
if (disposed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// It would be better to only update those griddata objects
|
// It would be better to only update those griddata objects
|
||||||
// that needed it. But... that is much more difficult
|
// that needed it. But... that is much more difficult
|
||||||
// than this simple brute force method. This seems to be
|
// than this simple brute force method. This seems to be
|
||||||
|
@ -275,7 +315,16 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
notificationWorkers.submit(onNotificationTask);
|
try {
|
||||||
|
notificationWorkers.submit(onNotificationTask);
|
||||||
|
} catch (RejectedExecutionException e) {
|
||||||
|
// received a notification after thread pool shutdown
|
||||||
|
// do nothing, but log
|
||||||
|
String message = "Parm "
|
||||||
|
+ toString()
|
||||||
|
+ " received ParmInventoryChange notification after VCParm.dispose().";
|
||||||
|
statusHandler.handle(Priority.EVENTB, message, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue