From c4e10b3344c6a53848a8dc4e93d199bf1daa3c37 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Tue, 9 Oct 2012 10:18:36 -0500 Subject: [PATCH] Issue #189 updates to grid from code review comments Former-commit-id: ef670b81b8dc24900d5eda4e33042254cc14f382 [formerly 8a5aa9adc9bc111688b2d7939ac815a92cf1615a] [formerly 52f7d6d6fa7df28c6463d7069172774abab08f4e] [formerly aa08ec7929261691c5f481a4889fb671ae619fc2 [formerly 52f7d6d6fa7df28c6463d7069172774abab08f4e [formerly 25d6e51d9e748a6e05c93fdff0b641731360bfee]]] Former-commit-id: aa08ec7929261691c5f481a4889fb671ae619fc2 Former-commit-id: 8ad44130265d773960cbbc1c53349d188509b617 [formerly 8ae8e40f256a7e3945e58bc7a037f2f0b17c80e1] Former-commit-id: d6b85c32b59da070d5c44456bf4a2b2a819de5e5 --- .../common/dataplugin/grid/GridPathProvider.java | 15 +++++++++------ .../uf/common/dataplugin/grid/GridRecord.java | 3 +-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridPathProvider.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridPathProvider.java index 52ade9b034..29b1f41ce8 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridPathProvider.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridPathProvider.java @@ -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 forecastHourFormat = new ThreadLocal() { + + @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"); diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java index a1db9909dc..df57ea4455 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java @@ -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