|
From: <rm...@hy...> - 2007-03-25 18:38:28
|
Author: rmorgan Date: 2007-03-25 10:38:25 -0800 (Sun, 25 Mar 2007) New Revision: 3894 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3894 Modified: trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell_livedata_get.java trunk/src/org/hyperic/hq/livedata/agent/client/LiveDataClient.java trunk/src/org/hyperic/hq/livedata/server/session/LiveDataExecutor.java trunk/src/org/hyperic/hq/livedata/server/session/LiveDataExecutorCommand.java trunk/src/org/hyperic/hq/livedata/server/session/LiveDataManagerEJBImpl.java trunk/src/org/hyperic/hq/livedata/shared/LiveDataResult.java Log: Add AppdefEntityID to LiveDataResult, bump min thread pool size to 5. Modified: trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell_livedata_get.java =================================================================== --- trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell_livedata_get.java 2007-03-25 17:45:05 UTC (rev 3893) +++ trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShell_livedata_get.java 2007-03-25 18:38:25 UTC (rev 3894) @@ -101,17 +101,21 @@ _entityFetcher.getGroupValue(id.getId().toString()); List entities = val.getAppdefGroupEntries(); + PrintStream ps = this.getShell().getOutStream(); + ps.print("Entities:"); LiveDataCommand[] cmds = new LiveDataCommand[entities.size()]; for (int i = 0; i < entities.size(); i++) { AppdefEntityID aid = (AppdefEntityID)entities.get(i); cmds[i] = new LiveDataCommand(aid, command, new ConfigResponse()); + ps.print(" " + aid); } + ps.println(); LiveDataResult[] res = _entityFetcher.getLiveData(cmds); - PrintStream ps = this.getShell().getOutStream(); ps.println("Printing XML output from command " + command); for (int i = 0; i < entities.size(); i++) { - ps.println("Result value " + i); + ps.println("Result value " + i + " for resource " + + res[i].getAppdefEntityID()); if (res[i].hasError()) { ps.println("Error: " + res[i].getErrorMessage()); } else { Modified: trunk/src/org/hyperic/hq/livedata/agent/client/LiveDataClient.java =================================================================== --- trunk/src/org/hyperic/hq/livedata/agent/client/LiveDataClient.java 2007-03-25 17:45:05 UTC (rev 3893) +++ trunk/src/org/hyperic/hq/livedata/agent/client/LiveDataClient.java 2007-03-25 18:38:25 UTC (rev 3894) @@ -31,6 +31,7 @@ import org.hyperic.hq.livedata.shared.LiveDataResult; import org.hyperic.hq.agent.client.AgentConnection; import org.hyperic.hq.agent.AgentRemoteValue; +import org.hyperic.hq.appdef.shared.AppdefEntityID; import org.hyperic.util.config.ConfigResponse; public class LiveDataClient { @@ -43,7 +44,8 @@ _api = new LiveDataCommandsAPI(); } - public LiveDataResult getData(String type, String command, + public LiveDataResult getData(AppdefEntityID id, String type, + String command, ConfigResponse config) { try { @@ -56,9 +58,9 @@ _api.getVersion(), args); LiveData_result val = new LiveData_result(res); String xml = val.getResult(); - return new LiveDataResult(xml); + return new LiveDataResult(id, xml); } catch (Exception e) { - return new LiveDataResult(e, e.getMessage()); + return new LiveDataResult(id, e, e.getMessage()); } } } Modified: trunk/src/org/hyperic/hq/livedata/server/session/LiveDataExecutor.java =================================================================== --- trunk/src/org/hyperic/hq/livedata/server/session/LiveDataExecutor.java 2007-03-25 17:45:05 UTC (rev 3893) +++ trunk/src/org/hyperic/hq/livedata/server/session/LiveDataExecutor.java 2007-03-25 18:38:25 UTC (rev 3894) @@ -41,13 +41,13 @@ private static Log _log = LogFactory.getLog(LiveDataExecutor.class); - private static final int THREAD_MIN = 1; + private static final int THREAD_MIN = 5; private static final int THREAD_MAX = 30; private List _results; public LiveDataExecutor() { - super(THREAD_MIN, THREAD_MAX, 1, TimeUnit.HOURS, + super(THREAD_MIN, THREAD_MAX, 1, TimeUnit.MINUTES, new LinkedBlockingQueue()); _results = new ArrayList(); } @@ -83,7 +83,8 @@ LiveDataExecutorCommand cmd = (LiveDataExecutorCommand)i.next(); _log.debug("Running cmd '" + cmd + "' in thread " + Thread.currentThread().getName()); - LiveDataResult res = _client.getData(cmd.getType(), + LiveDataResult res = _client.getData(cmd.getAppdefEntityID(), + cmd.getType(), cmd.getCommand(), cmd.getConfig()); _results.add(res); Modified: trunk/src/org/hyperic/hq/livedata/server/session/LiveDataExecutorCommand.java =================================================================== --- trunk/src/org/hyperic/hq/livedata/server/session/LiveDataExecutorCommand.java 2007-03-25 17:45:05 UTC (rev 3893) +++ trunk/src/org/hyperic/hq/livedata/server/session/LiveDataExecutorCommand.java 2007-03-25 18:38:25 UTC (rev 3894) @@ -26,19 +26,26 @@ package org.hyperic.hq.livedata.server.session; import org.hyperic.util.config.ConfigResponse; +import org.hyperic.hq.appdef.shared.AppdefEntityID; class LiveDataExecutorCommand { + private AppdefEntityID _id; private String _type; private String _command; private ConfigResponse _config; - public LiveDataExecutorCommand(String type, String command, - ConfigResponse config) { + public LiveDataExecutorCommand(AppdefEntityID id, String type, String command, + ConfigResponse config) { + _id = id; _type = type; _command = command; _config = config; } + public AppdefEntityID getAppdefEntityID() { + return _id; + } + public String getType() { return _type; } Modified: trunk/src/org/hyperic/hq/livedata/server/session/LiveDataManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/livedata/server/session/LiveDataManagerEJBImpl.java 2007-03-25 17:45:05 UTC (rev 3893) +++ trunk/src/org/hyperic/hq/livedata/server/session/LiveDataManagerEJBImpl.java 2007-03-25 18:38:25 UTC (rev 3894) @@ -158,7 +158,7 @@ ConfigResponse config = getConfig(subject, cmd); String type = getType(subject, cmd); - return client.getData(type, cmd.getCommand(), config); + return client.getData(id, type, cmd.getCommand(), config); } /** @@ -182,7 +182,7 @@ String type = getType(subject, cmd); LiveDataExecutorCommand exec = - new LiveDataExecutorCommand(type, cmd.getCommand(), config); + new LiveDataExecutorCommand(id, type, cmd.getCommand(), config); List queue = (List)buckets.get(conn); if (queue == null) { Modified: trunk/src/org/hyperic/hq/livedata/shared/LiveDataResult.java =================================================================== --- trunk/src/org/hyperic/hq/livedata/shared/LiveDataResult.java 2007-03-25 17:45:05 UTC (rev 3893) +++ trunk/src/org/hyperic/hq/livedata/shared/LiveDataResult.java 2007-03-25 18:38:25 UTC (rev 3894) @@ -4,28 +4,40 @@ import java.io.Serializable; +import org.hyperic.hq.appdef.shared.AppdefEntityID; + /** * Result object from live data commands. */ public class LiveDataResult implements Serializable { + private AppdefEntityID _id; private boolean _error; private Throwable _cause; private String _errorMsg; private String _xml; - public LiveDataResult(String xml) { + public LiveDataResult(AppdefEntityID id, String xml) { _error = false; + _id = id; _xml = xml; } - public LiveDataResult(Throwable t, String errorMsg) { + public LiveDataResult(AppdefEntityID id, Throwable t, String errorMsg) { _error = true; + _id = id; + _cause = t; _errorMsg = errorMsg; - _cause = t; } /** + * Get the appdef entity id for this result + */ + public AppdefEntityID getAppdefEntityID() { + return _id; + } + + /** * Get the raw XML result for this request. */ public String getXMLResult() { |