Issue #189 updates to grid from code review comments

Former-commit-id: 52f7d6d6fa [formerly 52f7d6d6fa [formerly 25d6e51d9e748a6e05c93fdff0b641731360bfee]]
Former-commit-id: aa08ec7929
Former-commit-id: 8ae8e40f25
This commit is contained in:
Ben Steffensmeier 2012-10-09 10:18:36 -05:00
parent b3a945b203
commit 9ba9377361
2 changed files with 10 additions and 8 deletions

View file

@ -46,8 +46,14 @@ import com.raytheon.uf.common.dataplugin.persist.IPersistable;
*/
public class GridPathProvider extends DefaultPathProvider {
private static final DecimalFormat forecastHourFormat = new DecimalFormat(
"000");
private static final ThreadLocal<DecimalFormat> forecastHourFormat = new ThreadLocal<DecimalFormat>() {
@Override
protected DecimalFormat initialValue() {
return new DecimalFormat("000");
}
};
private static final int SECONDS_PER_HOUR = 3600;
@ -107,10 +113,7 @@ public class GridPathProvider extends DefaultPathProvider {
sb.append("000");
} else {
long number = pdo.getDataTime().getFcstTime() / SECONDS_PER_HOUR;
String numberString = null;
synchronized (forecastHourFormat) {
numberString = forecastHourFormat.format(number);
}
String numberString = forecastHourFormat.get().format(number);
sb.append(numberString);
}
sb.append(".h5");

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.common.dataplugin.grid;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
@ -70,7 +69,7 @@ public class GridRecord extends PersistablePluginDataObject implements
private static final long serialVersionUID = 1L;
@ManyToOne(cascade = { CascadeType.REFRESH })
@ManyToOne
@PrimaryKeyJoinColumn
@DataURI(position = 1, embedded = true)
@DynamicSerializeElement