Issue #1515: Better handle notifications received after disposing VCParms.
Change-Id: Ia73102329755303b504871ed55f2a294ef390126 Former-commit-id:5dc773e1d8
[formerly02f2539433
] [formerly5b4de19ebd
] [formerly5dc773e1d8
[formerly02f2539433
] [formerly5b4de19ebd
] [formerlyddcc84262a
[formerly5b4de19ebd
[formerly ef9d97a4d0886df2072672b1cebc9b77e689308b]]]] Former-commit-id:ddcc84262a
Former-commit-id:965feb571b
[formerlya6883700ee
] [formerly 54fad731f6b5bba1bf4ee023995c413a2ff321cd [formerly874434cea9
]] Former-commit-id: c095954524570669ac71b504ae45b8a20e9ad4b5 [formerlydcf5c41129
] Former-commit-id:189e346a20
This commit is contained in:
parent
15b536399e
commit
fa3bd96c11
1 changed files with 52 additions and 3 deletions
|
@ -26,6 +26,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
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.db.objects.ParmID;
|
||||
|
@ -76,6 +77,9 @@ import com.raytheon.viz.gfe.core.parm.vcparm.VCModule.VCInventory;
|
|||
* separate thread to prevent backup
|
||||
* in ParmListener's notification job
|
||||
* pool.
|
||||
* Feb 13, 2013 #1515 dgilling Handle RejectedExecutionExceptions
|
||||
* if notification is received after
|
||||
* Parm disposal.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -156,6 +160,12 @@ public class VCParm extends VParm implements IParmListChangedListener,
|
|||
*/
|
||||
@Override
|
||||
public void gridDataChanged(final ParmID parmId, final TimeRange validTime) {
|
||||
synchronized (this) {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Runnable onNotificationTask = new Runnable() {
|
||||
|
||||
@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
|
||||
public void parmListChanged(final Parm[] parms, Parm[] deletions,
|
||||
Parm[] additions) {
|
||||
synchronized (this) {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Runnable onNotificationTask = new Runnable() {
|
||||
|
||||
@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
|
||||
public void parmInventoryChanged(Parm parm, TimeRange timeRange) {
|
||||
synchronized (this) {
|
||||
if (disposed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// It would be better to only update those griddata objects
|
||||
// that needed it. But... that is much more difficult
|
||||
// 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