Issue #1190: Replace all calls to WsId.getNetworkId().getHostName() with calls to WsId.getHostName()

which uses new host name cache.

Change-Id: I7e6cab90d449732df807fb273b117da63de0a611

Former-commit-id: bd8cd6a08b1a2db61d75cc822ec3541279416e0d
This commit is contained in:
David Gillingham 2012-09-20 10:52:00 -05:00
parent 3ada98ba44
commit 8f532d2900
3 changed files with 23 additions and 14 deletions

View file

@ -43,9 +43,7 @@ import com.raytheon.uf.common.dataplugin.gfe.server.lock.LockTable;
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.viz.gfe.Activator;
import com.raytheon.viz.gfe.GFEServerException;
import com.raytheon.viz.gfe.constants.StatusConstants;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.UIFormat;
import com.raytheon.viz.gfe.core.UIFormat.FilterType;
@ -55,11 +53,14 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* The break lock dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 20, 2008 Eric Babin Initial Creation
* 30Jun2008 ebabin Updates for status of break lock.
* Feb 20, 2008 ebabin Initial Creation
* Jun 30, 2008 ebabin Updates for status of break lock.
* Sep 20, 2012 #1190 dgilling Use new WsId.getHostName() method.
*
* </pre>
*
@ -68,7 +69,8 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
*/
public class BreakLockDialog extends CaveJFACEDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(BreakLockDialog.class);
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(BreakLockDialog.class);
private static final int BOX_LIMIT = 12;
@ -124,10 +126,10 @@ public class BreakLockDialog extends CaveJFACEDialog {
try {
clients = dataManager.getClient().getClients();
} catch (GFEServerException e) {
statusHandler.handle(
Priority.PROBLEM,
"Unable to retrieve client info. All locks will appear as orphans",
e);
statusHandler
.handle(Priority.PROBLEM,
"Unable to retrieve client info. All locks will appear as orphans",
e);
clients = new ArrayList<String>();
}
@ -224,8 +226,7 @@ public class BreakLockDialog extends CaveJFACEDialog {
"GMT", "z")).append("] owned by: ");
buf.append(lock.getWsId().getUserName()).append(" (")
.append(lock.getWsId().getProgName()).append(")")
.append(" on: ")
.append(lock.getWsId().getNetworkId().getHostName());
.append(" on: ").append(lock.getWsId().getHostName());
return buf.toString();
}

View file

@ -63,11 +63,14 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dialog to display information about the given grid
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 25, 2008 Eric Babin Initial Creation
* 6/20/2008 #875 bphillip Implemented Dialog functionality
* Mar 25, 2008 ebabin Initial creation
* Jun 20, 2008 #875 bphillip Implemented Dialog functionality
* Sep 20, 2012 #1190 dgilling Use new WsId.getHostName() method.
*
* </pre>
*
@ -647,7 +650,7 @@ public class GridInfoDialog extends CaveJFACEDialog implements
// pos = string.rfind(progName, '/')
// if pos != -1:
// progName = progName[pos+1:len(progName)]
String hostname = wsId.getNetworkId().getHostName();
String hostname = wsId.getHostName();
String label = wsId.getUserName() + " (" + progName + ")" + " on: "
+ hostname;

View file

@ -45,6 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdap
* Apr 25, 2012 545 randerso Repurposed the lockKey field as threadId
* Sep 19, 2012 #1190 dgilling Cache host names so toPrettyString() doesn't
* get delayed behind DNS requests.
* Sep 20, 2012 #1190 dgilling Create method getHostName().
*
* </pre>
*
@ -245,6 +246,10 @@ public class WsId implements Serializable, ISerializableObject {
return networkId;
}
public String getHostName() {
return retrieveFromHostCache(networkId);
}
/**
* @return the _userName
*/