+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "BrokerInitializationResult", namespace = "http://hpc.microsoft.com/BrokerLauncher", propOrder = {
+ "brokerEpr",
+ "brokerUniqueId",
+ "clientBrokerHeartbeatInterval",
+ "clientBrokerHeartbeatRetryCount",
+ "controllerEpr",
+ "maxMessageSize",
+ "responseEpr",
+ "serviceOperationTimeout",
+ "supportsMessageDetails"
+})
+public class BrokerInitializationResult {
+
+ @XmlElementRef(name = "BrokerEpr", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false)
+ protected JAXBElement brokerEpr;
+ @XmlElementRef(name = "BrokerUniqueId", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false)
+ protected JAXBElement brokerUniqueId;
+ @XmlElement(name = "ClientBrokerHeartbeatInterval")
+ protected Integer clientBrokerHeartbeatInterval;
+ @XmlElement(name = "ClientBrokerHeartbeatRetryCount")
+ protected Integer clientBrokerHeartbeatRetryCount;
+ @XmlElementRef(name = "ControllerEpr", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false)
+ protected JAXBElement controllerEpr;
+ @XmlElement(name = "MaxMessageSize")
+ protected Long maxMessageSize;
+ @XmlElementRef(name = "ResponseEpr", namespace = "http://hpc.microsoft.com/BrokerLauncher", type = JAXBElement.class, required = false)
+ protected JAXBElement responseEpr;
+ @XmlElement(name = "ServiceOperationTimeout")
+ protected Integer serviceOperationTimeout;
+ @XmlElement(name = "SupportsMessageDetails")
+ protected boolean supportsMessageDetails;
+
+ /**
+ * Gets the value of the brokerEpr property.
+ *
+ * @return
+ * possible object is
+ * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}
+ *
+ */
+ public JAXBElement getBrokerEpr() {
+ return brokerEpr;
+ }
+
+ /**
+ * Sets the value of the brokerEpr property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}
+ *
+ */
+ public void setBrokerEpr(JAXBElement value) {
+ this.brokerEpr = ((JAXBElement ) value);
+ }
+
+ /**
+ * Gets the value of the brokerUniqueId property.
+ *
+ * @return
+ * possible object is
+ * {@link JAXBElement }{@code <}{@link String }{@code >}
+ *
+ */
+ public JAXBElement getBrokerUniqueId() {
+ return brokerUniqueId;
+ }
+
+ /**
+ * Sets the value of the brokerUniqueId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JAXBElement }{@code <}{@link String }{@code >}
+ *
+ */
+ public void setBrokerUniqueId(JAXBElement value) {
+ this.brokerUniqueId = ((JAXBElement ) value);
+ }
+
+ /**
+ * Gets the value of the clientBrokerHeartbeatInterval property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getClientBrokerHeartbeatInterval() {
+ return clientBrokerHeartbeatInterval;
+ }
+
+ /**
+ * Sets the value of the clientBrokerHeartbeatInterval property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setClientBrokerHeartbeatInterval(Integer value) {
+ this.clientBrokerHeartbeatInterval = value;
+ }
+
+ /**
+ * Gets the value of the clientBrokerHeartbeatRetryCount property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getClientBrokerHeartbeatRetryCount() {
+ return clientBrokerHeartbeatRetryCount;
+ }
+
+ /**
+ * Sets the value of the clientBrokerHeartbeatRetryCount property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setClientBrokerHeartbeatRetryCount(Integer value) {
+ this.clientBrokerHeartbeatRetryCount = value;
+ }
+
+ /**
+ * Gets the value of the controllerEpr property.
+ *
+ * @return
+ * possible object is
+ * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}
+ *
+ */
+ public JAXBElement getControllerEpr() {
+ return controllerEpr;
+ }
+
+ /**
+ * Sets the value of the controllerEpr property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}
+ *
+ */
+ public void setControllerEpr(JAXBElement value) {
+ this.controllerEpr = ((JAXBElement ) value);
+ }
+
+ /**
+ * Gets the value of the maxMessageSize property.
+ *
+ * @return
+ * possible object is
+ * {@link Long }
+ *
+ */
+ public Long getMaxMessageSize() {
+ return maxMessageSize;
+ }
+
+ /**
+ * Sets the value of the maxMessageSize property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Long }
+ *
+ */
+ public void setMaxMessageSize(Long value) {
+ this.maxMessageSize = value;
+ }
+
+ /**
+ * Gets the value of the responseEpr property.
+ *
+ * @return
+ * possible object is
+ * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}
+ *
+ */
+ public JAXBElement getResponseEpr() {
+ return responseEpr;
+ }
+
+ /**
+ * Sets the value of the responseEpr property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}
+ *
+ */
+ public void setResponseEpr(JAXBElement value) {
+ this.responseEpr = ((JAXBElement ) value);
+ }
+
+ /**
+ * Gets the value of the serviceOperationTimeout property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getServiceOperationTimeout() {
+ return serviceOperationTimeout;
+ }
+
+ /**
+ * Sets the value of the serviceOperationTimeout property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setServiceOperationTimeout(Integer value) {
+ this.serviceOperationTimeout = value;
+ }
+
+ /**
+ * Gets the value of the supportsMessageDetails property.
+ * @return
+ * possible object is
+ * {@link boolean}
+ */
+ public boolean getSupportsMessageDetails() {
+ return this.supportsMessageDetails;
+ }
+
+ /**
+ * Sets the value of the supportsMessageDetails property.
+ *
+ * @param value
+ * allowed object is
+ * {@link boolean}
+ */
+ public void setsupportsMessageDetails(boolean value) {
+ this.supportsMessageDetails = value;
+ }
+
+}
diff --git a/src/com/microsoft/hpc/brokerlauncher/ObjectFactory.java b/src/com/microsoft/hpc/brokerlauncher/ObjectFactory.java
index fe4294b..7a3201d 100644
--- a/src/com/microsoft/hpc/brokerlauncher/ObjectFactory.java
+++ b/src/com/microsoft/hpc/brokerlauncher/ObjectFactory.java
@@ -31,6 +31,7 @@ public class ObjectFactory {
private final static QName _AttachResponseAttachResult_QNAME = new QName("http://hpc.microsoft.com/brokerlauncher/", "AttachResult");
private final static QName _BrokerInitializationResultBrokerEpr_QNAME = new QName("http://hpc.microsoft.com/BrokerLauncher", "BrokerEpr");
private final static QName _BrokerInitializationResultControllerEpr_QNAME = new QName("http://hpc.microsoft.com/BrokerLauncher", "ControllerEpr");
+ private final static QName _BrokerInitializationResultBrokerUniqueId_QNAME = new QName("http://hpc.microsoft.com/BrokerLauncher", "BrokerUniqueId");
private final static QName _BrokerInitializationResultResponseEpr_QNAME = new QName("http://hpc.microsoft.com/BrokerLauncher", "ResponseEpr");
private final static QName _CreateDurableResponseCreateDurableResult_QNAME = new QName("http://hpc.microsoft.com/brokerlauncher/", "CreateDurableResult");
private final static QName _GetActiveBrokerIdListResponseGetActiveBrokerIdListResult_QNAME = new QName("http://hpc.microsoft.com/brokerlauncher/", "GetActiveBrokerIdListResult");
@@ -192,6 +193,16 @@ public JAXBElement createBrokerInitializationResultControllerEpr(
public JAXBElement createBrokerInitializationResultResponseEpr(ArrayOfstring value) {
return new JAXBElement(_BrokerInitializationResultResponseEpr_QNAME, ArrayOfstring.class, BrokerInitializationResult.class, value);
}
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://hpc.microsoft.com/BrokerLauncher", name = "BrokerUniqueId", scope = BrokerInitializationResult.class)
+ public JAXBElement createBrokerInitializationResultBrokerUniqueId(String value) {
+ return new JAXBElement(_BrokerInitializationResultBrokerUniqueId_QNAME, String.class, BrokerInitializationResult.class, value);
+ }
+
/**
* Create an instance of {@link JAXBElement }{@code <}{@link BrokerInitializationResult }{@code >}}
diff --git a/src/com/microsoft/hpc/properties/ErrorCode.java b/src/com/microsoft/hpc/properties/ErrorCode.java
index 2693c6d..6f8890d 100644
--- a/src/com/microsoft/hpc/properties/ErrorCode.java
+++ b/src/com/microsoft/hpc/properties/ErrorCode.java
@@ -1,984 +1,994 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Global Error Code
-//
-// ------------------------------------------------------------------------------
-
-package com.microsoft.hpc.properties;
-
-// Summary:
-// Defines the possible HPC-defined error codes that HPC can set.
-public final class ErrorCode
-{
-
- // Summary:
- // Separator used to separate the insertion strings for the error message
- // text.
- // See Microsoft.Hpc.Scheduler.Properties.SchedulerException.Params.
- public static String ArgumentSeparator = "|||";
- public static int AuthFailureDisableCredentialReuse = 1;
- //
- // Summary:
- // The child job has finished running.
- public static int Execution_ChildJobFinished = -2147218986;
- public static int Execution_FailedByActivationFilter = -2147218966;
- public static int Execution_FailedToOpenStandardError = -2147218973;
- public static int Execution_FailedToOpenStandardInput = -2147218975;
- public static int Execution_FailedToOpenStandardOutput = -2147218974;
- //
- // Summary:
- // The user canceled the job while it was running.
- public static int Execution_JobCanceled = -2147218982;
- //
- // Summary:
- // The job was preempted by a higher priority job. For details, see the
- // Microsoft.Hpc.Scheduler.ISchedulerJob.CanPreempt
- // and the PreemptionType cluster parameter in the Remarks section of
- // Microsoft.Hpc.Scheduler.IScheduler.SetClusterParameter(System.String,System.String).
- public static int Execution_JobPreempted = -2147218978;
- //
- // Summary:
- // The job exceeded its run-time limit. See
- // Microsoft.Hpc.Scheduler.ISchedulerJob.Runtime
- // and Microsoft.Hpc.Scheduler.ISchedulerTask.Runtime.
- public static int Execution_JobRuntimeExpired = -2147218987;
- //
- // Summary:
- // An error occurred on the node.
- public static int Execution_NodeError = -2147218990;
- public static int Execution_NodePrepTaskFailure = -2147218968;
- //
- // Summary:
- // The job or task was scheduled to run on a node that is no longer
- // reachable.
- public static int Execution_NodeUnreachable = -2147218984;
- //
- // Summary:
- // The parent job of this child job has been canceled.
- public static int Execution_ParentJobCanceled = -2147218988;
- //
- // Summary:
- // The process has exited.
- public static int Execution_ProcessDead = -2147218983;
- //
- // Summary:
- // The job failed to start on one or more nodes or the nodes were not
- // reachable.
- public static int Execution_ResourceFailure = -2147218981;
- //
- // Summary:
- // The job failed to start on node {0}.
- public static int Execution_StartJobFailedOnNode = -2147218977;
- public static int Execution_TaskCanceledBeforeAssignment = -2147218971;
- public static int Execution_TaskCanceledDuringExecution = -2147218969;
- public static int Execution_TaskCanceledOnJobRequeue = -2147218970;
- //
- // Summary:
- // The scheduler was not able to execute the command specified in the task.
- public static int Execution_TaskExecutionFailure = -2147218979;
- //
- // Summary:
- // The task failed.
- public static int Execution_TaskFailure = -2147218980;
- public static int Execution_TaskNodeNotUsable = -2147218967;
- //
- // Summary:
- // The task exceeded its run-time limit. See
- // Microsoft.Hpc.Scheduler.ISchedulerTask.Runtime.
- public static int Execution_TaskRuntimeExpired = -2147218985;
- //
- // Summary:
- // The job to which the task belongs was canceled.
- public static int Execution_TasksJobCanceled = -2147218989;
- //
- // Summary:
- // The task was canceled while it was running because a job with higher
- // priority
- // preempted the task. If the task can be rerun, the HPC Job Scheduler
- // service
- // will attempt to automatically queue it again.
- public static int Execution_TasksPreempted = -2147218976;
- //
- // Summary:
- // An unknown error occurred.
- public static int Execution_UnknownError = -2147218991;
- public static int Execution_WorkingDirectoryNotFound = -2147218972;
- //
- // Summary:
- // The value is outside the allowable range of values.
- public static int Operation_ArgumentOutOfRange = -2147220987;
- //
- // Summary:
- // Authenticate failure.
- public static int Operation_AuthenticationFailure = -2147220980;
- public static int Operation_AzureDeploymentNotFound = -2147220691;
- //
- // Summary:
- // The user canceled the job or task.
- public static int Operation_CanceledByUser = -2147220991;
- public static int Operation_CancelMessageIsTooLong = -2147220781;
- public static int Operation_CannotConnectWithScheduler = -2147220785;
- //
- // Summary:
- // You cannot remove item {0} from the default job template.
- public static int Operation_CannotRemoveProfileItemFromDefaultTemplate = -2147220954;
- //
- // Summary:
- // You cannot change the name of the default job template.
- public static int Operation_CannotResetDefaultProfileName = -2147220948;
- //
- // Summary:
- // You cannot submit child job, instead you must submit the parent job.
- public static int Operation_ChildJobCannotBeSubmittedAlone = -2147220966;
- //
- // Summary:
- // Not able to register with the server.
- public static int Operation_CouldNotRegisterWithServer = -2147220932;
- //
- // Summary:
- // Cryptography error.
- public static int Operation_CryptographyError = -2147220979;
- //
- // Summary:
- // A database exception occurred while processing the request.
- public static int Operation_DatabaseException = -2147220988;
- //
- // Summary:
- // The scheduler was unable to create a new job because the database is
- // full.
- public static int Operation_DatabaseIsFull = -2147220926;
- //
- // Summary:
- // Duplicate application found in the software license item.
- public static int Operation_DuplicateLicenseFeature = -2147220946;
- public static int Operation_EmailCredentialMustBeAdmin = -2147220888;
- //
- // Summary:
- // The environment variable name was too long. The size must be smaller than
- // {0} characters.
- public static int Operation_EnvironmentVarNameTooLong = -2147220929;
- //
- // Summary:
- // The environment variable value was too long. The size must be smaller
- // than
- // {0} characters.
- public static int Operation_EnvironmentVarValueTooLong = -2147220928;
- public static int Operation_ExcludedNodeDoesNotExist = -2147220885;
- public static int Operation_ExcludedNodeListTooLong = -2147220782;
- public static int Operation_ExcludedRequiredNode = -2147220887;
- public static int Operation_ExcludedTooManyNodes = -2147220886;
- public static int Operation_ExpandedPriorityNotValidOnServer = -2147220792;
- public static int Operation_FeatureDeprecated = -2147220896;
- public static int Operation_FeatureUnimplemented = -2147220895;
- public static int Operation_HPCSidUnavailable = -2147220784;
- //
- // Summary:
- // The job template property {0} is not a legal job template property.
- public static int Operation_IllegalProfileProperty = -2147220969;
- public static int Operation_IllegalServiceConcludeAttempt = -2147220779;
- public static int Operation_IllegalStateForServiceConclude = -2147220778;
- public static int Operation_IllegalTaskAddedToServiceJob = -2147220909;
- //
- // Summary:
- // You cannot cancel the job in its current state.
- public static int Operation_InvalidCancelJobState = -2147220984;
- //
- // Summary:
- // You cannot cancel the task in its current state.
- public static int Operation_InvalidCancelTaskState = -2147220983;
- public static int Operation_InvalidEmailAddress = -2147220690;
- //
- // Summary:
- // The provided environment variable name is not valid.
- public static int Operation_InvalidEnvironmentVarName = -2147220931;
- //
- // Summary:
- // The provided environment variable value is not valid.
- public static int Operation_InvalidEnvironmentVarValue = -2147220930;
- //
- // Summary:
- // You cannot filter on property '{0}' for this type of object.
- public static int Operation_InvalidFilterProperty = -2147220925;
- //
- // Summary:
- // The job identifier does not identify an existing job in the scheduler.
- public static int Operation_InvalidJobId = -2147220986;
- public static int Operation_InvalidJobStateForNodeExclusion = -2147220884;
- //
- // Summary:
- // Invalid specification for '{0}'.
- public static int Operation_InvalidJobTemplateItemXml = -2147220927;
- //
- // Summary:
- // The node identifier does not identify and existing node in the cluster.
- public static int Operation_InvalidNodeId = -2147220978;
- //
- // Summary:
- // The requested operation is not valid.
- public static int Operation_InvalidOperation = -2147220977;
- //
- // Summary:
- // The job template identifier is not valid.
- public static int Operation_InvalidProfileId = -2147220933;
- public static int Operation_InvalidPropForTaskType = -2147220908;
- //
- // Summary:
- // The row enumeration identifier is not valid.
- public static int Operation_InvalidRowEnumId = -2147220935;
- //
- // Summary:
- // The task identifier does not identify and existing task in the scheduler.
- public static int Operation_InvalidTaskId = -2147220985;
- //
- // Summary:
- // The job already exists on the server.
- public static int Operation_JobAlreadyCreatedOnServer = -2147220941;
- public static int Operation_JobDeletionForbidden = -2147220912;
- public static int Operation_JobHoldInvalidState = -2147220790;
- public static int Operation_JobHoldUntilTooLong = -2147220783;
- public static int Operation_JobInvalidHoldUntil = -2147220789;
- //
- // Summary:
- // Job modification failed: {0}.
- public static int Operation_JobModifyFailed = -2147220960;
- //
- // Summary:
- // The job was not found on the server.
- public static int Operation_JobNotCreatedOnServer = -2147220942;
- public static int Operation_JobProgressOutOfRange = -2147220917;
- //
- // Summary:
- // Unable to revert the job changes.
- public static int Operation_JobRevertModifyFailed = -2147220959;
- public static int Operation_JobTemplateRequiredValueMissing = -2147220878;
- public static int Operation_JobTemplateValueInvalid = -2147220881;
- public static int Operation_JobTemplateValueTooLarge = -2147220879;
- public static int Operation_JobTemplateValueTooSmall = -2147220880;
- public static int Operation_JobVersionMismatch = -2147220894;
- //
- // Summary:
- // You must specify a job template name.
- public static int Operation_MustProvideProfileName = -2147220934;
- public static int Operation_NodeAlreadyExists = -2147220898;
- public static int Operation_NodeIsNotOnAzure = -2147220692;
- //
- // Summary:
- // The user does not have permission to use the job template.
- public static int Operation_NoPermissionToUseProfile = -2147220967;
- //
- // Summary:
- // No storage is currently defined for the property.
- public static int Operation_NoTableDefinedForProperty = -2147220944;
- //
- // Summary:
- // You do not have permission to change this job template.
- public static int Operation_NotAllowedToChangeProfiles = -2147220970;
- //
- // Summary:
- // The user is not allowed to create job templates.
- public static int Operation_NotAllowedToCreateProfiles = -2147220972;
- //
- // Summary:
- // The default job template cannot be deleted.
- public static int Operation_NotAllowedToDeleteDefaultProfile = -2147220968;
- //
- // Summary:
- // The user is not allowed to delete job templates.
- public static int Operation_NotAllowedToDeleteProfiles = -2147220971;
- //
- // Summary:
- // Cannot perform the operation because you are not connected to the server.
- public static int Operation_NotConnectedToServer = -2147220936;
- public static int Operation_ObjectInUse = -2147220882;
- //
- // Summary:
- // The job must be in the configuration state in order to submit the job.
- public static int Operation_OnlyConfigJobsCanBeSubmitted = -2147220990;
- //
- // Summary:
- // You can submit the task only if the task is in the
- // Microsoft.Hpc.Scheduler.Properties.TaskState.Configuring
- // state.
- public static int Operation_OnlyConfiguringTasksCanBeSubmitted = -2147220940;
- //
- // Summary:
- // You can reconfigure only canceled or failed jobs.
- public static int Operation_OnlyFailedCancelledJobsCanBeConfigured = -2147220982;
- public static int Operation_OnlyFailedCancelledTasksCanBeConfigured = -2147220916;
- //
- // Summary:
- // The user does not have permission to perform the operation.
- public static int Operation_PermissionDenied = -2147220981;
- //
- // Summary:
- // You cannot change HPC-defined environment variables.
- public static int Operation_PreservedEnvironmentVariables = -2147220938;
- public static int Operation_PriorityAndExPriCannotBeSetTogether = -2147220791;
- //
- // Summary:
- // The job template item that you are trying to set already exists.
- public static int Operation_ProfileItemAlreadyExists = -2147220975;
- //
- // Summary:
- // The default value for the job template item is not within the allowed
- // value
- // range for the item.
- public static int Operation_ProfileItemDefaultValueInvalid = -2147220952;
- //
- // Summary:
- // The default values specified for the job template item {0} must include
- // all
- // of the required values for that item. Ensure that the default values
- // include
- // all the values in the Required Values list, and then try again.
- public static int Operation_ProfileItemDefaultValueNotIncludeRequiredValue = -2147220953;
- //
- // Summary:
- // The job template item that you are trying to set does not exist.
- public static int Operation_ProfileItemDoesNotExist = -2147220976;
- //
- // Summary:
- // The minimum staticraint for the job template item is greater than its
- // maximum
- // staticraint.
- public static int Operation_ProfileItemMinGreaterThanMax = -2147220950;
- //
- // Summary:
- // You must provide a default value for the job template item.
- public static int Operation_ProfileItemMustProvideDefaultStringValue = -2147220951;
- //
- // Summary:
- // Invalid template: The template item {0}'s default value, {1}, is larger
- // than
- // the default value of the related template item, {2} (default value: {3}).
- // Correct this inconsistency and try again.
- public static int Operation_ProfileItemRangeInconsistent_LeftDefaultGreaterThanRightDefault = -2147220956;
- //
- // Summary:
- // Invalid template: The template item {0}'s maximum value, {1}, is larger
- // than
- // the maximum value of the related template item, {2} (maximum value: {3}).
- // Correct this inconsistency and try again.
- public static int Operation_ProfileItemRangeInconsistent_LeftMaxGreaterThanRightMax = -2147220957;
- //
- // Summary:
- // Invalid template: The template item {0}'s minimum value, {1}, is larger
- // than
- // the minimum value of the related template item, {2} (minimum value: {3}).
- // Correct this inconsistency and try again.
- public static int Operation_ProfileItemRangeInconsistent_LeftMinGreaterThanRightMin = -2147220958;
- //
- // Summary:
- // The value of the job template item cannot be less than zero.
- public static int Operation_ProfileItemRangeInconsistent_ValueLessThanZero = -2147220955;
- //
- // Summary:
- // The data type used to set or access the job template item does not match
- // the data type of the item.
- public static int Operation_ProfileItemTypeInconsistent = -2147220949;
- //
- // Summary:
- // A job template with the specified name already exists.
- public static int Operation_ProfileNameBeenUsed = -2147220964;
- //
- // Summary:
- // The job template does not exist in the scheduler.
- public static int Operation_ProfileNotFound = -2147220965;
- //
- // Summary:
- // The property is read-only and cannot be set.
- public static int Operation_PropertyIsstatic = -2147220989;
- //
- // Summary:
- // The property name already exists.
- public static int Operation_PropertyNameAlreadyExists = -2147220973;
- public static int Operation_PropertyNameCannotBeEmpty = -2147220786;
- public static int Operation_PropertyNotSupportedOnServerVersion = -2147220907;
- //
- // Summary:
- // The value is too large.
- public static int Operation_PropertyValueTooLargeForDatabase = -2147220939;
- public static int Operation_ReconnectTimeout = -2147220780;
- public static int Operation_SchedulerInCleanupMode = -2147220777;
- public static int Operation_SchedulerInRecoverMode = -2147220788;
- public static int Operation_SchedulerPrivilegeRequired = -2147220787;
- public static int Operation_ServerIsBusy = -2147220897;
- //
- // Summary:
- // You cannot change the property when the job is in the current state.
- public static int Operation_SetInvalidPropUnderCertainState = -2147220943;
- public static int Operation_TaskDeletionForbidden = -2147220911;
- //
- // Summary:
- // Failed to modify the task.
- public static int Operation_TaskModifyFailed = -2147220922;
- public static int Operation_TaskNotCreatedOnServer = -2147220914;
- public static int Operation_TaskOfTypeCannotBeReconfigured = -2147220915;
- public static int Operation_TaskTypeAddedInWrongJobState = -2147220910;
- public static int Operation_TaskTypeAndIsParametricIncompatible = -2147220905;
- public static int Operation_TaskTypeNotSupportedOnServer = -2147220924;
- public static int Operation_TooManyParametricSweepTasksPerJob = -2147220906;
- //
- // Summary:
- // You cannot change the property when the node is in the current state.
- public static int Operation_TryToChangePropertyInNodeState = -2147220945;
- //
- // Summary:
- // You cannot modify the job property when the job is in its current state.
- public static int Operation_TryToModifyInvalidProperty = -2147220962;
- //
- // Summary:
- // You cannot modify the job property when the job is in its current state.
- public static int Operation_TryToModifyInvalidStateJob = -2147220961;
- //
- // Summary:
- // The task cannot be modified in its current state.
- public static int Operation_TryToModifyInvalidStateTask = -2147220921;
- //
- // Summary:
- // If the job is a backfill job, you cannot modify the job's runtime value
- // when
- // the job is running.
- public static int Operation_TryToModifyRuntimeForRunningBackfillJob = -2147220963;
- //
- // Summary:
- // The exception was not expected.
- public static int Operation_UnexpectedException = -2147220892;
- //
- // Summary:
- // The specified node group does not exist.
- public static int Operation_UnknownNodeGroup = -2147220937;
- public static int Operation_WindowsTaskSchedulerExecFailure = -2147220890;
- public static int Operation_WindowsTaskSchedulerNotStarted = -2147220889;
- public static int Operation_WindowsTaskSchedulerTimeout = -2147220891;
- //
- // Summary:
- // The software license format is not valid. The valid format is
- // application:
- // numberoflicenses{,application:numberoflicenses.
- public static int Operation_WrongLicenseFormat = -2147220947;
- //
- // Summary:
- // The cluster does not contain a node that is capable of running a broker
- // job.
- public static int ResourceAssignement_FailedToFindBrokerNode = -2147219991;
- //
- // Summary:
- // Failed to run the activation filter specified in the
- // ActivationFilterProgram
- // cluster parameter.
- public static int ResourceAssignement_FailedToLaunchActivationFilter = -2147219990;
- //
- // Summary:
- // There are no nodes available to run the task.
- public static int ResourceAssignement_NodeUnavailable = -2147219989;
- public static int ServiceBroker_ExitCode_End = -2147214992;
- public static int ServiceBroker_ExitCode_Start = -2147215992;
- //
- // Summary:
- // The BackendBinding value specified in the service broker's configuration
- // file is not valid. Correct the binding and start a new session.
- public static int ServiceBroker_InvalidBackendBinding = -2147215986;
- //
- // Summary:
- // The configuration file for the service broker was not valid.
- public static int ServiceBroker_InvalidConfig = -2147215989;
- //
- // Summary:
- // The broker could not find the HPC environment information.
- public static int ServiceBroker_MissingHpcEnvironmentInfomation = -2147215991;
- //
- // Summary:
- // The service name or assembly name was not specified.
- public static int ServiceBroker_MissingServiceInformation = -2147215990;
- //
- // Summary:
- // The broker failed to open the service broker web service.
- public static int ServiceBroker_OpenBrokerServiceFailure = -2147215987;
- //
- // Summary:
- // The broker failed to open the service registration web service.
- public static int ServiceBroker_OpenRegistrationServiceFailure = -2147215988;
- //
- // Summary:
- // An unexpected exception occurred. Please see the broker execution log for
- // details.
- public static int ServiceBroker_UnexpectedError = -2147215972;
- //
- // Summary:
- // Not able to find the service assembly file name in the service
- // registration
- // file. Please ensure that the service registration file has the correct
- // format.
- public static int ServiceHost_AssemblyFileNameNullOrEmpty = -2147216980;
- //
- // Summary:
- // Failed to find the service assembly file. Please ensure that the assembly
- // has been deployed and registered on the node.
- public static int ServiceHost_AssemblyFileNotFound = -2147216991;
- //
- // Summary:
- // Failed to load the service assembly. Please ensure that the security
- // settings
- // for the assembly are correct and that the service assembly information at
- // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath) is
- // correct.
- public static int ServiceHost_AssemblyLoadingError = -2147216990;
- //
- // Summary:
- // The service registration file is not in the correct format. Please use
- // the
- // service registration XML schema to ensure that the service registration
- // file
- // is in the correct format.
- public static int ServiceHost_BadServiceRegistrationFileFormat = -2147216979;
- //
- // Summary:
- // Failed to find the service contract interface from the service assembly.
- // Please ensure that the contract information provided in the service
- // registration
- // is valid (see
- // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath
- // and Contract type).
- public static int ServiceHost_ContractDiscoverError = -2147216989;
- //
- // Summary:
- // The service registry is corrupt.
- public static int ServiceHost_CorruptServiceRegistry = -2147216983;
- public static int ServiceHost_ExitCode_End = -2147215992;
- public static int ServiceHost_ExitCode_Start = -2147216992;
- //
- // Summary:
- // Failed to register to the broker service.
- public static int ServiceHost_FailedToRegisterLB = -2147216984;
- public static int ServiceHost_IncorrectCommandLineParameter = -2147216978;
- //
- // Summary:
- // Failed to find the contract implemented by the service type.
- public static int ServiceHost_NoContractImplemented = -2147216986;
- public static int ServiceHost_PrintCommandHelp = -2147216976;
- public static int ServiceHost_ServiceConfigFileNameNotSpecified = -2147216977;
- //
- // Summary:
- // Failed to open the service host. Please ensure that the NetTcp port
- // sharing
- // service is running and that the user has permission to use port sharing
- // service,
- // and that the firewall settings are correct.
- public static int ServiceHost_ServiceHostFailedToOpen = -2147216985;
- //
- // Summary:
- // The service name is not specified.
- public static int ServiceHost_ServiceNameNotSpecified = -2147216982;
- //
- // Summary:
- // Cannot locate the service registration file in both
- // %CCP_HOME%ServiceRegistration
- // folder and user specified central registration folder (if any). Please
- // ensure
- // that the service has been successfully deployed.
- public static int ServiceHost_ServiceRegistrationFileNotFound = -2147216981;
- //
- // Summary:
- // Failed to find the service type from the service assembly. Please ensure
- // that the type information in the service registration is valid (see
- // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath
- // and ServiceType).
- public static int ServiceHost_ServiceTypeDiscoverError = -2147216988;
- //
- // Summary:
- // Failed to load the service type from the service assembly.
- public static int ServiceHost_ServiceTypeLoadingError = -2147216987;
- //
- // Summary:
- // An unexpected exception occurred. Please see the service host execution
- // log
- // for details.
- public static int ServiceHost_UnexpectedException = -2147216972;
- //
- // Summary:
- // The operation was a success.
- public static int Success = 0;
- //
- // Summary:
- // An unknown error occurred.
- public static int UnknowError = -2147214990;
- public static int UnknownError = -2147214990;
- public static int Validation_AdminJobCannotHaveTaskDependency = -2147219882;
- //
- // Summary:
- // A batch job cannot be a child job.
- public static int Validation_BatchJobMustNotBeChildJob = -2147219904;
- //
- // Summary:
- // Failed to compute the maximum resource requirement for the job.
- public static int Validation_CalcJobMaxError = -2147219921;
- //
- // Summary:
- // Failed to compute the minimum resource requirement for the job.
- public static int Validation_CalcJobMinError = -2147219922;
- //
- // Summary:
- // A child job cannot contain another child job.
- public static int Validation_ChildJobContainsChildJob = -2147219908;
- //
- // Summary:
- // The parent identifier included in the child job is different than its
- // parent's
- // actual identifier.
- public static int Validation_ChildJobIdNotPairWithParentJobId = -2147219909;
- //
- // Summary:
- // The child job must be a router job.
- public static int Validation_ChildJobMustBeRouterJob = -2147219910;
- //
- // Summary:
- // The child job is not valid.
- public static int Validation_ChildJobNotValid = -2147219912;
- //
- // Summary:
- // The cluster does not contain the required minimum number of resources.
- public static int Validation_ClusterSizeLessThanMin = -2147219956;
- public static int Validation_CombineSelectException = -2147219979;
- //
- // Summary:
- // The credentials specified for this job are not able to log onto the
- // cluster.
- public static int Validation_CredentialCheckFailed = -2147219989;
- //
- // Summary:
- // Failed to calculate task group level.
- public static int Validation_FailToCalculateTaskGroupLevel = -2147219930;
- //
- // Summary:
- // The contents of the Microsoft.Hpc.Scheduler.ISchedulerTask.DependsOn
- // property
- // is not valid.
- public static int Validation_InvalidDependsOn = -2147219929;
- public static int Validation_InvalidNodeCriteriaForJob = -2147219886;
- public static int Validation_InvalidPropForTaskType = -2147219894;
- //
- // Summary:
- // Job submission failed because the job submission filter application is
- // not
- // valid. Your cluster administrator should check that the submission filter
- // is an executable binary file (".exe" file) or Windows command script
- // (".cmd"
- // file).
- public static int Validation_InvalidSubmissionFilter = -2147219900;
- //
- // Summary:
- // A node that the job requests does not support the job's job type.
- public static int Validation_JobAskedNodeMustContainJobType = -2147219953;
- //
- // Summary:
- // The job is missing the user name or password.
- public static int Validation_JobMissUsernameOrPassword = -2147219988;
- //
- // Summary:
- // The list of requested nodes does not contain a valid node.
- public static int Validation_JobRequestedNodesContainZeroValidNode = -2147219967;
- //
- // Summary:
- // The job requires a node that is not available.
- public static int Validation_JobRequiredNodeNotAvailable = -2147219954;
- //
- // Summary:
- // The list of nodes that the task requires must be included in the list of
- // the nodes that the job requested.
- public static int Validation_JobRequiredNodeNotInJobAskedNodes = -2147219955;
- //
- // Summary:
- // The maximum number of resource units must be greater than zero.
- public static int Validation_MaxLessThanOne = -2147219933;
- //
- // Summary:
- // The maximum number of resource units cannot be less than zero.
- public static int Validation_MaxLessThanZero = -2147219959;
- //
- // Summary:
- // You must specify the maximum number of resource units that the job
- // requires
- // if the Microsoft.Hpc.Scheduler.ISchedulerJob.AutoCalculateMax property is
- // false.
- public static int Validation_MaxNotSpecifiedWhenAutoCalcMaxIsFalse = -2147219961;
- //
- // Summary:
- // You must specify a maximum resource value for the task.
- public static int Validation_MaxUndefined = -2147219947;
- //
- // Summary:
- // The minimum value must be less than the maximum value.
- public static int Validation_MinGreaterThanMax = -2147219958;
- //
- // Summary:
- // The minimum number of resource units must be greater than zero.
- public static int Validation_MinLessThanOne = -2147219934;
- //
- // Summary:
- // The minimum number of resource units cannot be less than zero.
- public static int Validation_MinLessThanZero = -2147219960;
- //
- // Summary:
- // You must specify the minimum number of resource units that the job
- // requires
- // if the Microsoft.Hpc.Scheduler.ISchedulerJob.AutoCalculateMin property is
- // false.
- public static int Validation_MinNotSpecifiedWhenAutoCalcMinIsFalse = -2147219962;
- //
- // Summary:
- // You must specify a minimum resource value for the task.
- public static int Validation_MinUndefined = -2147219948;
- //
- // Summary:
- // The task must specify a command to run.
- public static int Validation_MissCommandLine = -2147219952;
- public static int Validation_MultipleNodePrepTasksPerJob = -2147219897;
- public static int Validation_MultipleNodeReleaseTasksPerJob = -2147219896;
- //
- // Summary:
- // The computed resources for the job is less than the required number of
- // resources.
- public static int Validation_NodeListSizeLessThanMin = -2147219957;
- //
- // Summary:
- // The node does not exist in the cluster.
- public static int Validation_NodeNotExist = -2147219965;
- //
- // Summary:
- // The cluster does not contain a node that supports the specified resource
- // requirements for the job (for example, memory or core requirements).
- // Please
- // adjust your requirements and submit the job again.
- public static int Validation_NoNodeFulfillsTheSelectionCriteria = -2147219966;
- public static int Validation_OnlyNodePrepOrReleaseTasksInJob = -2147219895;
- //
- // Summary:
- // The parent job must be a service job.
- public static int Validation_ParentJobMustBeServiceJob = -2147219911;
- //
- // Summary:
- // The parent job is not valid.
- public static int Validation_ParentJobNotValid = -2147219907;
- //
- // Summary:
- // The job template does not exist.
- public static int Validation_ProfileNotExist = -2147219977;
- //
- // Summary:
- // The property value is not within the allowed range of values as specified
- // by the job template.
- public static int Validation_PropertyOutOfRange = -2147219978;
- //
- // Summary:
- // A property that requires a value as specified by the job template has not
- // been set.
- public static int Validation_RequiredPropertyNotSet = -2147219981;
- //
- // Summary:
- // A router job cannot be a child job.
- public static int Validation_RouterJobMustBeChildJob = -2147219906;
- //
- // Summary:
- // To reserve resources for a job (when the job does not contain tasks and
- // has
- // requested that it run until canceled), you must specify the maximum and
- // minimum
- // resource values for the job -you cannot request that the scheduler
- // compute
- // the maximum and minimum resource values.
- public static int Validation_RunUntilCanceledButAutoMinMaxSet = -2147219963;
- //
- // Summary:
- // To reserve resources for a job (when the job does not contain tasks and
- // has
- // requested that it run until canceled), you must specify the maximum and
- // minimum
- // resource values for the job.
- public static int Validation_RunUntilCanceledButMinMaxNotSpecified = -2147219964;
- //
- // Summary:
- // A service job cannot be a child job.
- public static int Validation_ServiceJobMustNotBeChildJob = -2147219905;
- public static int Validation_ServiceTaskIsNotAlone = -2147219887;
- //
- // Summary:
- // Job submission failed because the job submission filter application could
- // not be found. Your cluster administrator should check that the submission
- // filter is accessible from the head node of the cluster and the path to
- // the
- // submission filter is a fully-qualified (not relative) path name.
- public static int Validation_SubmissionFilterDoesNotExist = -2147219901;
- //
- // Summary:
- // The job failed to pass the job submission filter specified in the
- // SubmissionFilterProgram
- // cluster parameter.
- public static int Validation_SubmissionFilterFailed = -2147219902;
- public static int Validation_SubmissionFilterInvalidJobTerm = -2147219883;
- public static int Validation_SubmissionFilterTimeout = -2147219884;
- public static int Validation_TargetResourceCountLessThanMin = -2147219888;
- public static int Validation_TargetResourceCountMoreThanMax = -2147219889;
- //
- // Summary:
- // The task must specify the same resource unit as the job.
- public static int Validation_TaskAllocUnitNotSameWithJob = -2147219949;
- //
- // Summary:
- // The dependency list for multiple tasks creates a circular dependency.
- public static int Validation_TaskDependenciesContainCycle = -2147219931;
- //
- // Summary:
- // The minimum and maximum resource requirements cannot be computed for a
- // job
- // with exclusive access to the nodes. You must specify the minimum and
- // maximum
- // resource values and resubmit the job.
- public static int Validation_TaskExclusiveWhileJobAutoMinMaxEnabled = -2147219938;
- //
- // Summary:
- // The task can run exclusively on a node only if the job specifies that it
- // must run exclusively on the node.
- public static int Validation_TaskExclusiveWhileJobNot = -2147219943;
- //
- // Summary:
- // The task failed because the scheduler could not validate its parent job.
- // Correct the validation error on the parent job and resubmit the job.
- public static int Validation_TaskFailedOnJobValidationFault = -2147219936;
- //
- // Summary:
- // The task specifies a list of dependent tasks but the task does not
- // specify
- // a name value for itself; each dependent task and the task specifying the
- // dependency must include a name value.
- public static int Validation_TaskHasDependOnButNoName = -2147219928;
- //
- // Summary:
- // The task cannot specify required nodes when the job has requested that
- // the
- // scheduler compute the required resources.
- public static int Validation_TaskHasRequiredNodesWhileJobAutoMinMaxEnabled = -2147219937;
- //
- // Summary:
- // The increment value for a parametric task must be greater than or equal
- // to
- // 1.
- public static int Validation_TaskIncrementValueLessThanZero = -2147219899;
- //
- // Summary:
- // The start value for a parametric task cannot be greater than end value.
- public static int Validation_TaskInvalidParametricSweep = -2147219898;
- //
- // Summary:
- // The maximum resource value for the task must be less than that of the
- // job.
- public static int Validation_TaskMaxGreaterThanJobMax = -2147219945;
- //
- // Summary:
- // The minimum resource value for the task must be less than that of the
- // job.
- public static int Validation_TaskMinGreaterThanJobMin = -2147219946;
- //
- // Summary:
- // The minimum resource value for the task must be less than its maximum The
- // minimum resource value for the task must be less than that of the job
- // value.
- public static int Validation_TaskMinGreaterThanTaskMax = -2147219944;
- public static int Validation_TaskNodeReleaseDisabled = -2147219893;
- public static int Validation_TaskNodeReleaseExceedsMaxRunTime = -2147219892;
- //
- // Summary:
- // You have exceeded the number of times that a task can be queued again.
- // The
- // TaskRetryCount cluster parameter specifies the maximum number of times
- // that
- // a task can be queued again.
- public static int Validation_TaskRequeuedTooManyTimes = -2147219951;
- public static int Validation_TaskRequiredNodeNotAllocatedToRunningJob = -2147219885;
- //
- // Summary:
- // The job requires a node that is not available.
- public static int Validation_TaskRequiredNodeNotAvailable = -2147219940;
- //
- // Summary:
- // The list of nodes that the task requires must be included in the list of
- // the nodes that the job requested.
- public static int Validation_TaskRequiredNodeNotInJobAskedNodes = -2147219942;
- //
- // Summary:
- // The task specifies more required nodes than the job's specified maximum
- // resource
- // usage.
- public static int Validation_TaskRequiredNodeOutOfJobMaximumResource = -2147219939;
- //
- // Summary:
- // The run-time value for the task is greater than the length of time that
- // the
- // job is scheduled to remain running.
- public static int Validation_TaskRuntimeGreaterThanJob = -2147219941;
- public static int Validation_TaskTypeAddedInWrongJobState = -2147219891;
- //
- // Summary:
- // The task failed validation.
- public static int Validation_TaskValidationFailed = -2147219935;
- public static int Validation_TooManyParametricInstances = -2147219890;
- //
- // Summary:
- // You cannot queue the task again because the task is marked to run only
- // one
- // time.
- public static int Validation_TryToRequeueNonRerunnableTask = -2147219950;
- //
- // Summary:
- // The depends on list is ambiguous because multiple tasks specify the same
- // name.
- public static int Validation_TwoTasksWithSameNameDifferentGroup = -2147219932;
- //
- // Summary:
- // An unexpected exception occurred while validating the job.
- public static int Validation_UnexpectedExceptionWhenValidating = -2147219991;
- public static int Validation_Unknown = -2147219990;
-
- // Summary:
- // Defines the category of errors into which the
- // Microsoft.Hpc.Scheduler.Properties.ErrorCode
- // codes are grouped.
- public enum Category
- {
- // Summary:
- // An error occurred while performing an operation (for example, the
- // user tried
- // to delete a job template but they do not have permissions to delete
- // templates).
- // This enumeration member represents a value of 0.
- OperationError,
- //
- // Summary:
- // The error occurred while validating the job or task before it ran.
- // This enumeration
- // member represents a value of 1.
- ValidationError,
- //
- // Summary:
- // The error occurred while assigning resources to the job or task. This
- // enumeration
- // member represents a value of 2.
- ResourceAssignmentError,
- //
- // Summary:
- // The error occurred while executing the job or task. This enumeration
- // member
- // represents a value of 3.
- ExecutionError,
- //
- // Summary:
- // Includes errors related to starting service or broker jobs. This
- // enumeration
- // member represents a value of 4.
- Other,
- }
-
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Global Error Code
+//
+// ------------------------------------------------------------------------------
+
+package com.microsoft.hpc.properties;
+
+// Summary:
+// Defines the possible HPC-defined error codes that HPC can set.
+public final class ErrorCode
+{
+
+ // Summary:
+ // Separator used to separate the insertion strings for the error message
+ // text.
+ // See Microsoft.Hpc.Scheduler.Properties.SchedulerException.Params.
+ public static String ArgumentSeparator = "|||";
+ public static int AuthFailureDisableCredentialReuse = 1;
+ //
+ // Summary:
+ // The child job has finished running.
+ public static int Execution_ChildJobFinished = -2147218986;
+ public static int Execution_FailedByActivationFilter = -2147218966;
+ public static int Execution_FailedToOpenStandardError = -2147218973;
+ public static int Execution_FailedToOpenStandardInput = -2147218975;
+ public static int Execution_FailedToOpenStandardOutput = -2147218974;
+ //
+ // Summary:
+ // The user canceled the job while it was running.
+ public static int Execution_JobCanceled = -2147218982;
+ //
+ // Summary:
+ // The job was preempted by a higher priority job. For details, see the
+ // Microsoft.Hpc.Scheduler.ISchedulerJob.CanPreempt
+ // and the PreemptionType cluster parameter in the Remarks section of
+ // Microsoft.Hpc.Scheduler.IScheduler.SetClusterParameter(System.String,System.String).
+ public static int Execution_JobPreempted = -2147218978;
+ //
+ // Summary:
+ // The job exceeded its run-time limit. See
+ // Microsoft.Hpc.Scheduler.ISchedulerJob.Runtime
+ // and Microsoft.Hpc.Scheduler.ISchedulerTask.Runtime.
+ public static int Execution_JobRuntimeExpired = -2147218987;
+ //
+ // Summary:
+ // An error occurred on the node.
+ public static int Execution_NodeError = -2147218990;
+ public static int Execution_NodePrepTaskFailure = -2147218968;
+ //
+ // Summary:
+ // The job or task was scheduled to run on a node that is no longer
+ // reachable.
+ public static int Execution_NodeUnreachable = -2147218984;
+ //
+ // Summary:
+ // The parent job of this child job has been canceled.
+ public static int Execution_ParentJobCanceled = -2147218988;
+ //
+ // Summary:
+ // The process has exited.
+ public static int Execution_ProcessDead = -2147218983;
+ //
+ // Summary:
+ // The job failed to start on one or more nodes or the nodes were not
+ // reachable.
+ public static int Execution_ResourceFailure = -2147218981;
+ //
+ // Summary:
+ // The job failed to start on node {0}.
+ public static int Execution_StartJobFailedOnNode = -2147218977;
+ public static int Execution_TaskCanceledBeforeAssignment = -2147218971;
+ public static int Execution_TaskCanceledDuringExecution = -2147218969;
+ public static int Execution_TaskCanceledOnJobRequeue = -2147218970;
+ //
+ // Summary:
+ // The scheduler was not able to execute the command specified in the task.
+ public static int Execution_TaskExecutionFailure = -2147218979;
+ //
+ // Summary:
+ // The task failed.
+ public static int Execution_TaskFailure = -2147218980;
+ public static int Execution_TaskNodeNotUsable = -2147218967;
+ //
+ // Summary:
+ // The task exceeded its run-time limit. See
+ // Microsoft.Hpc.Scheduler.ISchedulerTask.Runtime.
+ public static int Execution_TaskRuntimeExpired = -2147218985;
+ //
+ // Summary:
+ // The job to which the task belongs was canceled.
+ public static int Execution_TasksJobCanceled = -2147218989;
+ //
+ // Summary:
+ // The task was canceled while it was running because a job with higher
+ // priority
+ // preempted the task. If the task can be rerun, the HPC Job Scheduler
+ // service
+ // will attempt to automatically queue it again.
+ public static int Execution_TasksPreempted = -2147218976;
+ //
+ // Summary:
+ // An unknown error occurred.
+ public static int Execution_UnknownError = -2147218991;
+ public static int Execution_WorkingDirectoryNotFound = -2147218972;
+ //
+ // Summary:
+ // The value is outside the allowable range of values.
+ public static int Operation_ArgumentOutOfRange = -2147220987;
+ //
+ // Summary:
+ // Authenticate failure.
+ public static int Operation_AuthenticationFailure = -2147220980;
+ public static int Operation_AzureDeploymentNotFound = -2147220691;
+ //
+ // Summary:
+ // The user canceled the job or task.
+ public static int Operation_CanceledByUser = -2147220991;
+ public static int Operation_CancelMessageIsTooLong = -2147220781;
+ public static int Operation_CannotConnectWithScheduler = -2147220785;
+ //
+ // Summary:
+ // You cannot remove item {0} from the default job template.
+ public static int Operation_CannotRemoveProfileItemFromDefaultTemplate = -2147220954;
+ //
+ // Summary:
+ // You cannot change the name of the default job template.
+ public static int Operation_CannotResetDefaultProfileName = -2147220948;
+ //
+ // Summary:
+ // You cannot submit child job, instead you must submit the parent job.
+ public static int Operation_ChildJobCannotBeSubmittedAlone = -2147220966;
+ //
+ // Summary:
+ // Not able to register with the server.
+ public static int Operation_CouldNotRegisterWithServer = -2147220932;
+ //
+ // Summary:
+ // Cryptography error.
+ public static int Operation_CryptographyError = -2147220979;
+ //
+ // Summary:
+ // A database exception occurred while processing the request.
+ public static int Operation_DatabaseException = -2147220988;
+ //
+ // Summary:
+ // The scheduler was unable to create a new job because the database is
+ // full.
+ public static int Operation_DatabaseIsFull = -2147220926;
+ //
+ // Summary:
+ // Duplicate application found in the software license item.
+ public static int Operation_DuplicateLicenseFeature = -2147220946;
+ public static int Operation_EmailCredentialMustBeAdmin = -2147220888;
+ //
+ // Summary:
+ // The environment variable name was too long. The size must be smaller than
+ // {0} characters.
+ public static int Operation_EnvironmentVarNameTooLong = -2147220929;
+ //
+ // Summary:
+ // The environment variable value was too long. The size must be smaller
+ // than
+ // {0} characters.
+ public static int Operation_EnvironmentVarValueTooLong = -2147220928;
+ public static int Operation_ExcludedNodeDoesNotExist = -2147220885;
+ public static int Operation_ExcludedNodeListTooLong = -2147220782;
+ public static int Operation_ExcludedRequiredNode = -2147220887;
+ public static int Operation_ExcludedTooManyNodes = -2147220886;
+ public static int Operation_ExpandedPriorityNotValidOnServer = -2147220792;
+ public static int Operation_FeatureDeprecated = -2147220896;
+ public static int Operation_FeatureUnimplemented = -2147220895;
+ public static int Operation_HPCSidUnavailable = -2147220784;
+ //
+ // Summary:
+ // The job template property {0} is not a legal job template property.
+ public static int Operation_IllegalProfileProperty = -2147220969;
+ public static int Operation_IllegalServiceConcludeAttempt = -2147220779;
+ public static int Operation_IllegalStateForServiceConclude = -2147220778;
+ public static int Operation_IllegalTaskAddedToServiceJob = -2147220909;
+ //
+ // Summary:
+ // You cannot cancel the job in its current state.
+ public static int Operation_InvalidCancelJobState = -2147220984;
+ //
+ // Summary:
+ // You cannot cancel the task in its current state.
+ public static int Operation_InvalidCancelTaskState = -2147220983;
+ public static int Operation_InvalidEmailAddress = -2147220690;
+ //
+ // Summary:
+ // The provided environment variable name is not valid.
+ public static int Operation_InvalidEnvironmentVarName = -2147220931;
+ //
+ // Summary:
+ // The provided environment variable value is not valid.
+ public static int Operation_InvalidEnvironmentVarValue = -2147220930;
+ //
+ // Summary:
+ // You cannot filter on property '{0}' for this type of object.
+ public static int Operation_InvalidFilterProperty = -2147220925;
+ //
+ // Summary:
+ // The job identifier does not identify an existing job in the scheduler.
+ public static int Operation_InvalidJobId = -2147220986;
+ public static int Operation_InvalidJobStateForNodeExclusion = -2147220884;
+ //
+ // Summary:
+ // Invalid specification for '{0}'.
+ public static int Operation_InvalidJobTemplateItemXml = -2147220927;
+ //
+ // Summary:
+ // The node identifier does not identify and existing node in the cluster.
+ public static int Operation_InvalidNodeId = -2147220978;
+ //
+ // Summary:
+ // The requested operation is not valid.
+ public static int Operation_InvalidOperation = -2147220977;
+ //
+ // Summary:
+ // The job template identifier is not valid.
+ public static int Operation_InvalidProfileId = -2147220933;
+ public static int Operation_InvalidPropForTaskType = -2147220908;
+ //
+ // Summary:
+ // The row enumeration identifier is not valid.
+ public static int Operation_InvalidRowEnumId = -2147220935;
+ //
+ // Summary:
+ // The task identifier does not identify and existing task in the scheduler.
+ public static int Operation_InvalidTaskId = -2147220985;
+ //
+ // Summary:
+ // The job already exists on the server.
+ public static int Operation_JobAlreadyCreatedOnServer = -2147220941;
+ public static int Operation_JobDeletionForbidden = -2147220912;
+ public static int Operation_JobHoldInvalidState = -2147220790;
+ public static int Operation_JobHoldUntilTooLong = -2147220783;
+ public static int Operation_JobInvalidHoldUntil = -2147220789;
+ //
+ // Summary:
+ // Job modification failed: {0}.
+ public static int Operation_JobModifyFailed = -2147220960;
+ //
+ // Summary:
+ // The job was not found on the server.
+ public static int Operation_JobNotCreatedOnServer = -2147220942;
+ public static int Operation_JobProgressOutOfRange = -2147220917;
+ //
+ // Summary:
+ // Unable to revert the job changes.
+ public static int Operation_JobRevertModifyFailed = -2147220959;
+ public static int Operation_JobTemplateRequiredValueMissing = -2147220878;
+ public static int Operation_JobTemplateValueInvalid = -2147220881;
+ public static int Operation_JobTemplateValueTooLarge = -2147220879;
+ public static int Operation_JobTemplateValueTooSmall = -2147220880;
+ public static int Operation_JobVersionMismatch = -2147220894;
+ //
+ // Summary:
+ // You must specify a job template name.
+ public static int Operation_MustProvideProfileName = -2147220934;
+ public static int Operation_NodeAlreadyExists = -2147220898;
+ public static int Operation_NodeIsNotOnAzure = -2147220692;
+ //
+ // Summary:
+ // The user does not have permission to use the job template.
+ public static int Operation_NoPermissionToUseProfile = -2147220967;
+ //
+ // Summary:
+ // No storage is currently defined for the property.
+ public static int Operation_NoTableDefinedForProperty = -2147220944;
+ //
+ // Summary:
+ // You do not have permission to change this job template.
+ public static int Operation_NotAllowedToChangeProfiles = -2147220970;
+ //
+ // Summary:
+ // The user is not allowed to create job templates.
+ public static int Operation_NotAllowedToCreateProfiles = -2147220972;
+ //
+ // Summary:
+ // The default job template cannot be deleted.
+ public static int Operation_NotAllowedToDeleteDefaultProfile = -2147220968;
+ //
+ // Summary:
+ // The user is not allowed to delete job templates.
+ public static int Operation_NotAllowedToDeleteProfiles = -2147220971;
+ //
+ // Summary:
+ // Cannot perform the operation because you are not connected to the server.
+ public static int Operation_NotConnectedToServer = -2147220936;
+ public static int Operation_ObjectInUse = -2147220882;
+ //
+ // Summary:
+ // The job must be in the configuration state in order to submit the job.
+ public static int Operation_OnlyConfigJobsCanBeSubmitted = -2147220990;
+ //
+ // Summary:
+ // You can submit the task only if the task is in the
+ // Microsoft.Hpc.Scheduler.Properties.TaskState.Configuring
+ // state.
+ public static int Operation_OnlyConfiguringTasksCanBeSubmitted = -2147220940;
+ //
+ // Summary:
+ // You can reconfigure only canceled or failed jobs.
+ public static int Operation_OnlyFailedCancelledJobsCanBeConfigured = -2147220982;
+ public static int Operation_OnlyFailedCancelledTasksCanBeConfigured = -2147220916;
+ //
+ // Summary:
+ // The user does not have permission to perform the operation.
+ public static int Operation_PermissionDenied = -2147220981;
+ //
+ // Summary:
+ // You cannot change HPC-defined environment variables.
+ public static int Operation_PreservedEnvironmentVariables = -2147220938;
+ public static int Operation_PriorityAndExPriCannotBeSetTogether = -2147220791;
+ //
+ // Summary:
+ // The job template item that you are trying to set already exists.
+ public static int Operation_ProfileItemAlreadyExists = -2147220975;
+ //
+ // Summary:
+ // The default value for the job template item is not within the allowed
+ // value
+ // range for the item.
+ public static int Operation_ProfileItemDefaultValueInvalid = -2147220952;
+ //
+ // Summary:
+ // The default values specified for the job template item {0} must include
+ // all
+ // of the required values for that item. Ensure that the default values
+ // include
+ // all the values in the Required Values list, and then try again.
+ public static int Operation_ProfileItemDefaultValueNotIncludeRequiredValue = -2147220953;
+ //
+ // Summary:
+ // The job template item that you are trying to set does not exist.
+ public static int Operation_ProfileItemDoesNotExist = -2147220976;
+ //
+ // Summary:
+ // The minimum staticraint for the job template item is greater than its
+ // maximum
+ // staticraint.
+ public static int Operation_ProfileItemMinGreaterThanMax = -2147220950;
+ //
+ // Summary:
+ // You must provide a default value for the job template item.
+ public static int Operation_ProfileItemMustProvideDefaultStringValue = -2147220951;
+ //
+ // Summary:
+ // Invalid template: The template item {0}'s default value, {1}, is larger
+ // than
+ // the default value of the related template item, {2} (default value: {3}).
+ // Correct this inconsistency and try again.
+ public static int Operation_ProfileItemRangeInconsistent_LeftDefaultGreaterThanRightDefault = -2147220956;
+ //
+ // Summary:
+ // Invalid template: The template item {0}'s maximum value, {1}, is larger
+ // than
+ // the maximum value of the related template item, {2} (maximum value: {3}).
+ // Correct this inconsistency and try again.
+ public static int Operation_ProfileItemRangeInconsistent_LeftMaxGreaterThanRightMax = -2147220957;
+ //
+ // Summary:
+ // Invalid template: The template item {0}'s minimum value, {1}, is larger
+ // than
+ // the minimum value of the related template item, {2} (minimum value: {3}).
+ // Correct this inconsistency and try again.
+ public static int Operation_ProfileItemRangeInconsistent_LeftMinGreaterThanRightMin = -2147220958;
+ //
+ // Summary:
+ // The value of the job template item cannot be less than zero.
+ public static int Operation_ProfileItemRangeInconsistent_ValueLessThanZero = -2147220955;
+ //
+ // Summary:
+ // The data type used to set or access the job template item does not match
+ // the data type of the item.
+ public static int Operation_ProfileItemTypeInconsistent = -2147220949;
+ //
+ // Summary:
+ // A job template with the specified name already exists.
+ public static int Operation_ProfileNameBeenUsed = -2147220964;
+ //
+ // Summary:
+ // The job template does not exist in the scheduler.
+ public static int Operation_ProfileNotFound = -2147220965;
+ //
+ // Summary:
+ // The property is read-only and cannot be set.
+ public static int Operation_PropertyIsstatic = -2147220989;
+ //
+ // Summary:
+ // The property name already exists.
+ public static int Operation_PropertyNameAlreadyExists = -2147220973;
+ public static int Operation_PropertyNameCannotBeEmpty = -2147220786;
+ public static int Operation_PropertyNotSupportedOnServerVersion = -2147220907;
+ //
+ // Summary:
+ // The value is too large.
+ public static int Operation_PropertyValueTooLargeForDatabase = -2147220939;
+ public static int Operation_ReconnectTimeout = -2147220780;
+ public static int Operation_SchedulerInCleanupMode = -2147220777;
+ public static int Operation_SchedulerInRecoverMode = -2147220788;
+ public static int Operation_SchedulerPrivilegeRequired = -2147220787;
+ public static int Operation_ServerIsBusy = -2147220897;
+ //
+ // Summary:
+ // You cannot change the property when the job is in the current state.
+ public static int Operation_SetInvalidPropUnderCertainState = -2147220943;
+ public static int Operation_TaskDeletionForbidden = -2147220911;
+ //
+ // Summary:
+ // Failed to modify the task.
+ public static int Operation_TaskModifyFailed = -2147220922;
+ public static int Operation_TaskNotCreatedOnServer = -2147220914;
+ public static int Operation_TaskOfTypeCannotBeReconfigured = -2147220915;
+ public static int Operation_TaskTypeAddedInWrongJobState = -2147220910;
+ public static int Operation_TaskTypeAndIsParametricIncompatible = -2147220905;
+ public static int Operation_TaskTypeNotSupportedOnServer = -2147220924;
+ public static int Operation_TooManyParametricSweepTasksPerJob = -2147220906;
+ //
+ // Summary:
+ // You cannot change the property when the node is in the current state.
+ public static int Operation_TryToChangePropertyInNodeState = -2147220945;
+ //
+ // Summary:
+ // You cannot modify the job property when the job is in its current state.
+ public static int Operation_TryToModifyInvalidProperty = -2147220962;
+ //
+ // Summary:
+ // You cannot modify the job property when the job is in its current state.
+ public static int Operation_TryToModifyInvalidStateJob = -2147220961;
+ //
+ // Summary:
+ // The task cannot be modified in its current state.
+ public static int Operation_TryToModifyInvalidStateTask = -2147220921;
+ //
+ // Summary:
+ // If the job is a backfill job, you cannot modify the job's runtime value
+ // when
+ // the job is running.
+ public static int Operation_TryToModifyRuntimeForRunningBackfillJob = -2147220963;
+ //
+ // Summary:
+ // The exception was not expected.
+ public static int Operation_UnexpectedException = -2147220892;
+ //
+ // Summary:
+ // The specified node group does not exist.
+ public static int Operation_UnknownNodeGroup = -2147220937;
+ public static int Operation_WindowsTaskSchedulerExecFailure = -2147220890;
+ public static int Operation_WindowsTaskSchedulerNotStarted = -2147220889;
+ public static int Operation_WindowsTaskSchedulerTimeout = -2147220891;
+ //
+ // Summary:
+ // The software license format is not valid. The valid format is
+ // application:
+ // numberoflicenses{,application:numberoflicenses.
+ public static int Operation_WrongLicenseFormat = -2147220947;
+ //
+ // Summary:
+ // The cluster does not contain a node that is capable of running a broker
+ // job.
+ public static int ResourceAssignement_FailedToFindBrokerNode = -2147219991;
+ //
+ // Summary:
+ // Failed to run the activation filter specified in the
+ // ActivationFilterProgram
+ // cluster parameter.
+ public static int ResourceAssignement_FailedToLaunchActivationFilter = -2147219990;
+ //
+ // Summary:
+ // There are no nodes available to run the task.
+ public static int ResourceAssignement_NodeUnavailable = -2147219989;
+ public static int ServiceBroker_ExitCode_End = -2147214992;
+ public static int ServiceBroker_ExitCode_Start = -2147215992;
+ //
+ // Summary:
+ // The BackendBinding value specified in the service broker's configuration
+ // file is not valid. Correct the binding and start a new session.
+ public static int ServiceBroker_InvalidBackendBinding = -2147215986;
+ //
+ // Summary:
+ // The configuration file for the service broker was not valid.
+ public static int ServiceBroker_InvalidConfig = -2147215989;
+ //
+ // Summary:
+ // The broker could not find the HPC environment information.
+ public static int ServiceBroker_MissingHpcEnvironmentInfomation = -2147215991;
+ //
+ // Summary:
+ // The service name or assembly name was not specified.
+ public static int ServiceBroker_MissingServiceInformation = -2147215990;
+ //
+ // Summary:
+ // The broker failed to open the service broker web service.
+ public static int ServiceBroker_OpenBrokerServiceFailure = -2147215987;
+ //
+ // Summary:
+ // The broker failed to open the service registration web service.
+ public static int ServiceBroker_OpenRegistrationServiceFailure = -2147215988;
+ //
+ // Summary:
+ // An unexpected exception occurred. Please see the broker execution log for
+ // details.
+ public static int ServiceBroker_UnexpectedError = -2147215972;
+ //
+ // Summary:
+ // Not able to find the service assembly file name in the service
+ // registration
+ // file. Please ensure that the service registration file has the correct
+ // format.
+ public static int ServiceHost_AssemblyFileNameNullOrEmpty = -2147216980;
+ //
+ // Summary:
+ // Failed to find the service assembly file. Please ensure that the assembly
+ // has been deployed and registered on the node.
+ public static int ServiceHost_AssemblyFileNotFound = -2147216991;
+ //
+ // Summary:
+ // Failed to load the service assembly. Please ensure that the security
+ // settings
+ // for the assembly are correct and that the service assembly information at
+ // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath) is
+ // correct.
+ public static int ServiceHost_AssemblyLoadingError = -2147216990;
+ //
+ // Summary:
+ // The service registration file is not in the correct format. Please use
+ // the
+ // service registration XML schema to ensure that the service registration
+ // file
+ // is in the correct format.
+ public static int ServiceHost_BadServiceRegistrationFileFormat = -2147216979;
+ //
+ // Summary:
+ // Failed to find the service contract interface from the service assembly.
+ // Please ensure that the contract information provided in the service
+ // registration
+ // is valid (see
+ // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath
+ // and Contract type).
+ public static int ServiceHost_ContractDiscoverError = -2147216989;
+ //
+ // Summary:
+ // The service registry is corrupt.
+ public static int ServiceHost_CorruptServiceRegistry = -2147216983;
+ public static int ServiceHost_ExitCode_End = -2147215992;
+ public static int ServiceHost_ExitCode_Start = -2147216992;
+ //
+ // Summary:
+ // Failed to register to the broker service.
+ public static int ServiceHost_FailedToRegisterLB = -2147216984;
+ public static int ServiceHost_IncorrectCommandLineParameter = -2147216978;
+ //
+ // Summary:
+ // Failed to find the contract implemented by the service type.
+ public static int ServiceHost_NoContractImplemented = -2147216986;
+ public static int ServiceHost_PrintCommandHelp = -2147216976;
+ public static int ServiceHost_ServiceConfigFileNameNotSpecified = -2147216977;
+ //
+ // Summary:
+ // Failed to open the service host. Please ensure that the NetTcp port
+ // sharing
+ // service is running and that the user has permission to use port sharing
+ // service,
+ // and that the firewall settings are correct.
+ public static int ServiceHost_ServiceHostFailedToOpen = -2147216985;
+ //
+ // Summary:
+ // The service name is not specified.
+ public static int ServiceHost_ServiceNameNotSpecified = -2147216982;
+ //
+ // Summary:
+ // Cannot locate the service registration file in both
+ // %CCP_HOME%ServiceRegistration
+ // folder and user specified central registration folder (if any). Please
+ // ensure
+ // that the service has been successfully deployed.
+ public static int ServiceHost_ServiceRegistrationFileNotFound = -2147216981;
+ //
+ // Summary:
+ // Failed to find the service type from the service assembly. Please ensure
+ // that the type information in the service registration is valid (see
+ // HKLM\Microsoft\Hpc\ServiceRegistry\\AssemblyPath
+ // and ServiceType).
+ public static int ServiceHost_ServiceTypeDiscoverError = -2147216988;
+ //
+ // Summary:
+ // Failed to load the service type from the service assembly.
+ public static int ServiceHost_ServiceTypeLoadingError = -2147216987;
+ //
+ // Summary:
+ // An unexpected exception occurred. Please see the service host execution
+ // log
+ // for details.
+ public static int ServiceHost_UnexpectedException = -2147216972;
+ //
+ // Summary:
+ // The operation was a success.
+ public static int Success = 0;
+ //
+ // Summary:
+ // An unknown error occurred.
+ public static int UnknowError = -2147214990;
+ public static int UnknownError = -2147214990;
+ public static int Validation_AdminJobCannotHaveTaskDependency = -2147219882;
+ //
+ // Summary:
+ // A batch job cannot be a child job.
+ public static int Validation_BatchJobMustNotBeChildJob = -2147219904;
+ //
+ // Summary:
+ // Failed to compute the maximum resource requirement for the job.
+ public static int Validation_CalcJobMaxError = -2147219921;
+ //
+ // Summary:
+ // Failed to compute the minimum resource requirement for the job.
+ public static int Validation_CalcJobMinError = -2147219922;
+ //
+ // Summary:
+ // A child job cannot contain another child job.
+ public static int Validation_ChildJobContainsChildJob = -2147219908;
+ //
+ // Summary:
+ // The parent identifier included in the child job is different than its
+ // parent's
+ // actual identifier.
+ public static int Validation_ChildJobIdNotPairWithParentJobId = -2147219909;
+ //
+ // Summary:
+ // The child job must be a router job.
+ public static int Validation_ChildJobMustBeRouterJob = -2147219910;
+ //
+ // Summary:
+ // The child job is not valid.
+ public static int Validation_ChildJobNotValid = -2147219912;
+ //
+ // Summary:
+ // The cluster does not contain the required minimum number of resources.
+ public static int Validation_ClusterSizeLessThanMin = -2147219956;
+ public static int Validation_CombineSelectException = -2147219979;
+ //
+ // Summary:
+ // The credentials specified for this job are not able to log onto the
+ // cluster.
+ public static int Validation_CredentialCheckFailed = -2147219989;
+ //
+ // Summary:
+ // Failed to calculate task group level.
+ public static int Validation_FailToCalculateTaskGroupLevel = -2147219930;
+ //
+ // Summary:
+ // The contents of the Microsoft.Hpc.Scheduler.ISchedulerTask.DependsOn
+ // property
+ // is not valid.
+ public static int Validation_InvalidDependsOn = -2147219929;
+ public static int Validation_InvalidNodeCriteriaForJob = -2147219886;
+ public static int Validation_InvalidPropForTaskType = -2147219894;
+ //
+ // Summary:
+ // Job submission failed because the job submission filter application is
+ // not
+ // valid. Your cluster administrator should check that the submission filter
+ // is an executable binary file (".exe" file) or Windows command script
+ // (".cmd"
+ // file).
+ public static int Validation_InvalidSubmissionFilter = -2147219900;
+ //
+ // Summary:
+ // A node that the job requests does not support the job's job type.
+ public static int Validation_JobAskedNodeMustContainJobType = -2147219953;
+ //
+ // Summary:
+ // The job is missing the user name or password.
+ public static int Validation_JobMissUsernameOrPassword = -2147219988;
+ //
+ // Summary:
+ // The list of requested nodes does not contain a valid node.
+ public static int Validation_JobRequestedNodesContainZeroValidNode = -2147219967;
+ //
+ // Summary:
+ // The job requires a node that is not available.
+ public static int Validation_JobRequiredNodeNotAvailable = -2147219954;
+ //
+ // Summary:
+ // The list of nodes that the task requires must be included in the list of
+ // the nodes that the job requested.
+ public static int Validation_JobRequiredNodeNotInJobAskedNodes = -2147219955;
+ //
+ // Summary:
+ // The maximum number of resource units must be greater than zero.
+ public static int Validation_MaxLessThanOne = -2147219933;
+ //
+ // Summary:
+ // The maximum number of resource units cannot be less than zero.
+ public static int Validation_MaxLessThanZero = -2147219959;
+ //
+ // Summary:
+ // You must specify the maximum number of resource units that the job
+ // requires
+ // if the Microsoft.Hpc.Scheduler.ISchedulerJob.AutoCalculateMax property is
+ // false.
+ public static int Validation_MaxNotSpecifiedWhenAutoCalcMaxIsFalse = -2147219961;
+ //
+ // Summary:
+ // You must specify a maximum resource value for the task.
+ public static int Validation_MaxUndefined = -2147219947;
+ //
+ // Summary:
+ // The minimum value must be less than the maximum value.
+ public static int Validation_MinGreaterThanMax = -2147219958;
+ //
+ // Summary:
+ // The minimum number of resource units must be greater than zero.
+ public static int Validation_MinLessThanOne = -2147219934;
+ //
+ // Summary:
+ // The minimum number of resource units cannot be less than zero.
+ public static int Validation_MinLessThanZero = -2147219960;
+ //
+ // Summary:
+ // You must specify the minimum number of resource units that the job
+ // requires
+ // if the Microsoft.Hpc.Scheduler.ISchedulerJob.AutoCalculateMin property is
+ // false.
+ public static int Validation_MinNotSpecifiedWhenAutoCalcMinIsFalse = -2147219962;
+ //
+ // Summary:
+ // You must specify a minimum resource value for the task.
+ public static int Validation_MinUndefined = -2147219948;
+ //
+ // Summary:
+ // The task must specify a command to run.
+ public static int Validation_MissCommandLine = -2147219952;
+ public static int Validation_MultipleNodePrepTasksPerJob = -2147219897;
+ public static int Validation_MultipleNodeReleaseTasksPerJob = -2147219896;
+ //
+ // Summary:
+ // The computed resources for the job is less than the required number of
+ // resources.
+ public static int Validation_NodeListSizeLessThanMin = -2147219957;
+ //
+ // Summary:
+ // The node does not exist in the cluster.
+ public static int Validation_NodeNotExist = -2147219965;
+ //
+ // Summary:
+ // The cluster does not contain a node that supports the specified resource
+ // requirements for the job (for example, memory or core requirements).
+ // Please
+ // adjust your requirements and submit the job again.
+ public static int Validation_NoNodeFulfillsTheSelectionCriteria = -2147219966;
+ public static int Validation_OnlyNodePrepOrReleaseTasksInJob = -2147219895;
+ //
+ // Summary:
+ // The parent job must be a service job.
+ public static int Validation_ParentJobMustBeServiceJob = -2147219911;
+ //
+ // Summary:
+ // The parent job is not valid.
+ public static int Validation_ParentJobNotValid = -2147219907;
+ //
+ // Summary:
+ // The job template does not exist.
+ public static int Validation_ProfileNotExist = -2147219977;
+ //
+ // Summary:
+ // The property value is not within the allowed range of values as specified
+ // by the job template.
+ public static int Validation_PropertyOutOfRange = -2147219978;
+ //
+ // Summary:
+ // A property that requires a value as specified by the job template has not
+ // been set.
+ public static int Validation_RequiredPropertyNotSet = -2147219981;
+ //
+ // Summary:
+ // A router job cannot be a child job.
+ public static int Validation_RouterJobMustBeChildJob = -2147219906;
+ //
+ // Summary:
+ // To reserve resources for a job (when the job does not contain tasks and
+ // has
+ // requested that it run until canceled), you must specify the maximum and
+ // minimum
+ // resource values for the job -you cannot request that the scheduler
+ // compute
+ // the maximum and minimum resource values.
+ public static int Validation_RunUntilCanceledButAutoMinMaxSet = -2147219963;
+ //
+ // Summary:
+ // To reserve resources for a job (when the job does not contain tasks and
+ // has
+ // requested that it run until canceled), you must specify the maximum and
+ // minimum
+ // resource values for the job.
+ public static int Validation_RunUntilCanceledButMinMaxNotSpecified = -2147219964;
+ //
+ // Summary:
+ // A service job cannot be a child job.
+ public static int Validation_ServiceJobMustNotBeChildJob = -2147219905;
+ public static int Validation_ServiceTaskIsNotAlone = -2147219887;
+ //
+ // Summary:
+ // Job submission failed because the job submission filter application could
+ // not be found. Your cluster administrator should check that the submission
+ // filter is accessible from the head node of the cluster and the path to
+ // the
+ // submission filter is a fully-qualified (not relative) path name.
+ public static int Validation_SubmissionFilterDoesNotExist = -2147219901;
+ //
+ // Summary:
+ // The job failed to pass the job submission filter specified in the
+ // SubmissionFilterProgram
+ // cluster parameter.
+ public static int Validation_SubmissionFilterFailed = -2147219902;
+ public static int Validation_SubmissionFilterInvalidJobTerm = -2147219883;
+ public static int Validation_SubmissionFilterTimeout = -2147219884;
+ public static int Validation_TargetResourceCountLessThanMin = -2147219888;
+ public static int Validation_TargetResourceCountMoreThanMax = -2147219889;
+ //
+ // Summary:
+ // The task must specify the same resource unit as the job.
+ public static int Validation_TaskAllocUnitNotSameWithJob = -2147219949;
+ //
+ // Summary:
+ // The dependency list for multiple tasks creates a circular dependency.
+ public static int Validation_TaskDependenciesContainCycle = -2147219931;
+ //
+ // Summary:
+ // The minimum and maximum resource requirements cannot be computed for a
+ // job
+ // with exclusive access to the nodes. You must specify the minimum and
+ // maximum
+ // resource values and resubmit the job.
+ public static int Validation_TaskExclusiveWhileJobAutoMinMaxEnabled = -2147219938;
+ //
+ // Summary:
+ // The task can run exclusively on a node only if the job specifies that it
+ // must run exclusively on the node.
+ public static int Validation_TaskExclusiveWhileJobNot = -2147219943;
+ //
+ // Summary:
+ // The task failed because the scheduler could not validate its parent job.
+ // Correct the validation error on the parent job and resubmit the job.
+ public static int Validation_TaskFailedOnJobValidationFault = -2147219936;
+ //
+ // Summary:
+ // The task specifies a list of dependent tasks but the task does not
+ // specify
+ // a name value for itself; each dependent task and the task specifying the
+ // dependency must include a name value.
+ public static int Validation_TaskHasDependOnButNoName = -2147219928;
+ //
+ // Summary:
+ // The task cannot specify required nodes when the job has requested that
+ // the
+ // scheduler compute the required resources.
+ public static int Validation_TaskHasRequiredNodesWhileJobAutoMinMaxEnabled = -2147219937;
+ //
+ // Summary:
+ // The increment value for a parametric task must be greater than or equal
+ // to
+ // 1.
+ public static int Validation_TaskIncrementValueLessThanZero = -2147219899;
+ //
+ // Summary:
+ // The start value for a parametric task cannot be greater than end value.
+ public static int Validation_TaskInvalidParametricSweep = -2147219898;
+ //
+ // Summary:
+ // The maximum resource value for the task must be less than that of the
+ // job.
+ public static int Validation_TaskMaxGreaterThanJobMax = -2147219945;
+ //
+ // Summary:
+ // The minimum resource value for the task must be less than that of the
+ // job.
+ public static int Validation_TaskMinGreaterThanJobMin = -2147219946;
+ //
+ // Summary:
+ // The minimum resource value for the task must be less than its maximum The
+ // minimum resource value for the task must be less than that of the job
+ // value.
+ public static int Validation_TaskMinGreaterThanTaskMax = -2147219944;
+ public static int Validation_TaskNodeReleaseDisabled = -2147219893;
+ public static int Validation_TaskNodeReleaseExceedsMaxRunTime = -2147219892;
+ //
+ // Summary:
+ // You have exceeded the number of times that a task can be queued again.
+ // The
+ // TaskRetryCount cluster parameter specifies the maximum number of times
+ // that
+ // a task can be queued again.
+ public static int Validation_TaskRequeuedTooManyTimes = -2147219951;
+ public static int Validation_TaskRequiredNodeNotAllocatedToRunningJob = -2147219885;
+ //
+ // Summary:
+ // The job requires a node that is not available.
+ public static int Validation_TaskRequiredNodeNotAvailable = -2147219940;
+ //
+ // Summary:
+ // The list of nodes that the task requires must be included in the list of
+ // the nodes that the job requested.
+ public static int Validation_TaskRequiredNodeNotInJobAskedNodes = -2147219942;
+ //
+ // Summary:
+ // The task specifies more required nodes than the job's specified maximum
+ // resource
+ // usage.
+ public static int Validation_TaskRequiredNodeOutOfJobMaximumResource = -2147219939;
+ //
+ // Summary:
+ // The run-time value for the task is greater than the length of time that
+ // the
+ // job is scheduled to remain running.
+ public static int Validation_TaskRuntimeGreaterThanJob = -2147219941;
+ public static int Validation_TaskTypeAddedInWrongJobState = -2147219891;
+ //
+ // Summary:
+ // The task failed validation.
+ public static int Validation_TaskValidationFailed = -2147219935;
+ public static int Validation_TooManyParametricInstances = -2147219890;
+ //
+ // Summary:
+ // You cannot queue the task again because the task is marked to run only
+ // one
+ // time.
+ public static int Validation_TryToRequeueNonRerunnableTask = -2147219950;
+ //
+ // Summary:
+ // The depends on list is ambiguous because multiple tasks specify the same
+ // name.
+ public static int Validation_TwoTasksWithSameNameDifferentGroup = -2147219932;
+ //
+ // Summary:
+ // An unexpected exception occurred while validating the job.
+ public static int Validation_UnexpectedExceptionWhenValidating = -2147219991;
+ public static int Validation_Unknown = -2147219990;
+ //
+ // Summary:
+ // An unexpected exception occurred while calling ETW.
+ public static int ERROR_INVALIDFLAG = -2147220001;
+ public static int ERROR_NULLMSG = -2147220002;
+ public static int ERROR_INVALIDMESSAGEID = -2147220003;
+ public static int ERROR_INVALIDDISPATCHID = -2147220004;
+ public static int ERROR_DLLNOTEXIST = -2147220005;
+ public static int ERROR_REGISTRATIONFAILED = -2147220006;
+ public static int ERROR_WRITEEVENTFAILED = -2147220007;
+
+ // Summary:
+ // Defines the category of errors into which the
+ // Microsoft.Hpc.Scheduler.Properties.ErrorCode
+ // codes are grouped.
+ public enum Category
+ {
+ // Summary:
+ // An error occurred while performing an operation (for example, the
+ // user tried
+ // to delete a job template but they do not have permissions to delete
+ // templates).
+ // This enumeration member represents a value of 0.
+ OperationError,
+ //
+ // Summary:
+ // The error occurred while validating the job or task before it ran.
+ // This enumeration
+ // member represents a value of 1.
+ ValidationError,
+ //
+ // Summary:
+ // The error occurred while assigning resources to the job or task. This
+ // enumeration
+ // member represents a value of 2.
+ ResourceAssignmentError,
+ //
+ // Summary:
+ // The error occurred while executing the job or task. This enumeration
+ // member
+ // represents a value of 3.
+ ExecutionError,
+ //
+ // Summary:
+ // Includes errors related to starting service or broker jobs. This
+ // enumeration
+ // member represents a value of 4.
+ Other,
+ }
+
+}
diff --git a/src/com/microsoft/hpc/scheduler/session/BrokerClient.java b/src/com/microsoft/hpc/scheduler/session/BrokerClient.java
index 9808871..b6e8cad 100644
--- a/src/com/microsoft/hpc/scheduler/session/BrokerClient.java
+++ b/src/com/microsoft/hpc/scheduler/session/BrokerClient.java
@@ -1,879 +1,977 @@
-//------------------------------------------------------------------------------
-//
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-
-package com.microsoft.hpc.scheduler.session;
-
-import java.net.SocketTimeoutException;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-import javax.xml.ws.Service;
-import javax.xml.ws.WebServiceException;
-
-import com.microsoft.hpc.BrokerClientStatus;
-
-/**
- * Used to communicate with the broker to send and receive messages
- *
- * @see #sendRequest(Object)
- * @see #endRequests()
- * @see #pullResponses(Class)
- */
-public class BrokerClient
-{
- /**
- * Store the count of the sent messages
- */
- private volatile AtomicInteger sendCount = new AtomicInteger();
-
- private volatile AtomicInteger uncommitCount = new AtomicInteger();
-
- // private CallbackManager callbackManager
- // Callbacks are not supported in Java
-
- // private int defaultResponsesTimeout = 60 * 1000;
- // PullResponses uses a built in timeout of 1 minute
-
- private volatile boolean isBrokerDown = false;
-
- /**
- * Reference to Controller client. Java Changes: Changed from
- * BrokerControllerClient. Implemented as IBrokerController in Java
- */
- private CxfBrokerControllerClient controllerClient;
-
- /**
- * Reference to the Session object passed to the client
- */
- private SessionBase session;
-
- /**
- * The string of the clientid
- */
- private String clientId;
-
- /**
- * Stores the scheme
- */
- private TransportScheme scheme;
-
- /**
- * Default timeout when waiting for new requests to reach broker
- */
- private int timeoutThrottlingMS = 60 * 1000;
-
- // The following fields are only necessary for the java implementation.
- /**
- * Specifies the default timeout for EOM call
- */
- final public int DEFAULT_TIMEOUT = 60000;
-
- // /
- // / Default timeout when waiting for new requests to reach broker
- // /
- final int defaultSendTimeout = 60 * 1000; // Default to 1 min
-
- /**
- * The client proxy to communicate to broker endpoint
- */
- private CxfBrokerClient client;
-
- /**
- * if we called endrequest
- */
- private boolean isEndRequest = false;
-
- /**
- * if this client is disposed
- */
- private boolean isDisposed = false;
-
- /**
- * Creates instances of the BrokerClient
- *
- * @param session
- * Session or DurableSession
- * @param service
- * Service class to instantiate
- */
- public BrokerClient(SessionBase session, Class service) {
- Utility.throwIfNull(session, "session");
-
- init(session, null, null, service);
- }
-
- /**
- * Creates instances of the BrokerClient
- *
- * @param clientid
- * String identity of the client
- * @param session
- * Session or DurableSession
- * @param service
- * Service class to instantiate
- */
- public BrokerClient(String clientid, SessionBase session,
- Class service) {
- Utility.throwIfNull(session, "session");
- Utility.throwIfNullOrEmpty(clientid, "clientid");
- Utility.throwIfTooLong(clientid.length(), "clientid", 128,
- SR.v("ClientIdTooLong"));
-
- init(session, null, clientid, service);
- }
-
- /**
- * Creates instances of the BrokerClient
- *
- * @param session
- * Session or DurableSession
- * @param bindingConfigName
- * Binding configuration to use to connect to broker
- * @param service
- * Service class to instantiate
- */
- public BrokerClient(SessionBase session, String bindingConfigName,
- Class service) {
- Utility.throwIfNull(session, "session");
-
- init(session, bindingConfigName, null, service);
- }
-
- /**
- * Creates instances of the BrokerClient
- *
- * @param clientid
- * String identity of the client
- * @param session
- * Session or DurableSession
- * @param bindingConfigName
- * Binding configuration to use to connect to the broker
- * @param service
- * Service class to instantiate
- */
- public BrokerClient(String clientid, SessionBase session,
- String bindingConfigName, Class service) {
- Utility.throwIfNull(session, "session");
- Utility.throwIfNullOrEmpty(clientid, "clientid");
- Utility.throwIfTooLong(clientid.length(), "clientid", 128,
- SR.v("ClientIdTooLong"));
-
- init(session, bindingConfigName, clientid, service);
- }
-
- /**
- * Initializes BrokerClient session
- *
- * @param session
- * Session or DurableSession
- * @param bindingConfigName
- * Binding configuration to use to connect to the broker
- * @param _clientId
- * String identity of the client
- * @param service
- * Service class to instantiate
- * @throws Exception
- */
- private void init(SessionBase session, String bindingConfigName,
- String _clientId, Class service) {
- // printSessionInfo(session.getInfo());
- if (_clientId == null) {
- clientId = "";
- } else {
- Utility.throwIfInvalidClientId(_clientId);
- clientId = _clientId;
- }
-
- this.session = session;
-
- String epr = session.getInfo().getBrokerEpr().getValue().getString()
- .get(1);
- client = new CxfBrokerClient(session._username,
- session._password, epr, service);
-
- controllerClient = CreateControllerClient(session);
-
- // Try to get the scheme from session info
- this.scheme = TransportScheme.valueOf((session.getInfo()
- .getTransportScheme().get(0)));
-
- // Set the scheme
- if (this.scheme != TransportScheme.Http) {
- throw new UnsupportedOperationException();
- }
-
- // If serviceOperationTimeout is specified, derive default timeouts for
- // EndRequest
- if (this.session.getInfo().getServiceOperationTimeout() != null
- && this.session.getInfo().getServiceOperationTimeout() > 0) {
- this.timeoutThrottlingMS = this.session.getInfo()
- .getServiceOperationTimeout();
- } else {
- this.timeoutThrottlingMS = Integer.MAX_VALUE;
- }
- client.setTimeout(this.timeoutThrottlingMS);
-
- sendCount.set(0);
- uncommitCount.set(0);
- }
-
- private CxfBrokerControllerClient CreateControllerClient(SessionBase session) {
- String controllerEpr = session.getInfo().getControllerEpr().getValue()
- .getString().get(1);
-
- if (session.getInfo().isSecure()) {
- return new CxfBrokerControllerClient(session._username,
- session._password, controllerEpr);
- } else {
- return new CxfBrokerControllerClient(null, null, controllerEpr);
- }
- }
-
- /**
- * Send typed message to broker
- *
- * @param
- * Typed message type
- * @param request
- * Typed message to send
- * @throws SessionException
- * @throws TimeoutException
- * @see {@link HpcJava#createRequest(Class, Object...)}
- */
- public void sendRequest(TMessage request)
- throws SessionException, SocketTimeoutException {
- sendRequest(request, "");
- }
-
- /**
- * Send typed messages with user data to broker
- *
- * @param
- * Typed message type
- * @param request
- * Typed message to send
- * @param userData
- * User data (will be converted to String because of Java
- * limitations)
- * @throws SessionException
- * @throws TimeoutException
- * @see {@link HpcJava#createRequest(Class, Object...)}
- */
- public void sendRequest(Object request, Object userData)
- throws SessionException, SocketTimeoutException {
- sendRequest(request, userData, defaultSendTimeout);
- }
-
- /**
- * Send typed messages with user data to broker
- *
- * @param
- * Typed message type
- * @param request
- * Typed message to send
- * @param userData
- * User data (will be converted to String because of Java
- * limitations)
- * @param timeout
- * send timeout
- * @throws SessionException
- * @throws TimeoutException
- * @see {@link HpcJava#createRequest(Class, Object...)}
- */
- public void sendRequest(Object request, Object userData, int timeout)
- throws SessionException, SocketTimeoutException {
- Utility.throwIfNull(request, "request");
- Utility.throwIfNull(userData, "userData");
- if (timeout < 0) {
- throw new IllegalArgumentException(SR.v("InvalidTimeout"));
- }
-
- if (isEndRequest)
- throw new IllegalStateException();
- if (isDisposed) {
- throw new IllegalStateException(SR.v("ClientAlreadyClosed"));
- }
-
- try {
- client.SendMessage(request, this.clientId, userData, timeout);
- sendCount.incrementAndGet();
- uncommitCount.incrementAndGet();
- } catch (WebServiceException we) {
- if (we.getCause().getClass() == SocketTimeoutException.class) {
- throw new SocketTimeoutException(SR.v("ClientTimeout"));
- } else {
- throw new SessionException(we);
- }
- }
- }
-
- /**
- * Send typed messages with user data to broker
- *
- * @param
- * Typed message type
- * @param request
- * Typed message to send
- * @param userData
- * User data (will be converted to String because of Java
- * limitations)
- * @param action
- * Action of typed message if type is ambiguous
- * @throws SessionException
- * @throws TimeoutException
- * @see {@link HpcJava#createRequest(Class, Object...)}
- */
- public void sendRequest(Object request, Object userData, String action)
- throws SessionException, SocketTimeoutException {
- sendRequest(request, userData, action, defaultSendTimeout);
- }
-
- /**
- * Send typed messages with user data to broker
- *
- * @param
- * Typed message type
- * @param request
- * Typed message to send
- * @param userData
- * User data (will be converted to String because of Java
- * limitations)
- * @param action
- * Action of typed message if type is ambiguous
- * @param timeout
- * send timeout
- * @throws SessionException
- * @throws TimeoutException
- * @see {@link HpcJava#createRequest(Class, Object...)}
- */
- public void sendRequest(Object request, Object userData, String action,
- int timeout) throws SessionException, SocketTimeoutException {
- Utility.throwIfNull(request, "request");
- Utility.throwIfNull(userData, "userData");
- Utility.throwIfNull(action, "action");
- if (timeout < 0) {
- throw new IllegalArgumentException(SR.v("InvalidTimeout"));
- }
-
- if (isEndRequest)
- throw new IllegalStateException();
- if (isDisposed) {
- throw new IllegalStateException(SR.v("ClientAlreadyClosed"));
- }
-
- try {
- client.SendMessage(request, this.clientId, userData, action,
- timeout);
- sendCount.incrementAndGet();
- uncommitCount.incrementAndGet();
- } catch (WebServiceException we) {
- if (we.getCause().getClass() == SocketTimeoutException.class) {
- throw new SocketTimeoutException(SR.v("ClientTimeout"));
- } else {
- throw new SessionException(we);
- }
- }
- }
-
- /**
- * Get the response from the server. the function will return an iterable
- * instance which can be used to do for each.
- *
- * the iterator is able to move next until it hits end of message flag.
- *
- * @param
- * @param message
- * @return
- * @throws SessionException
- *
- */
- public Iterable> getResponses(
- Class message) throws SessionException {
- return getResponses(message, 0);
- }
-
- /**
- * Get the response from the server. the function will return an iterable
- * instance which can be used to do for each.
- *
- * the iterator is able to move next until it hits end of message flag.
- *
- * @param
- * @param message
- * @return
- * @throws SessionException
- *
- */
- public Iterable> getResponses(
- Class message, int timeoutMilliseconds)
- throws SessionException {
- if (timeoutMilliseconds < 0) {
- throw new IllegalArgumentException(SR.v("InvalidTimeout"));
- }
-
- return new ResponseList>(message,
- CreateControllerClient(session),
- this.client.getRequestAction(message), this.clientId,
- timeoutMilliseconds);
- }
-
- /**
- * Get the response from the server. the function will return an iterable
- * instance which can be used to do for each.
- *
- * the iterator is able to move next until it hits end of message flag.
- *
- * @param
- * @param message
- * @return
- * @throws SessionException
- *
- */
- public Iterable> getResponses()
- throws SessionException {
- return getResponses(0);
- }
-
- /**
- * Get the response from the server. the function will return an iterable
- * instance which can be used to do for each.
- *
- * the iterator is able to move next until it hits end of message flag.
- *
- * @param
- * @param message
- * @return
- * @throws SessionException
- *
- */
- public Iterable> getResponses(int timeoutMilliseconds)
- throws SessionException {
- if (timeoutMilliseconds < 0) {
- throw new IllegalArgumentException(SR.v("InvalidTimeout"));
- }
-
- Map> t = this.client.getResponseTypeMapping();
- return new ResponseList>(t,
- CreateControllerClient(session), this.clientId,
- timeoutMilliseconds);
- }
-
- /**
- * Set the response handler to handle the response when it is arrived
- *
- * @param
- * @param message
- * @param responselistener
- */
- public void setResponseHandler(final Class message,
- final ResponseListener responselistener) {
- Utility.throwIfNull(responselistener, "responselistener");
- if (isDisposed) {
- throw new IllegalStateException(SR.v("ClientAlreadyClosed"));
- }
-
- Runnable runnable = new Runnable() {
- public void run() {
- Iterable> responses;
- try {
- responses = getResponses(message);
- for (BrokerResponse r : responses) {
- responselistener.responseReturned(r);
- }
- responselistener.endOfMessage();
- } catch (SessionException e) {
- responselistener.raiseError(e);
- } catch (RuntimeException e) {
- if (e.getCause() == null)
- responselistener.raiseError(e);
- else
- responselistener.raiseError((Exception)e.getCause());
- }
- }
- };
- Thread thread = new Thread(runnable);
- thread.start();
- }
-
- /**
- * Set the response handler to handle the response when it is arrived
- *
- * @param
- * @param message
- * @param responselistener
- */
- public void setResponseHandler(final Class message,
- final ResponseListener responselistener,
- final int timeoutMilliseconds) {
- Utility.throwIfNull(responselistener, "responselistener");
- if (timeoutMilliseconds < 0) {
- throw new IllegalArgumentException(SR.v("InvalidTimeout"));
- }
-
- if (isDisposed) {
- throw new IllegalStateException(SR.v("ClientAlreadyClosed"));
- }
-
- Runnable runnable = new Runnable() {
- public void run() {
- Iterable> responses;
- try {
- responses = getResponses(message, timeoutMilliseconds);
- for (BrokerResponse r : responses) {
- responselistener.responseReturned(r);
- }
- responselistener.endOfMessage();
- } catch (SessionException e) {
- responselistener.raiseError(e);
- } catch (RuntimeException e) {
- if (e.getCause() == null)
- responselistener.raiseError(e);
- else
- responselistener.raiseError((Exception) e.getCause());
- }
- }
- };
- Thread thread = new Thread(runnable);
- thread.start();
- }
-
- /**
- * Set the response handler to handle the response when it is arrived
- *
- * @param
- * @param message
- * @param responselistener
- */
- public void setResponseHandler(
- final ResponseListener
- *
- * @see com.microsoft.hpc.SessionStartInfo
- * @see com.microsoft.hpc.ObjectFactory
- * @see JAXBElement
- */
-public class SessionStartInfo
-{
- private static com.microsoft.hpc.ObjectFactory factory = new com.microsoft.hpc.ObjectFactory();
- private com.microsoft.hpc.SessionStartInfoContract contract = factory
- .createSessionStartInfoContract();
-
- private String headnode;
- private String username;
- private String password;
-
- /**
- * default constructor to set the default values
- */
- SessionStartInfo() {
- contract.setRuntime(-1);
- contract.setShareSession(false);
- contract.setSecure(true);
- contract.getTransportScheme().add("Http");
- }
-
- /**
- * Initializes an instance of the SessionStartInfo class with a parameter
- * for headnode, service, username, and password.
- *
- *
- * SessionStartInfo is initialized with the following default values:
- *
- *
- * TransportScheme = [Http];
- *
- *
- * Runtime = 3600; (seconds, == 1 hr)
- *
- *
- * ShareSession = false;
- *
- *
- * @param headnode
- * headnode you wish to connect to
- * @param service
- * service name you wish to use
- * @param username
- * username
- * @param password
- * password
- */
- public SessionStartInfo(String headnode, String service, String username,
- String password) {
- this();
-
- this.setHeadnode(headnode);
-
- // specify the default value.
- contract.setServiceName(factory
- .createSessionStartInfoContractServiceName(service));
-
- Utility.throwIfNullOrEmpty(username, "username");
- Utility.throwIfNull(password, "password");
-
- this.username = username;
- this.password = password;
-
- setRunAsUsername(this.username);
- setRunAsPassword(this.password);
- }
-
- /**
- * Initializes an instance of the SessionStartInfo class with a parameter
- * for headnode, service
- *
- *
- * SessionStartInfo is initialized with the following default values:
- *
- *
- * TransportScheme = [Http];
- *
- *
- * Runtime = 3600; (seconds, == 1 hr)
- *
- *
- * ShareSession = false;
- *
- *
- * Username = HpcJava.user
- *
- *
- * Password = HpcJava.pass
- *
- *
- * @param headnode
- * headnode you wish to connect to
- * @param service
- * service name you wish to use
- * @see HpcJava#setUsernamePassword(String, String)
- */
- public SessionStartInfo(String headnode, String service) {
- this(headnode, service, HpcJava.getUsername(), HpcJava.getPassword());
- }
-
- /**
- * Initializes an instance of the SessionStartInfo class with a parameter
- * for headnode, service
- *
- * @param headnode
- * @param service
- * @param serviceVersion
- */
- public SessionStartInfo(String headnode, String service,
- Version serviceVersion) {
- this(headnode, service, serviceVersion, HpcJava.getUsername(), HpcJava
- .getPassword());
- }
-
- /**
- * Initializes an instance of the SessionStartInfo class with a parameter
- * for headnode, service
- *
- *
- * SessionStartInfo is initialized with the following default values:
- *
- *
- * TransportScheme = [Http];
- *
- *
- * Runtime = 3600; (seconds, == 1 hr)
- *
- *
- * ShareSession = false;
- *
- *
- * Username = HpcJava.user
- *
- *
- * Password = HpcJava.pass
- *
- *
- * @param headnode
- * headnode you wish to connect to
- * @param service
- * service name you wish to use
- * @param serviceVersion
- * the service version you wish to use
- * @see HpcJava#setUsernamePassword(String, String)
- */
- public SessionStartInfo(String headnode, String service,
- Version serviceVersion, String username, String password) {
- this();
-
- this.setHeadnode(headnode);
-
- contract.setServiceName(factory
- .createSessionStartInfoContractServiceName(service));
-
- org.datacontract.schemas._2004._07.system.Version ver = new org.datacontract.schemas._2004._07.system.Version();
-
- ver.setMajor(serviceVersion.getMajor());
- ver.setMinor(serviceVersion.getMinor());
- ver.setBuild(serviceVersion.getBuild());
- ver.setRevision(serviceVersion.getRevision());
-
- contract.setServiceVersion(factory
- .createSessionStartInfoContractServiceVersion(ver));
-
- Utility.throwIfNullOrEmpty(username, "username");
- Utility.throwIfNull(password, "password");
-
- this.username = username;
- this.password = password;
- setRunAsUsername(this.username);
- setRunAsPassword(this.password);
- }
-
- /**
- * Gets the headnode value
- *
- * @return headnode value
- */
- public String getHeadnode() {
- return headnode;
- }
-
- /**
- * Gets the Job Template
- *
- * @return JobTemplate value
- */
- public String getJobTemplate() {
- if (contract.getJobTemplate() == null)
- return "Default";
- return contract.getJobTemplate().getValue();
- }
-
- /**
- * Gets the number of maximum units (cores) to allocate
- *
- * @return maximumUnits value
- */
- public Integer getMaxUnits() {
- if (contract.getMaxUnits() == null)
- return 0;
- return contract.getMaxUnits().getValue();
- }
-
- /**
- * Gets the number of minimum units (cores) to allocate
- *
- * @return minUnits value
- */
- public Integer getMinUnits() {
- if (contract.getMinUnits() == null)
- return 0;
- return contract.getMinUnits().getValue();
- }
-
- /**
- * Gets the node group string
- *
- * @return NodeGroupsStr value
- */
- public String getNodeGroups() {
- if (contract.getNodeGroupsStr() == null)
- return null;
- return contract.getNodeGroupsStr().getValue();
- }
-
- /**
- * Gets the plain text password value to be passed over SSL
- *
- * @return plain text password value
- */
- String getPassword() {
- return this.password;
- }
-
- /**
- * Gets the priority of the job
- *
- * @return priority value
- */
- public Integer getPriority() {
- if (contract.getPriority() == null)
- return 0;
- return contract.getPriority().getValue();
- }
-
- /**
- * gets the requested nodes string
- *
- * @return RequestedNodesStr value
- */
- public String getRequestedNodesStr() {
- if (contract.getRequestedNodesStr() == null)
- return null;
- return contract.getRequestedNodesStr().getValue();
- }
-
- /**
- * Gets the maximum runtime length in seconds
- *
- * @return Runtime value in seconds
- */
- public Integer getRuntime() {
- int time = contract.getRuntime();
- return time == -1 ? 0 : time;
- }
-
- /**
- * Gets the Service Job Name (name of the job is different from service)
- *
- * @return ServiceJobName value
- */
- public String getServiceJobName() {
- if (contract.getServiceJobName() == null)
- return null;
- return contract.getServiceJobName().getValue();
- }
-
- /**
- * Gets the Service name
- *
- * @return ServiceName value
- */
- public String getServiceName() {
- return contract.getServiceName().getValue();
- }
-
- /**
- * Gets the transport Scheme
- *
- * @return a list of TranportSchemes
- */
- public List getTransportScheme() {
- return contract.getTransportScheme();
- }
-
- /**
- * Gets the username
- *
- * @return username value
- */
- public String getUsername() {
- return this.username;
- }
-
- /**
- * Sets the headnode to connect to
- *
- * @param headnode
- * headnode to connect
- */
- void setHeadnode(String headnode) {
- this.headnode = headnode;
- }
-
- /**
- * Sets the job template
- *
- * @param template
- * Job template to use
- */
- public void setJobTemplate(String template) {
- contract.setJobTemplate(factory
- .createSessionStartInfoContractJobTemplate(template));
- }
-
- /**
- * Sets the maximum units (cores) to allocate
- *
- * @param maximumUnits
- * minimum number of cores to allocate
- */
- public void setMaxUnits(Integer maximumUnits) {
- contract.setMaxUnits(factory
- .createSessionStartInfoContractMaxUnits(maximumUnits));
- }
-
- /**
- * Sets the minimum units (cores) to allocate
- *
- * @param MinUnits
- * minimum number of cores to allocate
- */
- public void setMinUnits(Integer minUnits) {
- contract.setMinUnits(factory
- .createSessionStartInfoContractMinUnits(minUnits));
- }
-
- /**
- * Sets the node groups to use
- *
- * @param nodeGroups
- * node groups string
- */
- public void setNodeGroupsStr(String nodeGroups) {
- contract.setNodeGroupsStr(factory
- .createSessionStartInfoContractNodeGroupsStr(nodeGroups));
- }
-
- /**
- * Sets the password in plain text to be sent over SSL
- *
- * @param password
- * password in plain text
- */
- public void setRunAsPassword(String password) {
- contract.setPassword(factory
- .createSessionStartInfoContractPassword(password));
- }
-
- /**
- * Sets the priority of the job
- *
- * @param priority
- * Priority value
- */
- public void setPriority(Integer priority) {
- contract.setPriority(factory
- .createSessionStartInfoContractPriority(priority));
- }
-
- /**
- * Sets the project value
- *
- * @param project
- * Project value
- */
- public void setServiceJobProject(String project) {
- contract.setServiceJobProject(factory
- .createSessionStartInfoContractServiceJobProject(project));
- }
-
- /**
- * Get service job project property
- *
- * @return
- */
- public String getServiceJobProject() {
- if (contract.getServiceJobProject() != null)
- return contract.getServiceJobProject().getValue();
- else
- return null;
- }
-
- /**
- * Sets the requested nodes string
- *
- * @param nodes
- * requestedNodes string
- */
- public void setRequestedNodesStr(String nodes) {
- contract.setRequestedNodesStr(factory
- .createSessionStartInfoContractRequestedNodesStr(nodes));
- }
-
- /**
- * Sets the resourceUnit type
- *
- * @param unit
- * JobUnitType enum
- */
- public void setResourceUnitType(SessionUnitType unit) {
- contract.setResourceUnitType(factory
- .createSessionStartInfoContractResourceUnitType(unit.ordinal()));
- }
-
- /**
- * Sets the job runtime in seconds
- *
- * @param runtime
- * in seconds
- */
- public void setRuntime(Integer runtime) {
- if (runtime == 0)
- contract.setRuntime(-1);
- contract.setRuntime(runtime);
- }
-
- /**
- * Sets the jobname
- *
- * @param jobname
- * name of the job
- */
- public void setServiceJobName(String jobname) {
- contract.setServiceJobName(factory
- .createSessionStartInfoContractServiceJobName(jobname));
- }
-
- /**
- * Sets the service name to use
- *
- * @param servicename
- * name of the service
- */
- public void setServiceName(String servicename) {
- contract.setServiceName(factory
- .createSessionStartInfoContractServiceName(servicename));
- }
-
- /**
- * Sets the username to Run the job
- *
- * @param username
- * username
- */
- public void setRunAsUsername(String username) {
- contract.setUsername(factory
- .createSessionStartInfoContractUsername(username));
- }
-
- /**
- * Get the runas user name. if it doesn't set before, the username will be returned.
- * @return
- */
- public String getRunAsUsername() {
- return contract.getUsername().getValue();
- }
-
- /**
- * Returns the allocation grow load ratio threshold
- *
- * @return AllocationGrowLoadRatioThreshold value
- * @see #allocationShrinkLoadRatioThreshold()
- */
- public int getAllocationGrowLoadRatioThreshold() {
- if (contract.getAllocationGrowLoadRatioThreshold() == null)
- return 0;
- return contract.getAllocationGrowLoadRatioThreshold().getValue();
- }
-
- /**
- * Returns the allocation shrink load ratio threshold
- *
- * @return AllocationShrinkLoadRatioThreshold value
- */
- public int getAllocationShrinkLoadRatioThreshold() {
- if (contract.getAllocationShrinkLoadRatioThreshold() == null)
- return 0;
- return contract.getAllocationShrinkLoadRatioThreshold().getValue();
- }
-
- /**
- * Returns the client idle timeout
- *
- * @return ClientIdleTimeout value
- */
- public int clientIdleTimeout() {
- if (contract.getClientIdleTimeout() == null)
- return 0;
- return contract.getClientIdleTimeout().getValue();
- }
-
- /**
- * Returns messages throttle start threshold
- *
- * @return MessagesThrottleStartThreshold value
- */
- public int messagesThrottleStartThreshold() {
- if (contract.getMessagesThrottleStartThreshold() == null)
- return 0;
- return contract.getMessagesThrottleStartThreshold().getValue();
- }
-
- /**
- * Returns the messages throttle stop threshold
- *
- * @return MessagesThrottleStopThreshold value
- */
- public int messagesThrottleStopThreshold() {
- if (contract.getMessagesThrottleStopThreshold() == null)
- return 0;
- return contract.getMessagesThrottleStopThreshold().getValue();
- }
-
- /**
- * Returns the session idle timeout
- *
- * @return SessionIdleTimeout value
- */
- public int sessionIdleTimeout() {
- if (contract.getSessionIdleTimeout() == null)
- return 0;
- return contract.getSessionIdleTimeout().getValue();
- }
-
- /**
- * Sets the allocation grow load ratio threshold
- *
- * @param value
- * This value must be greater than or equal to
- * AllocationShrinkLoadRatioThreshold
- * @see #allocationShrinkLoadRatioThreshold()
- */
- public void setAllocationGrowLoadRatioThreshold(int value) {
- contract.setAllocationGrowLoadRatioThreshold(factory
- .createSessionStartInfoContractAllocationGrowLoadRatioThreshold(value));
- }
-
- /**
- * Sets the allocation shrink load ratio threshold
- *
- * @param value
- * This value must be less than or equal to
- * AllocationGrowLoadRatioThreshold
- * @see #allocationGrowLoadRatioThreshold()
- */
- public void setAllocationShrinkLoadRatioThreshold(int value) {
- contract.setAllocationShrinkLoadRatioThreshold(factory
- .createSessionStartInfoContractAllocationShrinkLoadRatioThreshold(value));
- }
-
- /**
- * Sets the client idle timeout
- *
- * @param value
- * The value must be greater than zero
- */
- public void setClientIdleTimeout(int value) {
- contract.setClientIdleTimeout(factory
- .createSessionStartInfoContractClientIdleTimeout(value));
- }
-
- /**
- * Sets the messages throttle start threshold
- *
- * @param value
- * The value must be less than or greater than
- * MessagesThrottleStopThreshold
- * @see #messagesThrottleStopThreshold()
- */
- public void setMessagesThrottleStartThreshold(int value) {
- contract.setMessagesThrottleStartThreshold(factory
- .createSessionStartInfoContractMessagesThrottleStartThreshold(value));
- }
-
- /**
- * Sets the messages throttle stop threshold
- *
- * @param value
- * The value must be greater than or less than
- * MessagesThrottleStartThreshold
- * @see #messagesThrottleStartThreshold()
- */
- public void setMessagesThrottleStopThreshold(int value) {
- contract.setMessagesThrottleStopThreshold(factory
- .createSessionStartInfoContractMessagesThrottleStopThreshold(value));
- }
-
- /**
- * Sets the session idle timeout
- *
- * @param value
- * This value must greater than zero
- */
- public void setSessionIdleTimeout(int value) {
- contract.setSessionIdleTimeout(factory
- .createSessionStartInfoContractSessionIdleTimeout(value));
- }
-
- /**
- * Convert to CXF sessionStartInfo. This method is internal use.
- *
- * @return
- */
- public SessionStartInfoContract GetContractInfo() {
- return this.contract;
- }
-
- public void Validate() {
- if (contract.getServiceName() == null) {
- throw new IllegalArgumentException(SR.v("ServiceNameCantBeNull"));
- }
- if (contract.getClientIdleTimeout() != null
- && contract.getClientIdleTimeout().getValue() <= 0) {
- throw new IllegalArgumentException(
- SR.v("ClientIdleTimeoutNotNegative"));
- }
- if (contract.getSessionIdleTimeout() != null
- && contract.getSessionIdleTimeout().getValue() < 0) {
- throw new IllegalArgumentException(
- SR.v("SessionIdleTimeoutNotNegative"));
- }
- if (contract.getMessagesThrottleStopThreshold() != null
- && contract.getMessagesThrottleStopThreshold().getValue() < 0) {
- throw new IllegalArgumentException(
- SR.v("MessageThrottleStopThresholdPositive"));
- }
- if (contract.getMessagesThrottleStopThreshold() != null
- && (contract.getMessagesThrottleStartThreshold() == null || contract
- .getMessagesThrottleStartThreshold().getValue() <= contract
- .getMessagesThrottleStopThreshold().getValue())) {
- throw new IllegalArgumentException(
- SR.v("MessageThrottleStartGreaterStop"));
- }
- if (contract.getMessagesThrottleStartThreshold() != null
- && contract.getMessagesThrottleStartThreshold().getValue() < 0) {
- throw new IllegalArgumentException(
- SR.v("MessageThrottleStartGreaterStop"));
- }
- if (contract.getAllocationShrinkLoadRatioThreshold() != null
- && contract.getAllocationShrinkLoadRatioThreshold().getValue() < 0) {
- throw new IllegalArgumentException(
- SR.v("AllocationShrinkLoadRatioThresholdNonNegative"));
- }
- if (contract.getAllocationShrinkLoadRatioThreshold() != null
- && (contract.getAllocationGrowLoadRatioThreshold() == null || contract
- .getAllocationGrowLoadRatioThreshold().getValue() <= contract
- .getAllocationShrinkLoadRatioThreshold().getValue())) {
- throw new IllegalArgumentException(
- SR.v("LoadRatioGrowGreaterThanShrink"));
- }
- if(this.isUseSessionPool() && !this.isShareSession()) {
- throw new IllegalArgumentException(SR.v("UnsharedSession_NotSupportSessionPool"));
- }
- }
-
- /**
- * Set the service version
- *
- * @param serviceVersion
- */
- public void setServiceVersion(Version serviceVersion) {
- if (serviceVersion == null) {
- contract.setServiceVersion(null);
- return;
- }
-
- org.datacontract.schemas._2004._07.system.Version ver = new org.datacontract.schemas._2004._07.system.Version();
-
- ver.setMajor(serviceVersion.getMajor());
- ver.setMinor(serviceVersion.getMinor());
- ver.setBuild(serviceVersion.getBuild());
- ver.setRevision(serviceVersion.getRevision());
-
- contract.setServiceVersion(factory
- .createSessionStartInfoContractServiceVersion(ver));
-
- }
-
- /*
- * Get the service version. If not set, return null.
- */
- public Version getServiceVersion() {
- JAXBElement ver = contract
- .getServiceVersion();
-
- if (ver != null) {
- org.datacontract.schemas._2004._07.system.Version version = ver
- .getValue();
- return new Version(version.getMajor(), version.getMinor(),
- version.getRevision(), version.getBuild());
- }
-
- return null;
- }
-
- /**
- * check if the session is secured
- *
- * @return
- */
- public Boolean isSecure() {
- return contract.isSecure();
- }
-
- /**
- * Check if the session is shared
- *
- * @return
- */
- public Boolean isShareSession() {
- if(contract.isShareSession() == null) {
- return false;
- }
- else {
- return contract.isShareSession();
- }
- }
-
- /**
- * set if the session is secure
- *
- * @param value
- */
- public void setSecure(Boolean value) {
- contract.setSecure(value);
- }
-
- /**
- * set if the session is shared
- *
- * @param value
- */
- public void setShareSession(Boolean value) {
- contract.setShareSession(value);
- }
-
- /**
- * get the resource unit type
- *
- * @return
- */
- public SessionUnitType getResourceUnitType() {
- if (contract.getResourceUnitType() != null) {
-
- switch (contract.getResourceUnitType().getValue()) {
- case 0:
- return SessionUnitType.Core;
- case 1:
- return SessionUnitType.Socket;
- case 2:
- return SessionUnitType.Node;
- }
- }
- return SessionUnitType.Core;
- }
-
- /**
- * Set if the service job is preemptable
- *
- * @param value
- */
- public void setPreemptive(boolean value) {
- contract.setCanPreempt(factory
- .createSessionStartInfoContractCanPreempt(value));
- }
-
- /**
- * if the service job is preemptable
- *
- * @return
- */
- public boolean isPreemptive() {
- if (contract.getCanPreempt() == null)
- return false;
- return contract.getCanPreempt().getValue();
- }
-
- /**
- * Add one job environment variable
- *
- * @param name
- * @param value
- */
- public void addEnvironment(String name, String value) {
- ArrayOfKeyValueOfstringstring envs;
- if (contract.getEnvironments() == null)
- envs = new ArrayOfKeyValueOfstringstring();
- else
- envs = contract.getEnvironments().getValue();
- KeyValueOfstringstring v = new KeyValueOfstringstring();
- v.setKey(name);
- v.setValue(value);
- envs.getKeyValueOfstringstring().add(v);
- contract.setEnvironments(factory
- .createSessionStartInfoContractEnvironments(envs));
- }
-
- /**
- * Get the list of environments
- *
- * @return
- */
- public HashMap getEnvironments() {
- HashMap result = new HashMap();
- ArrayOfKeyValueOfstringstring list;
- if (contract.getEnvironments() != null) {
- list = contract.getEnvironments().getValue();
- for (KeyValueOfstringstring s : list.getKeyValueOfstringstring()) {
- result.put(s.getKey(), s.getValue());
- }
- }
-
- return result;
- }
-
- /**
- * if the session uses session pool
- * @return
- */
- public Boolean isUseSessionPool()
- {
- if(contract.isUseSessionPool() == null) {
- return false;
- }
- else {
- return contract.isUseSessionPool();
- }
- }
-
- /**
- * Set if the session uses session pool
- * @param value
- */
- public void setUseSessionPool(Boolean value)
- {
- contract.setUseSessionPool(value);
- }
-}
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// SessionStart Info class
+//
+//------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.scheduler.session;
+
+import java.util.HashMap;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import com.microsoft.hpc.SessionStartInfoContract;
+import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring;
+import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring.KeyValueOfstringstring;
+
+/**
+ * This class includes the parameters for modifying
+ * SessionStartInfo for a session.
+ *
+ *
+ * Subclass of com.microsoft.hpc.SessionStartInfo designed to be a
+ * simplified version that does not use ObjectFactories for the JAXBElements
+ * needed for Java SOA.
+ *
+ *
+ * the use of this class is required as it contains the headnode variable, while
+ * the SessionStartInfo in
+ * com.microsoft.hpc.SessionStartInfo does not and should not be
+ * used (ie. import com.microsoft.hpc.SessionStartInfo; should
+ * NEVER be called explicitly).
+ *
+ * @see com.microsoft.hpc.SessionStartInfo
+ * @see com.microsoft.hpc.ObjectFactory
+ * @see JAXBElement
+ */
+public class SessionStartInfo
+{
+ private static com.microsoft.hpc.ObjectFactory factory = new com.microsoft.hpc.ObjectFactory();
+ private com.microsoft.hpc.SessionStartInfoContract contract = factory
+ .createSessionStartInfoContract();
+
+ private String headnode;
+ private String username;
+ private String password;
+
+ /**
+ * default constructor to set the default values
+ */
+ SessionStartInfo() {
+ contract.setRuntime(-1);
+ contract.setShareSession(false);
+ contract.setSecure(true);
+ contract.getTransportScheme().add("Http");
+ }
+
+ /**
+ * Initializes an instance of the SessionStartInfo class with a parameter
+ * for headnode, service, username, and password.
+ *
+ *
+ * SessionStartInfo is initialized with the following default values:
+ *
+ *
+ * TransportScheme = [Http];
+ *
+ *
+ * Runtime = 3600; (seconds, == 1 hr)
+ *
+ *
+ * ShareSession = false;
+ *
+ *
+ * @param headnode
+ * headnode you wish to connect to
+ * @param service
+ * service name you wish to use
+ * @param username
+ * username
+ * @param password
+ * password
+ */
+ public SessionStartInfo(String headnode, String service, String username,
+ String password) {
+ this();
+
+ this.setHeadnode(headnode);
+
+ // specify the default value.
+ contract.setServiceName(factory
+ .createSessionStartInfoContractServiceName(service));
+
+ Utility.throwIfNullOrEmpty(username, "username");
+ Utility.throwIfNull(password, "password");
+
+ this.username = username;
+ this.password = password;
+
+ setRunAsUsername(this.username);
+ setRunAsPassword(this.password);
+ }
+
+ /**
+ * Initializes an instance of the SessionStartInfo class with a parameter
+ * for headnode, service
+ *
+ *
+ * SessionStartInfo is initialized with the following default values:
+ *
+ *
+ * TransportScheme = [Http];
+ *
+ *
+ * Runtime = 3600; (seconds, == 1 hr)
+ *
+ *
+ * ShareSession = false;
+ *
+ *
+ * Username = HpcJava.user
+ *
+ *
+ * Password = HpcJava.pass
+ *
+ *
+ * @param headnode
+ * headnode you wish to connect to
+ * @param service
+ * service name you wish to use
+ * @see HpcJava#setUsernamePassword(String, String)
+ */
+ public SessionStartInfo(String headnode, String service) {
+ this(headnode, service, HpcJava.getUsername(), HpcJava.getPassword());
+ }
+
+ /**
+ * Initializes an instance of the SessionStartInfo class with a parameter
+ * for headnode, service
+ *
+ * @param headnode
+ * @param service
+ * @param serviceVersion
+ */
+ public SessionStartInfo(String headnode, String service,
+ Version serviceVersion) {
+ this(headnode, service, serviceVersion, HpcJava.getUsername(), HpcJava
+ .getPassword());
+ }
+
+ /**
+ * Initializes an instance of the SessionStartInfo class with a parameter
+ * for headnode, service
+ *
+ *
+ * SessionStartInfo is initialized with the following default values:
+ *
+ *
+ * TransportScheme = [Http];
+ *
+ *
+ * Runtime = 3600; (seconds, == 1 hr)
+ *
+ *
+ * ShareSession = false;
+ *
+ *
+ * Username = HpcJava.user
+ *
+ *
+ * Password = HpcJava.pass
+ *
+ *
+ * @param headnode
+ * headnode you wish to connect to
+ * @param service
+ * service name you wish to use
+ * @param serviceVersion
+ * the service version you wish to use
+ * @see HpcJava#setUsernamePassword(String, String)
+ */
+ public SessionStartInfo(String headnode, String service,
+ Version serviceVersion, String username, String password) {
+ this();
+
+ this.setHeadnode(headnode);
+
+ contract.setServiceName(factory
+ .createSessionStartInfoContractServiceName(service));
+
+ org.datacontract.schemas._2004._07.system.Version ver = new org.datacontract.schemas._2004._07.system.Version();
+
+ ver.setMajor(serviceVersion.getMajor());
+ ver.setMinor(serviceVersion.getMinor());
+ ver.setBuild(serviceVersion.getBuild());
+ ver.setRevision(serviceVersion.getRevision());
+
+ contract.setServiceVersion(factory
+ .createSessionStartInfoContractServiceVersion(ver));
+
+ Utility.throwIfNullOrEmpty(username, "username");
+ Utility.throwIfNull(password, "password");
+
+ this.username = username;
+ this.password = password;
+ setRunAsUsername(this.username);
+ setRunAsPassword(this.password);
+ }
+
+ /**
+ * Gets the headnode value
+ *
+ * @return headnode value
+ */
+ public String getHeadnode() {
+ return headnode;
+ }
+
+ /**
+ * Gets the Job Template
+ *
+ * @return JobTemplate value
+ */
+ public String getJobTemplate() {
+ if (contract.getJobTemplate() == null)
+ return "Default";
+ return contract.getJobTemplate().getValue();
+ }
+
+ /**
+ * Gets the number of maximum units (cores) to allocate
+ *
+ * @return maximumUnits value
+ */
+ public Integer getMaxUnits() {
+ if (contract.getMaxUnits() == null)
+ return 0;
+ return contract.getMaxUnits().getValue();
+ }
+
+ /**
+ * Gets the number of minimum units (cores) to allocate
+ *
+ * @return minUnits value
+ */
+ public Integer getMinUnits() {
+ if (contract.getMinUnits() == null)
+ return 0;
+ return contract.getMinUnits().getValue();
+ }
+
+ /**
+ * Gets the node group string
+ *
+ * @return NodeGroupsStr value
+ */
+ public String getNodeGroups() {
+ if (contract.getNodeGroupsStr() == null)
+ return null;
+ return contract.getNodeGroupsStr().getValue();
+ }
+
+ /**
+ * Gets the plain text password value to be passed over SSL
+ *
+ * @return plain text password value
+ */
+ String getPassword() {
+ return this.password;
+ }
+
+ /**
+ * Gets the priority of the job
+ *
+ * @return priority value
+ */
+ public Integer getPriority() {
+ if (contract.getPriority() == null)
+ return 0;
+ return contract.getPriority().getValue();
+ }
+
+ /**
+ * Gets the session priority of the job
+ *
+ * @return priority value
+ */
+ public Integer getSessionPriority() {
+ if (contract.getExtendedPriority() == null)
+ return 0;
+ return contract.getExtendedPriority().getValue();
+ }
+
+ /**
+ * gets the requested nodes string
+ *
+ * @return RequestedNodesStr value
+ */
+ public String getRequestedNodesStr() {
+ if (contract.getRequestedNodesStr() == null)
+ return null;
+ return contract.getRequestedNodesStr().getValue();
+ }
+
+ /**
+ * Gets the maximum runtime length in seconds
+ *
+ * @return Runtime value in seconds
+ */
+ public Integer getRuntime() {
+ int time = contract.getRuntime();
+ return time == -1 ? 0 : time;
+ }
+
+ /**
+ * Gets the Service Job Name (name of the job is different from service)
+ *
+ * @return ServiceJobName value
+ */
+ public String getServiceJobName() {
+ if (contract.getServiceJobName() == null)
+ return null;
+ return contract.getServiceJobName().getValue();
+ }
+
+ /**
+ * Gets the Service name
+ *
+ * @return ServiceName value
+ */
+ public String getServiceName() {
+ return contract.getServiceName().getValue();
+ }
+
+ /**
+ * Gets the transport Scheme
+ *
+ * @return a list of TranportSchemes
+ */
+ public List getTransportScheme() {
+ return contract.getTransportScheme();
+ }
+
+ public void setTransportScheme(String transportScheme) {
+ contract.getTransportScheme().clear();
+ contract.getTransportScheme().add(transportScheme);
+ }
+
+ /**
+ * Gets the username
+ *
+ * @return username value
+ */
+ public String getUsername() {
+ return this.username;
+ }
+
+ /**
+ * Sets the headnode to connect to
+ *
+ * @param headnode
+ * headnode to connect
+ */
+ void setHeadnode(String headnode) {
+ this.headnode = headnode;
+ }
+
+ /**
+ * Sets the job template
+ *
+ * @param template
+ * Job template to use
+ */
+ public void setJobTemplate(String template) {
+ contract.setJobTemplate(factory
+ .createSessionStartInfoContractJobTemplate(template));
+ }
+
+ /**
+ * Sets the maximum units (cores) to allocate
+ *
+ * @param maximumUnits
+ * minimum number of cores to allocate
+ */
+ public void setMaxUnits(Integer maximumUnits) {
+ contract.setMaxUnits(factory
+ .createSessionStartInfoContractMaxUnits(maximumUnits));
+ }
+
+ /**
+ * Sets the minimum units (cores) to allocate
+ *
+ * @param MinUnits
+ * minimum number of cores to allocate
+ */
+ public void setMinUnits(Integer minUnits) {
+ contract.setMinUnits(factory
+ .createSessionStartInfoContractMinUnits(minUnits));
+ }
+
+ /**
+ * Sets the node groups to use
+ *
+ * @param nodeGroups
+ * node groups string
+ */
+ public void setNodeGroupsStr(String nodeGroups) {
+ contract.setNodeGroupsStr(factory
+ .createSessionStartInfoContractNodeGroupsStr(nodeGroups));
+ }
+
+ /**
+ * Sets the password in plain text to be sent over SSL
+ *
+ * @param password
+ * password in plain text
+ */
+ public void setRunAsPassword(String password) {
+ contract.setPassword(factory
+ .createSessionStartInfoContractPassword(password));
+ }
+
+ /**
+ * Sets the priority of the job
+ *
+ * @param priority
+ * Priority value
+ */
+ public void setPriority(Integer priority) {
+ contract.setPriority(factory
+ .createSessionStartInfoContractPriority(priority));
+ }
+
+ /**
+ * Sets the session priority of the job
+ *
+ * @param priority
+ * Priority value
+ */
+ public void setSessionPriority(Integer priority) {
+ contract.setExtendedPriority(factory
+ .createSessionStartInfoContractExtendedPriority(priority));
+ }
+
+ /**
+ * Sets the project value
+ *
+ * @param project
+ * Project value
+ */
+ public void setServiceJobProject(String project) {
+ contract.setServiceJobProject(factory
+ .createSessionStartInfoContractServiceJobProject(project));
+ }
+
+ /**
+ * Get service job project property
+ *
+ * @return
+ */
+ public String getServiceJobProject() {
+ if (contract.getServiceJobProject() != null)
+ return contract.getServiceJobProject().getValue();
+ else
+ return null;
+ }
+
+ /**
+ * Sets the requested nodes string
+ *
+ * @param nodes
+ * requestedNodes string
+ */
+ public void setRequestedNodesStr(String nodes) {
+ contract.setRequestedNodesStr(factory
+ .createSessionStartInfoContractRequestedNodesStr(nodes));
+ }
+
+ /**
+ * Sets the resourceUnit type
+ *
+ * @param unit
+ * JobUnitType enum
+ */
+ public void setResourceUnitType(SessionUnitType unit) {
+ contract.setResourceUnitType(factory
+ .createSessionStartInfoContractResourceUnitType(unit.ordinal()));
+ }
+
+ /**
+ * Sets the job runtime in seconds
+ *
+ * @param runtime
+ * in seconds
+ */
+ public void setRuntime(Integer runtime) {
+ if (runtime == 0)
+ contract.setRuntime(-1);
+ contract.setRuntime(runtime);
+ }
+
+ /**
+ * Sets the jobname
+ *
+ * @param jobname
+ * name of the job
+ */
+ public void setServiceJobName(String jobname) {
+ contract.setServiceJobName(factory
+ .createSessionStartInfoContractServiceJobName(jobname));
+ }
+
+ /**
+ * Sets the service name to use
+ *
+ * @param servicename
+ * name of the service
+ */
+ public void setServiceName(String servicename) {
+ contract.setServiceName(factory
+ .createSessionStartInfoContractServiceName(servicename));
+ }
+
+ /**
+ * Sets the username to Run the job
+ *
+ * @param username
+ * username
+ */
+ public void setRunAsUsername(String username) {
+ contract.setUsername(factory
+ .createSessionStartInfoContractUsername(username));
+ }
+
+ /**
+ * Get the runas user name. if it doesn't set before, the username will be returned.
+ * @return
+ */
+ public String getRunAsUsername() {
+ return contract.getUsername().getValue();
+ }
+
+ /**
+ * Returns the allocation grow load ratio threshold
+ *
+ * @return AllocationGrowLoadRatioThreshold value
+ * @see #allocationShrinkLoadRatioThreshold()
+ */
+ public int getAllocationGrowLoadRatioThreshold() {
+ if (contract.getAllocationGrowLoadRatioThreshold() == null)
+ return 0;
+ return contract.getAllocationGrowLoadRatioThreshold().getValue();
+ }
+
+ /**
+ * Returns the allocation shrink load ratio threshold
+ *
+ * @return AllocationShrinkLoadRatioThreshold value
+ */
+ public int getAllocationShrinkLoadRatioThreshold() {
+ if (contract.getAllocationShrinkLoadRatioThreshold() == null)
+ return 0;
+ return contract.getAllocationShrinkLoadRatioThreshold().getValue();
+ }
+
+ /**
+ * Returns the client idle timeout
+ *
+ * @return ClientIdleTimeout value
+ */
+ public int clientIdleTimeout() {
+ if (contract.getClientIdleTimeout() == null)
+ return 0;
+ return contract.getClientIdleTimeout().getValue();
+ }
+
+ /**
+ * Returns messages throttle start threshold
+ *
+ * @return MessagesThrottleStartThreshold value
+ */
+ public int messagesThrottleStartThreshold() {
+ if (contract.getMessagesThrottleStartThreshold() == null)
+ return 0;
+ return contract.getMessagesThrottleStartThreshold().getValue();
+ }
+
+ /**
+ * Returns the messages throttle stop threshold
+ *
+ * @return MessagesThrottleStopThreshold value
+ */
+ public int messagesThrottleStopThreshold() {
+ if (contract.getMessagesThrottleStopThreshold() == null)
+ return 0;
+ return contract.getMessagesThrottleStopThreshold().getValue();
+ }
+
+ /**
+ * Returns the session idle timeout
+ *
+ * @return SessionIdleTimeout value
+ */
+ public int sessionIdleTimeout() {
+ if (contract.getSessionIdleTimeout() == null)
+ return 0;
+ return contract.getSessionIdleTimeout().getValue();
+ }
+
+ /**
+ * Sets the allocation grow load ratio threshold
+ *
+ * @param value
+ * This value must be greater than or equal to
+ * AllocationShrinkLoadRatioThreshold
+ * @see #allocationShrinkLoadRatioThreshold()
+ */
+ public void setAllocationGrowLoadRatioThreshold(int value) {
+ contract.setAllocationGrowLoadRatioThreshold(factory
+ .createSessionStartInfoContractAllocationGrowLoadRatioThreshold(value));
+ }
+
+ /**
+ * Sets the allocation shrink load ratio threshold
+ *
+ * @param value
+ * This value must be less than or equal to
+ * AllocationGrowLoadRatioThreshold
+ * @see #allocationGrowLoadRatioThreshold()
+ */
+ public void setAllocationShrinkLoadRatioThreshold(int value) {
+ contract.setAllocationShrinkLoadRatioThreshold(factory
+ .createSessionStartInfoContractAllocationShrinkLoadRatioThreshold(value));
+ }
+
+ /**
+ * Sets the client idle timeout
+ *
+ * @param value
+ * The value must be greater than zero
+ */
+ public void setClientIdleTimeout(int value) {
+ contract.setClientIdleTimeout(factory
+ .createSessionStartInfoContractClientIdleTimeout(value));
+ }
+
+ /**
+ * Sets the messages throttle start threshold
+ *
+ * @param value
+ * The value must be less than or greater than
+ * MessagesThrottleStopThreshold
+ * @see #messagesThrottleStopThreshold()
+ */
+ public void setMessagesThrottleStartThreshold(int value) {
+ contract.setMessagesThrottleStartThreshold(factory
+ .createSessionStartInfoContractMessagesThrottleStartThreshold(value));
+ }
+
+ /**
+ * Sets the messages throttle stop threshold
+ *
+ * @param value
+ * The value must be greater than or less than
+ * MessagesThrottleStartThreshold
+ * @see #messagesThrottleStartThreshold()
+ */
+ public void setMessagesThrottleStopThreshold(int value) {
+ contract.setMessagesThrottleStopThreshold(factory
+ .createSessionStartInfoContractMessagesThrottleStopThreshold(value));
+ }
+
+ /**
+ * Sets the session idle timeout
+ *
+ * @param value
+ * This value must greater than zero
+ */
+ public void setSessionIdleTimeout(int value) {
+ contract.setSessionIdleTimeout(factory
+ .createSessionStartInfoContractSessionIdleTimeout(value));
+ }
+
+ /**
+ * Convert to CXF sessionStartInfo. This method is internal use.
+ *
+ * @return
+ */
+ public SessionStartInfoContract GetContractInfo() {
+ return this.contract;
+ }
+
+ public void Validate() {
+ if (contract.getServiceName() == null) {
+ throw new IllegalArgumentException(SR.v("ServiceNameCantBeNull"));
+ }
+ if (contract.getClientIdleTimeout() != null
+ && contract.getClientIdleTimeout().getValue() <= 0) {
+ throw new IllegalArgumentException(
+ SR.v("ClientIdleTimeoutNotNegative"));
+ }
+ if (contract.getSessionIdleTimeout() != null
+ && contract.getSessionIdleTimeout().getValue() < 0) {
+ throw new IllegalArgumentException(
+ SR.v("SessionIdleTimeoutNotNegative"));
+ }
+ if (contract.getMessagesThrottleStopThreshold() != null
+ && contract.getMessagesThrottleStopThreshold().getValue() < 0) {
+ throw new IllegalArgumentException(
+ SR.v("MessageThrottleStopThresholdPositive"));
+ }
+ if (contract.getMessagesThrottleStopThreshold() != null
+ && (contract.getMessagesThrottleStartThreshold() == null || contract
+ .getMessagesThrottleStartThreshold().getValue() <= contract
+ .getMessagesThrottleStopThreshold().getValue())) {
+ throw new IllegalArgumentException(
+ SR.v("MessageThrottleStartGreaterStop"));
+ }
+ if (contract.getMessagesThrottleStartThreshold() != null
+ && contract.getMessagesThrottleStartThreshold().getValue() < 0) {
+ throw new IllegalArgumentException(
+ SR.v("MessageThrottleStartGreaterStop"));
+ }
+ if (contract.getAllocationShrinkLoadRatioThreshold() != null
+ && contract.getAllocationShrinkLoadRatioThreshold().getValue() < 0) {
+ throw new IllegalArgumentException(
+ SR.v("AllocationShrinkLoadRatioThresholdNonNegative"));
+ }
+ if (contract.getAllocationShrinkLoadRatioThreshold() != null
+ && (contract.getAllocationGrowLoadRatioThreshold() == null || contract
+ .getAllocationGrowLoadRatioThreshold().getValue() <= contract
+ .getAllocationShrinkLoadRatioThreshold().getValue())) {
+ throw new IllegalArgumentException(
+ SR.v("LoadRatioGrowGreaterThanShrink"));
+ }
+ if(this.isUseSessionPool() && !this.isShareSession()) {
+ throw new IllegalArgumentException(SR.v("UnsharedSession_NotSupportSessionPool"));
+ }
+ }
+
+ /**
+ * Set the service version
+ *
+ * @param serviceVersion
+ */
+ public void setServiceVersion(Version serviceVersion) {
+ if (serviceVersion == null) {
+ contract.setServiceVersion(null);
+ return;
+ }
+
+ org.datacontract.schemas._2004._07.system.Version ver = new org.datacontract.schemas._2004._07.system.Version();
+
+ ver.setMajor(serviceVersion.getMajor());
+ ver.setMinor(serviceVersion.getMinor());
+ ver.setBuild(serviceVersion.getBuild());
+ ver.setRevision(serviceVersion.getRevision());
+
+ contract.setServiceVersion(factory
+ .createSessionStartInfoContractServiceVersion(ver));
+
+ }
+
+ /*
+ * Get the service version. If not set, return null.
+ */
+ public Version getServiceVersion() {
+ JAXBElement ver = contract
+ .getServiceVersion();
+
+ if (ver != null) {
+ org.datacontract.schemas._2004._07.system.Version version = ver
+ .getValue();
+ return new Version(version.getMajor(), version.getMinor(),
+ version.getRevision(), version.getBuild());
+ }
+
+ return null;
+ }
+
+ /**
+ * check if the session is secured
+ *
+ * @return
+ */
+ public Boolean isSecure() {
+ return contract.isSecure();
+ }
+
+ /**
+ * Check if the session is shared
+ *
+ * @return
+ */
+ public Boolean isShareSession() {
+ if(contract.isShareSession() == null) {
+ return false;
+ }
+ else {
+ return contract.isShareSession();
+ }
+ }
+
+ /**
+ * set if the session is secure
+ *
+ * @param value
+ */
+ public void setSecure(Boolean value) {
+ contract.setSecure(value);
+ }
+
+ /**
+ * set if the session is shared
+ *
+ * @param value
+ */
+ public void setShareSession(Boolean value) {
+ contract.setShareSession(value);
+ }
+
+ /**
+ * get the resource unit type
+ *
+ * @return
+ */
+ public SessionUnitType getResourceUnitType() {
+ if (contract.getResourceUnitType() != null) {
+
+ switch (contract.getResourceUnitType().getValue()) {
+ case 0:
+ return SessionUnitType.Core;
+ case 1:
+ return SessionUnitType.Socket;
+ case 2:
+ return SessionUnitType.Node;
+ }
+ }
+ return SessionUnitType.Core;
+ }
+
+ /**
+ * Set if the service job is preemptable
+ *
+ * @param value
+ */
+ public void setPreemptive(boolean value) {
+ contract.setCanPreempt(factory
+ .createSessionStartInfoContractCanPreempt(value));
+ }
+
+ /**
+ * if the service job is preemptable
+ *
+ * @return
+ */
+ public boolean isPreemptive() {
+ if (contract.getCanPreempt() == null)
+ return false;
+ return contract.getCanPreempt().getValue();
+ }
+
+ /**
+ * Add one job environment variable
+ *
+ * @param name
+ * @param value
+ */
+ public void addEnvironment(String name, String value) {
+ ArrayOfKeyValueOfstringstring envs;
+ if (contract.getEnvironments() == null)
+ envs = new ArrayOfKeyValueOfstringstring();
+ else
+ envs = contract.getEnvironments().getValue();
+ KeyValueOfstringstring v = new KeyValueOfstringstring();
+ v.setKey(name);
+ v.setValue(value);
+ envs.getKeyValueOfstringstring().add(v);
+ contract.setEnvironments(factory
+ .createSessionStartInfoContractEnvironments(envs));
+ }
+
+ /**
+ * Get the list of environments
+ *
+ * @return
+ */
+ public HashMap getEnvironments() {
+ HashMap result = new HashMap();
+ ArrayOfKeyValueOfstringstring list;
+ if (contract.getEnvironments() != null) {
+ list = contract.getEnvironments().getValue();
+ for (KeyValueOfstringstring s : list.getKeyValueOfstringstring()) {
+ result.put(s.getKey(), s.getValue());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * if the session uses session pool
+ * @return
+ */
+ public Boolean isUseSessionPool()
+ {
+ if(contract.isUseSessionPool() == null) {
+ return false;
+ }
+ else {
+ return contract.isUseSessionPool();
+ }
+ }
+
+ /**
+ * Set if the session uses session pool
+ * @param value
+ */
+ public void setUseSessionPool(Boolean value)
+ {
+ contract.setUseSessionPool(value);
+ }
+}
diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/JavaTraceLevelConverterEnum.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/JavaTraceLevelConverterEnum.java
index 2e6f2af..3ef1556 100644
--- a/src/com/microsoft/hpc/scheduler/session/servicecontext/JavaTraceLevelConverterEnum.java
+++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/JavaTraceLevelConverterEnum.java
@@ -1,89 +1,123 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Java trace level converter
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.scheduler.session.servicecontext;
-
-/**
- * @author t-junchw
- * @date May 16, 2011
- * @description Convert the ETW trace level to java trace level
- */
-public enum JavaTraceLevelConverterEnum {
-
- Verbose("ALL"),
- Critical("SEVERE"),
- Information("INFO"),
- Off("OFF"),
- Warning("WARNING"),
- Error("SEVERE");
-
- private final String value;
-
- JavaTraceLevelConverterEnum(String value) {
- this.value = value;
- }
- public String getValue() {
- return value;
- }
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Java trace level converter
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.scheduler.session.servicecontext;
+
+/**
+ * @author t-junchw
+ * @date May 16, 2011
+ * @description Convert the ETW trace level to java trace level
+ */
+public enum JavaTraceLevelConverterEnum {
+ Off("OFF"),
+
+ Critical("SEVERE"),
+ Error("SEVERE"),
+ Warning("WARNING"),
+
+ // below are only available in System.Diagnostics.TraceEventType
+ Start("START"),
+ Stop("STOP"),
+ Suspend("SUSPEND"),
+ Resume("RESUME"),
+ Transfer("TRANSFER"),
+
+ Information("INFO"),
+ Verbose("ALL");
+
+ private final String value;
+
+ JavaTraceLevelConverterEnum(String value) {
+ this.value = value;
+ }
+ public String getValue() {
+ return value;
+ }
+
+ public static JavaTraceLevelConverterEnum convertFromInteger(int value) {
+ switch(value) {
+ case 0:
+ return Off;
+ case 1:
+ return Critical;
+ case 2:
+ return Error;
+ case 4:
+ return Warning;
+ case 8:
+ return Information;
+ case 16:
+ return Verbose;
+ case 256:
+ case 512:
+ case 1024:
+ case 2048:
+ case 4096:
+ return Information;
+ }
+ return null;
+ }
+
+
}
\ No newline at end of file
diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java
index bfce949..0fd2036 100644
--- a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java
+++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceContext.java
@@ -1,201 +1,219 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// capture Ctrl-C signal to invoke Exiting event handler
-// Log runtime information
-// expose common data interface
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.scheduler.session.servicecontext;
-
-import java.util.logging.Level;
-import com.microsoft.hpc.exceptions.DataErrorCode;
-import com.microsoft.hpc.exceptions.DataException;
-import com.microsoft.hpc.scheduler.session.DataClient;
-import com.microsoft.hpc.scheduler.session.Constant;
-
-
-/**
- * @author t-junchw The implementation of the Service Context Class
- */
-public final class ServiceContext
-{
- public static ExitEventRegister exitingEvents = new ExitEventRegister();
-
- /**
- * @field the instance of logger to do the service tracing
- */
- public static LoggerContext Logger;
-
- /**
- * @field lock object for bDataServerInfoInitialized
- */
- private static Object lockDataServerInfoInitialized = new Object();
-
- //
- // a flag indicating if dataServerInfo has been initialized
- //
- private static Boolean bDataServerInfoInitialized = false;
-
- /**
- * @field the soa data server information
- */
- private static String dataServerAddress;
-
- /**
- * @field unrecoverable data exception that happens on data server info
- * initialization
- */
- private static DataException DataServerInfoConfigException;
-
- /**
- * @param traceLevel
- */
- public static void setTraceLevel(String traceLevel)
- {
- if (Logger == null)
- {
- Logger = new LoggerContext(traceLevel);
- }
- }
-
- /**
- * @description Used to manually fire Exiting event. Called within session
- * API and from service host when shrinking service instances
- *
- * @param sender
- * event sender
- * @param args
- * event args.
- * @param traceSource
- * the trace source
- */
- @SuppressWarnings("unused")
- private static void fireExitingEvent(Sender sender, SOAEventArg args,
- int millis)
- {
- ServiceContext.Logger.traceEvent(Level.WARNING,
- StringResource.getResource("ServiceHostcanceledbyscheduler"));
-
- if (exitingEvents != null)
- {
- try
- {
- // millis stands for limited time for execution
- if (millis > 0)
- // execute event asynchronously
- exitingEvents.onExitingAsynchronized(sender, args, millis);
- else
- {
- // execute event synchronously
- exitingEvents.onExiting(sender, args);
- }
- } catch (Exception e)
- {
- ServiceContext.Logger
- .traceEvent(
- Level.WARNING,
- String.format(
- "[HpcServiceHost]: Exception thrown when firing OnExiting event - %s",
- e.toString()));
- }
- }
- }
-
- /**
- * @description Get the DataClient instance with the specified DataClient ID
- * @param dataClientId
- * @param username
- * @param password
- * @return
- * @throws DataException
- */
- public static DataClient getDataClient(String dataClientId) throws DataException
- {
- synchronized (lockDataServerInfoInitialized)
- {
- if (!bDataServerInfoInitialized) {
- String strDataServerInfo = Environment
- .getEnvironmentVariable(Constant.SoaDataServerInfoEnvVar);
- if (strDataServerInfo != null && !strDataServerInfo.isEmpty()) {
- dataServerAddress = strDataServerInfo;
- } else {
- dataServerAddress = null;
- ServiceContext.Logger
- .traceEvent(Level.SEVERE,
- "[ServiceContext] .GetDataClient: no data server configured");
- DataServerInfoConfigException = new DataException(
- DataErrorCode.NoDataServerConfigured.getCode(),
- StringResource
- .getResource("NoDataServerConfigured"));
- }
- // ensure this code block is only executed once
- bDataServerInfoInitialized = true;
- }
- }
-
- if(dataServerAddress != null) {
- return DataClient.open(dataServerAddress, dataClientId);
- } else {
- throw DataServerInfoConfigException;
- }
- }
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// capture Ctrl-C signal to invoke Exiting event handler
+// Log runtime information
+// expose common data interface
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.scheduler.session.servicecontext;
+
+import java.util.logging.Level;
+import com.microsoft.hpc.exceptions.DataErrorCode;
+import com.microsoft.hpc.exceptions.DataException;
+import com.microsoft.hpc.scheduler.session.DataClient;
+import com.microsoft.hpc.scheduler.session.Constant;
+
+
+/**
+ * @author t-junchw The implementation of the Service Context Class
+ */
+public final class ServiceContext
+{
+ public static ExitEventRegister exitingEvents = new ExitEventRegister();
+
+ /**
+ * @field the instance of logger to do the service tracing
+ */
+ public static LoggerContext Logger;
+
+
+ /**
+ * @field lock object for bDataServerInfoInitialized
+ */
+ private static Object lockDataServerInfoInitialized = new Object();
+
+ //
+ // a flag indicating if dataServerInfo has been initialized
+ //
+ private static Boolean bDataServerInfoInitialized = false;
+
+ /**
+ * @field the soa data server information
+ */
+ private static String dataServerAddress;
+
+ /**
+ * @field unrecoverable data exception that happens on data server info
+ * initialization
+ */
+ private static DataException DataServerInfoConfigException;
+
+ /**
+ * @param traceLevel
+ */
+ public static void setTraceLevel(String traceLevel)
+ {
+ if (Logger == null)
+ {
+ Logger = new LoggerContext(traceLevel);
+ }
+ }
+
+ private static JavaTraceLevelConverterEnum soaDiagTraceLevel = JavaTraceLevelConverterEnum.Off;
+
+ public static void setSoaDiagTraceLevel(String traceLevel)
+ {
+ try {
+ soaDiagTraceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel);
+ } catch (Exception e) {
+ // just swallow the enum parse exception, and fallback to Off trace level
+ }
+ }
+
+ public static JavaTraceLevelConverterEnum getSoaDiagTraceLevel()
+ {
+ return soaDiagTraceLevel;
+ }
+
+
+ /**
+ * @description Used to manually fire Exiting event. Called within session
+ * API and from service host when shrinking service instances
+ *
+ * @param sender
+ * event sender
+ * @param args
+ * event args.
+ * @param traceSource
+ * the trace source
+ */
+ @SuppressWarnings("unused")
+ private static void fireExitingEvent(Sender sender, SOAEventArg args,
+ int millis)
+ {
+ ServiceContext.Logger.traceEvent(Level.WARNING,
+ StringResource.getResource("ServiceHostcanceledbyscheduler"));
+
+ if (exitingEvents != null)
+ {
+ try
+ {
+ // millis stands for limited time for execution
+ if (millis > 0)
+ // execute event asynchronously
+ exitingEvents.onExitingAsynchronized(sender, args, millis);
+ else
+ {
+ // execute event synchronously
+ exitingEvents.onExiting(sender, args);
+ }
+ } catch (Exception e)
+ {
+ ServiceContext.Logger
+ .traceEvent(
+ Level.WARNING,
+ String.format(
+ "[HpcServiceHost]: Exception thrown when firing OnExiting event - %s",
+ e.toString()));
+ }
+ }
+ }
+
+ /**
+ * @description Get the DataClient instance with the specified DataClient ID
+ * @param dataClientId
+ * @param username
+ * @param password
+ * @return
+ * @throws DataException
+ */
+ public static DataClient getDataClient(String dataClientId) throws DataException
+ {
+ synchronized (lockDataServerInfoInitialized)
+ {
+ if (!bDataServerInfoInitialized) {
+ String strDataServerInfo = Environment
+ .getEnvironmentVariable(Constant.SoaDataServerInfoEnvVar);
+ if (strDataServerInfo != null && !strDataServerInfo.isEmpty()) {
+ dataServerAddress = strDataServerInfo;
+ } else {
+ dataServerAddress = null;
+ ServiceContext.Logger
+ .traceEvent(Level.SEVERE,
+ "[ServiceContext] .GetDataClient: no data server configured");
+ DataServerInfoConfigException = new DataException(
+ DataErrorCode.NoDataServerConfigured.getCode(),
+ StringResource
+ .getResource("NoDataServerConfigured"));
+ }
+ // ensure this code block is only executed once
+ bDataServerInfoInitialized = true;
+ }
+ }
+
+ if(dataServerAddress != null) {
+ return DataClient.open(dataServerAddress, dataClientId);
+ } else {
+ throw DataServerInfoConfigException;
+ }
+ }
+}
diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java
index 3e415c6..f0827f6 100644
--- a/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java
+++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/ServiceRegistration.java
@@ -1,247 +1,297 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Save the Service Registration Information
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.scheduler.session.servicecontext;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import com.microsoft.hpc.properties.ErrorCode;
-
-/**
- * @author t-junchw
- * @date May 10, 2011
- * @description store the service registration information
- */
-public class ServiceRegistration
-{
-
- public final String serviceConfigurationsName = "microsoft.Hpc.Session.ServiceRegistration";
- public final String serviceDiagnosticsName = "system.diagnostics";
- private final String sourcesNodeName = "sources";
- private final String sourceNodeName = "source";
- private final String traceLevelAttributeName = "switchValue";
- private final String serviceNodeName = "service";
- private final String assemblyAttributeName = "assembly";
- private final String serviceContractAttributeName = "contract";
- private final String serviceTypeAttributeName = "ServiceType";
- private final String includeFaultedExceptionAttributeName = "includeFaultedException";
- public Node serviceConfigNode = null;
- public String serviceAssemblyFullPath = null;
- public String traceLevel = "OFF";
- private boolean includeFaultedException;
-
- public boolean isIncludeFaultedException()
- {
- return includeFaultedException;
- }
-
- /**
- * @field user service type name
- */
- public String serviceTypeName;
-
- /**
- * @field user service Contact name
- */
- public String serviceContractName;
-
- /**
- * @return serviceTypeName
- */
- public String getServiceTypeName()
- {
- return serviceTypeName;
- }
-
- /**
- * @return serviceContractName
- */
- public String getServiceContractName()
- {
- return serviceContractName;
- }
-
- /**
- * @field user jar file name
- */
- public String serviceAssemblyFileName;
-
- /**
- * @description parse the XML node list to get the service registration settings
- * @param nodelist
- */
- public void setserviceConfigNode(NodeList nodelist)
- {
- NodeList serviceConfigurationNodeList = nodelist;
- if (serviceConfigurationNodeList != null)
- {
- // get the user jar setting information
- Node rootNode = serviceConfigurationNodeList.item(0);
- for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode
- .getNextSibling())
- {
- if (rootNode.getNodeName() == serviceNodeName)
- {
- serviceConfigNode = rootNode;
- NamedNodeMap map = serviceConfigNode.getAttributes();
- try
- {
- serviceAssemblyFullPath = map.getNamedItem(
- assemblyAttributeName).getNodeValue();
- } catch (DOMException e)
- {
- TraceHelper.traceError(e.toString());
- System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
- }
-
- try
- {
- serviceContractName = map.getNamedItem(
- serviceContractAttributeName).getNodeValue();
-
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- }
-
- try
- {
- serviceTypeName = map.getNamedItem(
- serviceTypeAttributeName).getNodeValue();
-
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- }
-
- try
- {
- includeFaultedException = Boolean.parseBoolean(map
- .getNamedItem(
- includeFaultedExceptionAttributeName)
- .getNodeValue());
-
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- }
- }
- }
- }
- }
-
- /**
- * @description parse the XML node list to get the java trace level
- * @param nodeList
- */
- public void setLoggerLevel(NodeList nodeList)
- {
- if (nodeList != null)
- {
- // get the java trace setting information
- Node rootNode = nodeList.item(0);
- for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode
- .getNextSibling())
- {
- if (rootNode.getNodeName() == sourcesNodeName)
- {
- for (Node subNode = rootNode.getFirstChild(); subNode != null; subNode = subNode
- .getNextSibling())
- {
- if (subNode.getNodeName() == sourceNodeName)
- {
- NamedNodeMap map = subNode.getAttributes();
- try
- {
- traceLevel = map.getNamedItem(
- traceLevelAttributeName).getNodeValue();
- traceLevel = traceLevel.substring(0,
- traceLevel.indexOf(','));
-
- // transfer the ETW trace level to java version
- traceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel.trim()).getValue();
- break;
- } catch (DOMException e)
- {
- TraceHelper.traceError(e.toString());
- System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * @return serviceAssemblyFullPath
- */
- public String getServiceAssemblyFullPath()
- {
- return serviceAssemblyFullPath;
- }
-
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Save the Service Registration Information
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.scheduler.session.servicecontext;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import com.microsoft.hpc.properties.ErrorCode;
+
+/**
+ * @author t-junchw
+ * @date May 10, 2011
+ * @description store the service registration information
+ */
+public class ServiceRegistration
+{
+
+ public final String serviceConfigurationsName = "microsoft.Hpc.Session.ServiceRegistration";
+ public final String serviceDiagnosticsName = "system.diagnostics";
+ private final String sourcesNodeName = "sources";
+ private final String sourceNodeName = "source";
+ private final String traceLevelAttributeName = "switchValue";
+ private final String serviceNodeName = "service";
+ private final String assemblyAttributeName = "assembly";
+ private final String serviceContractAttributeName = "contract";
+ private final String serviceTypeAttributeName = "ServiceType";
+ private final String includeFaultedExceptionAttributeName = "includeFaultedException";
+ private final String textEncodingPath = "//configuration/system.serviceModel/bindings/customBinding/binding[@name='Microsoft.Hpc.BackEndBinding']/textMessageEncoding[@messageVersion='Soap11WSAddressing10']";
+ private final String soaDiagTraceLevelAttributeName = "soaDiagTraceLevel";
+ public Node serviceConfigNode = null;
+ public String serviceAssemblyFullPath = null;
+ public String traceLevel = "OFF";
+ private boolean includeFaultedException;
+ private boolean enableWSAddressing = false;
+ public String soaDiagTraceLevel = "Off";
+
+
+ public boolean isIncludeFaultedException()
+ {
+ return includeFaultedException;
+ }
+
+ /**
+ * @field user service type name
+ */
+ public String serviceTypeName;
+
+ /**
+ * @field user service Contact name
+ */
+ public String serviceContractName;
+
+ /**
+ * @return serviceTypeName
+ */
+ public String getServiceTypeName()
+ {
+ return serviceTypeName;
+ }
+
+ /**
+ * @return serviceContractName
+ */
+ public String getServiceContractName()
+ {
+ return serviceContractName;
+ }
+
+ /**
+ *
+ * @return enableWSAddressing
+ */
+ public Boolean getEnableWSAddressing()
+ {
+ return enableWSAddressing;
+ }
+
+ /**
+ * @field user jar file name
+ */
+ public String serviceAssemblyFileName;
+
+ /**
+ * @description parse the XML node list to get the service registration settings
+ * @param nodelist
+ */
+ public void setserviceConfigNode(NodeList nodelist)
+ {
+ NodeList serviceConfigurationNodeList = nodelist;
+ if (serviceConfigurationNodeList != null)
+ {
+ // get the user jar setting information
+ Node rootNode = serviceConfigurationNodeList.item(0);
+ for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode
+ .getNextSibling())
+ {
+ if (rootNode.getNodeName() == serviceNodeName)
+ {
+ serviceConfigNode = rootNode;
+ NamedNodeMap map = serviceConfigNode.getAttributes();
+ try
+ {
+ serviceAssemblyFullPath = map.getNamedItem(
+ assemblyAttributeName).getNodeValue();
+ } catch (DOMException e)
+ {
+ TraceHelper.traceError(e.toString());
+ System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
+ }
+
+ try
+ {
+ serviceContractName = map.getNamedItem(
+ serviceContractAttributeName).getNodeValue();
+
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ }
+
+ try
+ {
+ serviceTypeName = map.getNamedItem(
+ serviceTypeAttributeName).getNodeValue();
+
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ }
+
+ try
+ {
+ includeFaultedException = Boolean.parseBoolean(map
+ .getNamedItem(
+ includeFaultedExceptionAttributeName)
+ .getNodeValue());
+
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ }
+
+ try
+ {
+ if(map.getNamedItem(soaDiagTraceLevelAttributeName) != null &&
+ map.getNamedItem(soaDiagTraceLevelAttributeName).getNodeValue() != null) {
+ soaDiagTraceLevel = map.getNamedItem(soaDiagTraceLevelAttributeName).getNodeValue().split(",")[0];
+ }
+ } catch(Exception e) {
+ TraceHelper.traceError(e.toString());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @description parse the XML node list to get the java trace level
+ * @param nodeList
+ */
+ public void setLoggerLevel(NodeList nodeList)
+ {
+ if (nodeList != null)
+ {
+ // get the java trace setting information
+ Node rootNode = nodeList.item(0);
+ for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode
+ .getNextSibling())
+ {
+ if (rootNode.getNodeName() == sourcesNodeName)
+ {
+ for (Node subNode = rootNode.getFirstChild(); subNode != null; subNode = subNode
+ .getNextSibling())
+ {
+ if (subNode.getNodeName() == sourceNodeName)
+ {
+ NamedNodeMap map = subNode.getAttributes();
+ try
+ {
+ traceLevel = map.getNamedItem(
+ traceLevelAttributeName).getNodeValue();
+ traceLevel = traceLevel.substring(0,
+ traceLevel.indexOf(','));
+
+ // transfer the ETW trace level to java version
+ traceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel.trim()).getValue();
+ break;
+ } catch (DOMException e)
+ {
+ TraceHelper.traceError(e.toString());
+ System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @return serviceAssemblyFullPath
+ */
+ public String getServiceAssemblyFullPath()
+ {
+ return serviceAssemblyFullPath;
+ }
+
+ /**
+ * setEnableWSAddressing
+ * @param doc
+ */
+ public void setEnableWSAddressing(Document doc)
+ {
+ XPath path = XPathFactory.newInstance().newXPath();
+ XPathExpression expr = null;
+ NodeList list = null;
+ try {
+ expr = path.compile(textEncodingPath);
+ list = (NodeList)expr.evaluate(doc, XPathConstants.NODESET);
+ } catch (XPathExpressionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ enableWSAddressing = (list.getLength() == 1);
+ }
+
+}
diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java
new file mode 100644
index 0000000..3426500
--- /dev/null
+++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/ETWTraceEvent.java
@@ -0,0 +1,200 @@
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.scheduler.session.servicecontext.etw;
+
+import java.util.List;
+import java.util.UUID;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.helpers.CastUtils;
+import org.w3c.dom.Element;
+
+import com.microsoft.hpc.scheduler.session.Constant;
+import com.microsoft.hpc.scheduler.session.servicecontext.Environment;
+import com.microsoft.hpc.scheduler.session.servicecontext.JavaTraceLevelConverterEnum;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
+
+/**
+ * @author t-hengz
+ * @date Aug 6, 2012
+ * @description Write event with ETW
+ */
+public class ETWTraceEvent {
+ /**
+ * @field messageid dispatchid sessionid used for ETW
+ */
+ private UUID messageid;
+ private UUID dispatchid;
+ private int sessionid;
+ private JavaTraceLevelConverterEnum traceLevel;
+
+ /**
+ * @description get messageid dispatchid sessionid from headers
+ * @param wsContext
+ */
+ public ETWTraceEvent(WebServiceContext wsContext)
+ {
+ //get headers
+ MessageContext mc = wsContext.getMessageContext();
+ Message message = ((WrappedMessageContext) mc).getWrappedMessage();
+ List headers = CastUtils.cast((List>) message.get(Header.HEADER_LIST));
+
+ //get dispatchid & messageid
+ for (Header h : headers) {
+ QName name = h.getName();
+ if (name.getLocalPart().equals(Constant.DISPATCHIDLOCALPART) &&
+ name.getNamespaceURI().equals(Constant.HpcHeaderNS))
+ {
+ Element e = (Element) h.getObject();
+ try{
+ dispatchid = UUID.fromString(e.getTextContent());
+ }
+ catch(Exception exception){
+ dispatchid = null;
+ }
+ }
+ if (name.getLocalPart().equals(Constant.MESSAGEIDLOCALPART))
+ {
+ Element e = (Element) h.getObject();
+ //cause the format is urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ try{
+ messageid = UUID.fromString(e.getTextContent().toString().substring(9));
+ }
+ catch(Exception exception){
+ messageid = null;
+ }
+ }
+ }
+
+ //getsessionid
+ sessionid = Integer.parseInt(Environment.getEnvironmentVariable(Constant.JobIDEnvVar));
+ traceLevel = ServiceContext.getSoaDiagTraceLevel();
+ }
+
+ /**
+ * @param TraceLevel
+ * @param id
+ * @param message
+ */
+ public int TraceEvent(JavaTraceLevelConverterEnum TraceLevel, int id, String message)
+ {
+ return UserEvent.WriteUserEvent(TraceLevel, sessionid, messageid, dispatchid, message);
+ }
+
+ /**
+ *
+ */
+ public void Flush()
+ {
+ return ;
+ }
+
+ /**
+ * @param message
+ */
+ public int TraceInformation(String message)
+ {
+ return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Information, sessionid, messageid, dispatchid, message);
+ }
+
+ /**
+ * @param TraceLevel
+ * @param id
+ * @param data
+ */
+ public int TraceData(JavaTraceLevelConverterEnum TraceLevel, int id, Object data)
+ {
+ return TraceData(TraceLevel, id, new Object[]{data});
+ }
+
+ /**
+ * @param TraceLevel
+ * @param id
+ * @param data
+ */
+ public int TraceData(JavaTraceLevelConverterEnum TraceLevel, int id, Object[] data)
+ {
+ String message = "";
+ boolean isfirst = true;
+ if (data!=null)
+ {
+ for (Object object : data)
+ {
+ if (object==null)
+ continue;
+ if (isfirst)
+ isfirst = false;
+ else
+ message += ",";
+ message += object.toString();
+
+ }
+ }
+ return UserEvent.WriteUserEvent(TraceLevel, sessionid, messageid, dispatchid, message);
+ }
+
+ public int TraceTransfer(int id, String message, UUID relatedActivityId)
+ {
+ return UserEvent.WriteUserEvent(JavaTraceLevelConverterEnum.Information, sessionid, messageid, dispatchid, message);
+ }
+
+}
diff --git a/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java
new file mode 100644
index 0000000..51f8d66
--- /dev/null
+++ b/src/com/microsoft/hpc/scheduler/session/servicecontext/etw/UserEvent.java
@@ -0,0 +1,142 @@
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.scheduler.session.servicecontext.etw;
+
+import java.util.UUID;
+
+import com.microsoft.hpc.properties.ErrorCode;
+import com.microsoft.hpc.scheduler.session.Constant;
+import com.microsoft.hpc.scheduler.session.servicecontext.JavaTraceLevelConverterEnum;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
+
+/**
+ * @author t-hengz
+ * @date Aug 6, 2012
+ * @description invoke c++ method to call ETW API with JNI
+ */
+public class UserEvent {
+ /**
+ * @field used for checking tracehelper.dll
+ */
+ static private boolean dllexist;
+
+ /**
+ * @description load tracehelper.dll
+ */
+ static
+ {
+ dllexist = true;
+ try{
+ System.loadLibrary("tracehelper");
+ }
+ catch(java.lang.UnsatisfiedLinkError e){
+ dllexist = false;
+ }
+ }
+
+ static private native int CWriteUserEvent(int Flag, int SessionId, String MessageId, String DispatchId, String msg);
+
+ /**
+ * @param level
+ * @param sessionId
+ * @param messageId
+ * @param dispatchId
+ * @param msg
+ *
+ */
+ static public int WriteUserEvent(JavaTraceLevelConverterEnum level, int SessionId, UUID messageid, UUID dispatchid, String msg)
+ {
+ //check if .dll exist
+ if(!dllexist)
+ return ErrorCode.ERROR_DLLNOTEXIST;
+ // filter by trace level
+ if(ServiceContext.getSoaDiagTraceLevel().ordinal() < level.ordinal()) {
+ return 0;
+ }
+
+ //check input
+ if (msg==null)
+ return ErrorCode.ERROR_NULLMSG;
+
+ if (messageid==null)
+ return ErrorCode.ERROR_INVALIDMESSAGEID;
+
+ if (dispatchid==null)
+ return ErrorCode.ERROR_INVALIDDISPATCHID;
+
+ //call c method
+ int status = ErrorCode.ERROR_INVALIDFLAG;
+
+ if (level.equals(JavaTraceLevelConverterEnum.Critical))
+ status = CWriteUserEvent(Constant.TRACE_CRITICAL,SessionId,messageid.toString(),dispatchid.toString(),msg);
+
+ if (level.equals(JavaTraceLevelConverterEnum.Error))
+ status = CWriteUserEvent(Constant.TRACE_ERROR,SessionId,messageid.toString(),dispatchid.toString(),msg);
+
+ if (level.equals(JavaTraceLevelConverterEnum.Warning))
+ status = CWriteUserEvent(Constant.TRACE_WARNING,SessionId,messageid.toString(),dispatchid.toString(),msg);
+
+ if (level.equals(JavaTraceLevelConverterEnum.Information))
+ status = CWriteUserEvent(Constant.TRACE_INFO,SessionId,messageid.toString(),dispatchid.toString(),msg);
+
+ if (level.equals(JavaTraceLevelConverterEnum.Verbose))
+ status = CWriteUserEvent(Constant.TRACE_VERBOSE,SessionId,messageid.toString(),dispatchid.toString(),msg);
+
+ return status;
+ }
+
+}
diff --git a/src/com/microsoft/hpc/servicehost/AddHeaderOutInterceptor.java b/src/com/microsoft/hpc/servicehost/AddHeaderOutInterceptor.java
index 89684f6..4a94886 100644
--- a/src/com/microsoft/hpc/servicehost/AddHeaderOutInterceptor.java
+++ b/src/com/microsoft/hpc/servicehost/AddHeaderOutInterceptor.java
@@ -1,109 +1,153 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Add action header to the message when the message level preemption is enabled
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.servicehost;
-
-import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.phase.Phase;
-
-/**
- * @author t-junchw
- * @date May 16, 2011
- * @description add header to the soap message during message preemption
- */
-public class AddHeaderOutInterceptor extends AbstractSoapInterceptor
-{
- HpcServiceHostWrapper hpcHostWrapper;
-
- /**
- * @param wrapper
- */
- public AddHeaderOutInterceptor(HpcServiceHostWrapper wrapper)
- {
- super(Phase.WRITE);
- this.hpcHostWrapper = wrapper;
- }
-
- /**(non-Javadoc)
- * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message)
- */
- @Override
- public void handleMessage(SoapMessage message) throws Fault
- {
-
- if (hpcHostWrapper.enableMessageLevelPreemption)
- {
- String guid = (String) message.getExchange().get("ID");
- if (guid == null)
- return ;
-
- InterceptorUtility.addMessageHeader(message, "Action",
- "http://www.w3.org/2005/08/addressing",
- com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault.Action);
- }
- }
-
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Add action header to the message when the message level preemption is enabled
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.servicehost;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Pattern;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapHeader;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.w3c.dom.Element;
+
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
+import com.microsoft.hpc.session.RetryOperationError;
+
+/**
+ * @author t-junchw
+ * @date May 16, 2011
+ * @description add header to the soap message during message preemption
+ */
+public class AddHeaderOutInterceptor extends AbstractSoapInterceptor
+{
+ private static final Logger LOG = LogUtils.getL7dLogger(AddHeaderOutInterceptor.class);
+ HpcServiceHostWrapper hpcHostWrapper;
+
+ /**
+ * @param wrapper
+ */
+ public AddHeaderOutInterceptor(HpcServiceHostWrapper wrapper)
+ {
+ super(Phase.PRE_PROTOCOL);
+ this.hpcHostWrapper = wrapper;
+ }
+
+ /**(non-Javadoc)
+ * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message)
+ */
+ @Override
+ public void handleMessage(SoapMessage message) throws Fault
+ {
+
+ if (hpcHostWrapper.enableMessageLevelPreemption) {
+ String guid = (String) message.getExchange().get("ID");
+ if (guid == null)
+ return;
+
+ // InterceptorUtility.addOrUpdateMessageHeader(message, "Action",
+ // "http://www.w3.org/2005/08/addressing",
+ // com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault.Action);
+ }
+
+ Fault f = (Fault) message.getContent(Exception.class);
+ QName qn = new QName("http://www.w3.org/2005/08/addressing", "Action");
+ Header header = message.getHeader(qn);
+ if (header.getObject() != null) {
+ Element root = (Element) header.getObject();
+ if (Pattern
+ .compile(Pattern.quote("RetryOperationError"),
+ Pattern.CASE_INSENSITIVE)
+ .matcher(root.getTextContent()).find()) {
+ root.setTextContent("http://hpc.microsoft.com/session/RetryOperationError");
+ RetryOperationError error = new RetryOperationError();
+ Element detailElement = InterceptorUtility
+ .createDetailElement(error);
+ f.setDetail(detailElement);
+ message.setContextualProperty(
+ org.apache.cxf.message.Message.FAULT_STACKTRACE_ENABLED,
+ "false"); // disable stack trace to make it compatible
+ // with broker
+ }
+ }
+
+ }
+
+}
diff --git a/src/com/microsoft/hpc/servicehost/HpcControllerSvc.java b/src/com/microsoft/hpc/servicehost/HpcControllerSvc.java
index e02169e..3d3e24d 100644
--- a/src/com/microsoft/hpc/servicehost/HpcControllerSvc.java
+++ b/src/com/microsoft/hpc/servicehost/HpcControllerSvc.java
@@ -1,192 +1,191 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Controller Servicer to handle the Exit invoking
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.servicehost;
-
-import java.lang.reflect.Method;
-import java.util.logging.Level;
-import javax.jws.WebService;
-import com.microsoft.hpc.properties.ErrorCode;
-import com.microsoft.hpc.scheduler.session.servicecontext.SOAEventArg;
-import com.microsoft.hpc.scheduler.session.servicecontext.Sender;
-import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
-import com.microsoft.hpc.scheduler.session.servicecontext.StringResource;
-
-/**
- * @author t-junchw
- * @date May 9, 2011
- * @description Controller Service working with the broker worker
- */
-@WebService(targetNamespace = "http://hpc.microsoft.com/hpcservicehost/", name = "IHpcServiceHost")
-public class HpcControllerSvc implements IHpcController
-{
-
- /**
- * @field How long to wait for Exiting event to return
- */
- int cancelTaskGracePeriod = 0;
-
- /**
- * @field sessionID
- */
- int sessionId = 0;
-
- private HpcServiceHostWrapper hostWrapper;
-
- /**
- * @description Constructor for service host
- * @param sessionId
- * @param cancelTaskGracePeriod
- * @param hostWrapper
- */
- public HpcControllerSvc(int sessionId, int cancelTaskGracePeriod,
- HpcServiceHostWrapper hostWrapper)
- {
- this.sessionId = sessionId;
- this.cancelTaskGracePeriod = cancelTaskGracePeriod;
- this.hostWrapper = hostWrapper;
- }
-
- /**
- * @description Shutdowns down service host
- */
- @Override
- public void Exit()
- {
- try
- {
- synchronized (this.hostWrapper.syncObjOnExitingCalled)
- {
- // No need to call OnExiting again if it is already called when
- // Ctrl-C signal is received.
- if (!this.hostWrapper.isOnExitingCalled)
- {
- // Invoke user's Exiting event async with a timeout
- // specified by TaskCancelGracePeriod cluster parameter.
- Method method = ServiceContext.class.getDeclaredMethod(
- "fireExitingEvent", new Class[] { Sender.class,
- SOAEventArg.class, int.class });
- method.setAccessible(true);
-
- // Invoke the OnExitingAsynchronized method
- Sender sender = new Sender(new Object());
- SOAEventArg soaEventArg = new SOAEventArg(0);
- Object[] argsObjects = { sender, soaEventArg,
- cancelTaskGracePeriod };
- method.invoke(ServiceContext.class.newInstance(),
- argsObjects);
-
- this.hostWrapper.isOnExitingCalled = true;
- }
- }
- } catch (Exception ex)
- {
- ServiceContext.Logger.traceEvent(Level.WARNING, ex.toString());
- } finally
- {
- // remove the Ctrl-C hook from runtime
- synchronized (this.hostWrapper.shutdownThread)
- {
- try
- {
- Runtime.getRuntime().removeShutdownHook(
- this.hostWrapper.shutdownThread);
- } catch (IllegalStateException e)
- {
- // If the virtual machine is already in the process of
- // shutting down
- this.hostWrapper.shutdownThread.notify();
- return;
- } catch (Exception ex)
- {
- ServiceContext.Logger.traceEvent(Level.SEVERE,
- ex.toString());
- return;
- }
- }
-
- // Keep the exit code the same as before. If the host is canceled by
- // user or scheduler,
- // it exits with -1. If the host is closed by graceful shrink, it
- // exits with 0.
- if (this.hostWrapper.receivedCancelEvent)
- {
- System.out.println(StringResource
- .getResource("TaskCanceledOrPreempted"));
- System.out.flush();
- ServiceContext.Logger.traceEvent(Level.INFO,
- StringResource.getResource("TaskCanceledOrPreempted"));
- System.exit(-1);
- } else
- {
- System.out.println(StringResource
- .getResource("ServiceShutdownFromBrokerShrink"));
- System.out.flush();
- ServiceContext.Logger.traceEvent(Level.INFO, StringResource
- .getResource("ServiceShutdownFromBrokerShrink"));
- System.exit(ErrorCode.Success);
- }
- }
- }
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Controller Servicer to handle the Exit invoking
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.servicehost;
+
+import java.lang.reflect.Method;
+import java.util.logging.Level;
+import javax.jws.WebService;
+import com.microsoft.hpc.properties.ErrorCode;
+import com.microsoft.hpc.scheduler.session.servicecontext.SOAEventArg;
+import com.microsoft.hpc.scheduler.session.servicecontext.Sender;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
+import com.microsoft.hpc.scheduler.session.servicecontext.StringResource;
+
+/**
+ * @author t-junchw
+ * @date May 9, 2011
+ * @description Controller Service working with the broker worker
+ */
+@WebService(targetNamespace = "http://hpc.microsoft.com/hpcservicehost/", name = "IHpcServiceHost")
+public class HpcControllerSvc implements IHpcController
+{
+
+ /**
+ * @field How long to wait for Exiting event to return
+ */
+ int cancelTaskGracePeriod = 0;
+
+ /**
+ * @field sessionID
+ */
+ int sessionId = 0;
+
+ private HpcServiceHostWrapper hostWrapper;
+
+ /**
+ * @description Constructor for service host
+ * @param sessionId
+ * @param cancelTaskGracePeriod
+ * @param hostWrapper
+ */
+ public HpcControllerSvc(int sessionId, int cancelTaskGracePeriod,
+ HpcServiceHostWrapper hostWrapper)
+ {
+ this.sessionId = sessionId;
+ this.cancelTaskGracePeriod = cancelTaskGracePeriod;
+ this.hostWrapper = hostWrapper;
+ }
+
+ /**
+ * @description Shutdowns down service host
+ */
+ @Override
+ public void Exit()
+ {
+ try
+ {
+ synchronized (this.hostWrapper.syncObjOnExitingCalled)
+ {
+ // No need to call OnExiting again if it is already called when
+ // Ctrl-C signal is received.
+ if (!this.hostWrapper.isOnExitingCalled)
+ {
+ // Invoke user's Exiting event async with a timeout
+ // specified by TaskCancelGracePeriod cluster parameter.
+ Method method = ServiceContext.class.getDeclaredMethod(
+ "fireExitingEvent", new Class[] { Sender.class,
+ SOAEventArg.class, int.class });
+ method.setAccessible(true);
+
+ // Invoke the OnExitingAsynchronized method
+ Sender sender = new Sender(new Object());
+ SOAEventArg soaEventArg = new SOAEventArg(0);
+ Object[] argsObjects = { sender, soaEventArg,
+ cancelTaskGracePeriod };
+ method.invoke(ServiceContext.class.newInstance(),
+ argsObjects);
+ this.hostWrapper.isOnExitingCalled = true;
+ }
+ }
+ } catch (Exception ex)
+ {
+ ServiceContext.Logger.traceEvent(Level.WARNING, ex.toString());
+ } finally
+ {
+ // remove the Ctrl-C hook from runtime
+ synchronized (this.hostWrapper.shutdownThread)
+ {
+ try
+ {
+ Runtime.getRuntime().removeShutdownHook(
+ this.hostWrapper.shutdownThread);
+ } catch (IllegalStateException e)
+ {
+ // If the virtual machine is already in the process of
+ // shutting down
+ this.hostWrapper.shutdownThread.notify();
+ return;
+ } catch (Exception ex)
+ {
+ ServiceContext.Logger.traceEvent(Level.SEVERE,
+ ex.toString());
+ return;
+ }
+ }
+
+ // Keep the exit code the same as before. If the host is canceled by
+ // user or scheduler,
+ // it exits with -1. If the host is closed by graceful shrink, it
+ // exits with 0.
+ if (this.hostWrapper.receivedCancelEvent)
+ {
+ System.out.println(StringResource
+ .getResource("TaskCanceledOrPreempted"));
+ System.out.flush();
+ ServiceContext.Logger.traceEvent(Level.INFO,
+ StringResource.getResource("TaskCanceledOrPreempted"));
+ System.exit(-1);
+ } else
+ {
+ System.out.println(StringResource
+ .getResource("ServiceShutdownFromBrokerShrink"));
+ System.out.flush();
+ ServiceContext.Logger.traceEvent(Level.INFO, StringResource
+ .getResource("ServiceShutdownFromBrokerShrink"));
+ System.exit(ErrorCode.Success);
+ }
+ }
+ }
+}
diff --git a/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java b/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java
index e56c1b7..7406e45 100644
--- a/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java
+++ b/src/com/microsoft/hpc/servicehost/HpcServiceHostWrapper.java
@@ -1,803 +1,818 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Set up the Java Servie Host.
-// Host the Customer's Jar or Dummy Service
-// Host the Controller Service
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.servicehost;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import javax.jws.WebService;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.interceptor.LoggingInInterceptor;
-import org.apache.cxf.interceptor.LoggingOutInterceptor;
-import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
-import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
-import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
-import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
-import com.microsoft.hpc.properties.ErrorCode;
-import com.microsoft.hpc.scheduler.session.Constant;
-import com.microsoft.hpc.scheduler.session.servicecontext.Environment;
-import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
-import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration;
-import com.microsoft.hpc.scheduler.session.servicecontext.StringResource;
-import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper;
-
-/**
- * @author t-junchw
- * @date May 9, 2011
- * @description Wrapper class for the construction of host service and
- * controller service
- */
-public class HpcServiceHostWrapper
-{
-
- /**
- * @field Represents how an endpoint address is finalructed
- * http://.://
- */
- private final String BaseAddrTemplate = "http://%s:%s/%s/%s";
-
- /**
- * @field Timeout for Exiting event to execute. This must be the same as
- * node manager's default CTRL+C timeout
- */
- private int cancelTaskGracePeriod = Constant.DefaultCancelTaskGracePeriod;
-
- private int jobId;
- private int taskId;
- private int procNum;
-
- /**
- * @field CXF service retry Time out In MilliSecond
- */
- private int retryTimeoutInMilliSecond;
-
- /**
- * @field 60 second
- */
- private final int defaultRetryTimeout = 60 * 1000;
-
- /**
- * @field The real jar service host
- */
- public JaxWsServerFactoryBean host;
-
- /**
- * @field the controller service
- */
- public JaxWsServerFactoryBean controllerhost;
-
- /**
- * @field Enable the new feature MessageLevelPreemption or not.
- */
- public boolean enableMessageLevelPreemption;
-
- /**
- * @field This flag is set when host receives Ctrl-C event.
- */
- public boolean receivedCancelEvent;
-
- /**
- * @field object used for synchronization
- */
- public Object syncObjOnExitingCalled = new Object();
-
- /**
- * @field This flag indicates if the OnExiting event is triggered.
- */
- public boolean isOnExitingCalled = false;
-
- /**
- * @field This list stores ids of messages which are invoking the hosted
- * service. When the response is sent back to the broker, the id is
- * removed from this list. If a message come to host after Ctrl-C
- * event, its id won't be saved in this list.
- */
- public List processingMessageIds = Collections
- .synchronizedList(new ArrayList());
-
- /**
- * @field the offset to the port
- */
- private int portOffset;
-
- /**
- * @field the service registration
- */
- private ServiceRegistration serviceRegistration;
-
- /**
- * @field Http receive Timeout
- */
- private long receiveTimeout;
-
- /**
- * @field times to retry to host the user service
- */
- private int retrytimes = 3;
-
- /**
- * @field Ctrl-C hook
- */
- public ShutdownThread shutdownThread;
-
- public HpcServiceHostWrapper(ServiceRegistration serviceRegistration)
- {
- this.serviceRegistration = serviceRegistration;
-
- // Initialize Ctrl-C handler to receive shutdown events from node
- // manager
- this.invokeInitializeControlBreakHandler();
- }
-
- /**
- * @description method to host the service
- * @throws InterruptedException
- * @throws UnknownHostException
- */
- public void publish() throws InterruptedException, UnknownHostException
- {
- String errorMsg = null;
-
- int errorCode = ErrorCode.Success;
- errorCode = getEnvironmentVariables();
-
- // initially retry wait period is 0.5 second
- long retryWaitPeriodInMilliSecond = 500;
-
- if (errorCode != ErrorCode.Success)
- {
- return;
- }
-
- int retry = 0;
- long serviceStartTime = System.currentTimeMillis();
- while (true)
- {
- try
- {
- // try to host the user jar
- errorCode = RunInternal();
-
- if (retry == Integer.MAX_VALUE)
- {
- retry = 0;
- } else
- {
- retry++;
- }
-
- if (errorCode != ErrorCode.Success)
- {
- if (errorCode < ErrorCode.ServiceHost_ExitCode_Start
- || errorCode > ErrorCode.ServiceHost_ExitCode_End)
- {
- errorCode = ErrorCode.ServiceHost_UnexpectedException;
- }
-
- errorMsg = StringResource
- .getResource("FailedInStartingService");
- ServiceContext.Logger.traceEvent(Level.SEVERE, errorMsg);
- }
- } catch (Exception e)
- {
- TraceHelper.traceError(e.getMessage());
- errorCode = ErrorCode.ServiceHost_UnexpectedException;
- errorMsg = e.getMessage();
- }
-
- if (errorCode == ErrorCode.ServiceHost_AssemblyLoadingError
- || errorCode == ErrorCode.ServiceHost_NoContractImplemented)
- {
- if (retry >= retrytimes)
- {
- break;
- }
- }
-
- if (errorCode == ErrorCode.Success)
- {
- break;
- }
-
- long serviceStopTime = System.currentTimeMillis();
-
- // if retry timeout is reached, work is done
- long elapsedStartTimeInMilliSecond = serviceStopTime
- - serviceStartTime;
- if (elapsedStartTimeInMilliSecond > retryTimeoutInMilliSecond)
- {
- break;
- }
-
- serviceStartTime = System.currentTimeMillis();
-
- if (elapsedStartTimeInMilliSecond + retryWaitPeriodInMilliSecond > retryTimeoutInMilliSecond)
- {
- retryWaitPeriodInMilliSecond = retryTimeoutInMilliSecond
- - elapsedStartTimeInMilliSecond;
- }
-
- ServiceContext.Logger.traceEvent(Level.INFO, String.format(
- "Wait %s milliseconds and retry",
- retryWaitPeriodInMilliSecond));
-
- TraceHelper.traceInformation(String.format(
- "Wait %d milliseconds and retry.",
- retryWaitPeriodInMilliSecond));
-
- // wait and retry
- Thread.sleep(retryWaitPeriodInMilliSecond);
-
- // back off
- retryWaitPeriodInMilliSecond *= 2;
- }
- if (errorCode != ErrorCode.Success)
- {
- RunAsDummy();
- }
- }
-
- /**
- * @description host the dummy service method invoked when failed to host
- * the user jar
- * @throws UnknownHostException
- */
- private void RunAsDummy() throws UnknownHostException
- {
-
- String defaultBaseAddr = createEndpointAddress(Constant.ServiceHostPort
- + portOffset);
- TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr);
-
- // destroy the existing host
- if (host != null)
- {
- try
- {
- host.getServer().destroy();
- } catch (Exception e)
- {
- // do nothing
- }
- }
-
- host = null;
- try
- {
- DummyProvider dummyService = new DummyProvider();
-
- host = new JaxWsServerFactoryBean();
- String listenUri = defaultBaseAddr + "/_defaultEndpoint/";
- TraceHelper.traceInformation("listenUri = " + listenUri);
- host.setAddress(listenUri);
- host.setServiceBean(dummyService);
-
- // log the in/out bound message
- host.getInInterceptors().add(new LoggingInInterceptor());
- host.getOutInterceptors().add(new LoggingOutInterceptor());
-
- TraceHelper.traceInformation(StringResource
- .getResource("TryCreateHost"));
- Server server = host.create();
-
- JettyHTTPDestination destination = (JettyHTTPDestination) server
- .getDestination();
- // Update back end binding's receive timeout with global settings if
- // they are enabled
- // update the Service setting
- getServiceSettings();
- HTTPServerPolicy httpServerPolicy = new HTTPServerPolicy();
- httpServerPolicy.setReceiveTimeout(receiveTimeout);
- destination.setServer(httpServerPolicy);
-
- TraceHelper.traceInformation(StringResource
- .getResource("TryOpenCtrlHost"));
- String endpointAddress = createEndpointAddress(Constant.ServiceHostControllerPort
- + portOffset);
- OpenHostController(endpointAddress);
-
- ServiceContext.Logger.traceEvent(Level.INFO, String.format(
- "[HpcServiceHost]: Dummy service opened on %s", listenUri));
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- ServiceContext.Logger.traceEvent(Level.SEVERE,
- String.format("[HpcServiceHost]: " + e.toString()));
-
- if (host != null)
- {
- try
- {
- host.getServer().destroy();
- } catch (Exception ex)
- {
- // do nothing
- }
- }
- }
- }
-
- /**
- * @description Open the service host. All exceptions will be directly
- * thrown out. So the outer program must know how to deal with
- * those exceptions.
- * @return error code
- */
- private int RunInternal()
- {
- ServiceContext.Logger.traceEvent(Level.ALL,
- "[HpcServiceHost]: Start opening");
-
- // Load the service jar from the specified path
- JarClassLoader jarClassLoader = null;
-
-
- try
- {
- jarClassLoader = new JarClassLoader(
- serviceRegistration.serviceAssemblyFullPath);
- ServiceContext.Logger.traceEvent(Level.ALL,
- "[HpcServiceHost]: Jar is loaded.");
- } catch (IOException e)
- {
- TraceHelper.traceError(e.getMessage());
- return ErrorCode.ServiceHost_AssemblyLoadingError;
- }
-
- boolean isimplemented = false;
- Class> userclass = null;
- try
- {
- // if the user specify the ServiceTypeName
- if (serviceRegistration.getServiceTypeName() != null)
- {
- userclass = jarClassLoader
- .loadClass(serviceRegistration.serviceTypeName);
- // if the user specify the ServiceContractName
- if (serviceRegistration.getServiceContractName() != null)
- {
- Class>[] userinterfacesClass = userclass.getInterfaces();
- for (Class> tempinterface : userinterfacesClass)
- {
- if (tempinterface.getName() == serviceRegistration
- .getServiceContractName())
- {
- isimplemented = true;
- break;
- }
- }
- }
- if (!isimplemented)
- {
- String message = String.format(StringResource
- .getResource("CantFindServiceContract"),
- serviceRegistration.serviceContractName,
- serviceRegistration.serviceAssemblyFileName);
- TraceHelper.traceError(message);
- ServiceContext.Logger.traceEvent(Level.SEVERE, message);
- return ErrorCode.ServiceHost_NoContractImplemented;
- }
- }
- // if the user only specify the ServiceTypeName
- else if (serviceRegistration.getServiceContractName() != null)
- {
- userclass = jarClassLoader
- .loadClassbyInterface(serviceRegistration
- .getServiceContractName());
- }
- // Try to auto discover the service contract interface from the jar
- else
- {
- userclass = jarClassLoader.findClass();
- }
- } catch (ClassNotFoundException e)
- {
- TraceHelper.traceError(e.getMessage());
- return ErrorCode.ServiceHost_ServiceTypeDiscoverError;
- }
-
- String defaultBaseAddr = null;
- try
- {
- defaultBaseAddr = createEndpointAddress(Constant.ServiceHostPort
- + portOffset);
- } catch (UnknownHostException e)
- {
- TraceHelper.traceError(e.toString());
- return ErrorCode.ServiceHost_UnexpectedException;
- }
- TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr);
-
- String listenUri = defaultBaseAddr + "/_defaultEndpoint";
- TraceHelper.traceInformation("listenUri = " + listenUri);
-
- try
- {
- host = new JaxWsServerFactoryBean();
- host.setAddress(listenUri);
- host.setServiceBean(userclass.newInstance());
-
- // log the in/out bound message
- host.getInInterceptors().add(new LoggingInInterceptor());
- host.getOutInterceptors().add(new LoggingOutInterceptor());
-
- // if users specify the WSDL location, try to find it from jar
- WebService annotation = userclass
- .getAnnotation(javax.jws.WebService.class);
- String wSDLLocation = null;
- if (annotation != null)
- wSDLLocation = annotation.wsdlLocation();
- String folder = "";
- if (wSDLLocation != null && !wSDLLocation.isEmpty())
- {
- wSDLLocation = wSDLLocation.substring(wSDLLocation
- .indexOf("file:") + 5);
- int index = serviceRegistration.getServiceAssemblyFullPath()
- .lastIndexOf('\\');
-
- if (index == -1)
- index = serviceRegistration.getServiceAssemblyFullPath()
- .lastIndexOf("/");
- folder = serviceRegistration.getServiceAssemblyFullPath()
- .substring(0, index + 1);
- host.setWsdlLocation(folder + wSDLLocation);
- }
-
- // Add interceptors if the config enables the message
- // level preemption.
- if (this.enableMessageLevelPreemption == true)
- {
- host.getInInterceptors().add(
- new MessagePreemptionInInterceptor(this));
- host.getOutInterceptors().add(
- new MessagePreemptionOutInterceptor(this));
- host.getOutFaultInterceptors().add(
- new AddHeaderOutInterceptor(this));
- }
-
- //enable the debug to stack trace in fault soap message
- host.getBus().setProperty( "faultStackTraceEnabled", "true");
-
- TraceHelper.traceInformation(StringResource
- .getResource("TryCreateHost"));
- Server server = host.create();
-
- // Update backend binding's receive timeout and max message settings
- // with global settings if they are enabled
- // update the Service setting
- getServiceSettings();
- JettyHTTPDestination destination = (JettyHTTPDestination) server
- .getDestination();
-
- // Configure Jetty server max idle time out
- JettyHTTPServerEngine engine = (JettyHTTPServerEngine) destination.getEngine();
- engine.getConnector().setMaxIdleTime((int)receiveTimeout);
-
- HTTPServerPolicy httpServerPolicy = new HTTPServerPolicy();
- httpServerPolicy.setReceiveTimeout(receiveTimeout);
-
- ServiceContext.Logger.traceEvent(Level.ALL, "Service Operation Timeout"+receiveTimeout);
- destination.setServer(httpServerPolicy);
-
- TraceHelper.traceInformation("Service host successfully opened on "
- + listenUri);
-
- TraceHelper.traceInformation(StringResource
- .getResource("TryOpenCtrlHost"));
- String endpointAddress = createEndpointAddress(Constant.ServiceHostControllerPort
- + portOffset);
- OpenHostController(endpointAddress);
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- TraceHelper.traceStackError(e);
- ServiceContext.Logger.traceEvent(Level.SEVERE, "[HpcServiceHost]: "
- + e.toString());
-
- return ErrorCode.ServiceHost_ServiceHostFailedToOpen;
- }
-
- ServiceContext.Logger.traceEvent(Level.INFO, String.format(
- "[HpcServiceHost]: Service host successfully opened on %s ",
- listenUri));
-
- TraceHelper.traceInformation("Service host successfully opened on "
- + listenUri);
-
- return ErrorCode.Success;
- }
-
- /**
- * @description opens the service host controller service
- * @remark port disabled sharing on CNs/WNs, we need to open another port
- * @param defaultBaseAddr
- */
- private void OpenHostController(String defaultBaseAddr)
- {
- TraceHelper.traceInformation("defaultBaseAddr of HostController is "
- + defaultBaseAddr);
-
- // Open the Control Service Host;
- TraceHelper.traceInformation("Created ServiceHost for controller.");
- HpcControllerSvc ControllerService = new HpcControllerSvc(this.jobId,
- cancelTaskGracePeriod, this);
-
- TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr);
- controllerhost = new JaxWsServerFactoryBean();
-
- String listenUri = defaultBaseAddr + "/_defaultEndpoint/";
- TraceHelper.traceInformation("listenUri = " + listenUri);
-
- TraceHelper.traceInformation("Adding endpoint to controller.");
- controllerhost.setAddress(listenUri);
- controllerhost.setServiceBean(ControllerService);
-
- // log the in/out bound message
- controllerhost.getInInterceptors().add(new LoggingInInterceptor());
- controllerhost.getOutInterceptors().add(new LoggingOutInterceptor());
-
- TraceHelper.traceInformation(StringResource
- .getResource("TryCreateCtrlHost"));
- controllerhost.create();
- TraceHelper.traceInformation("Controller opened.");
-
- }
-
- /**
- * @description create the end point address for the service
- * @param port
- * @return
- * @throws UnknownHostException
- */
- private String createEndpointAddress(int port) throws UnknownHostException
- {
- // The format of default base addr:
- // http://.://
-
- String jarNetworkPrefix = Environment
- .getEnvironmentVariable(Constant.NetworkPrefixEnv);
- ServiceContext.Logger.traceEvent(Level.ALL,
- "[HpcServiceHost]: Java network prefix = " + jarNetworkPrefix);
-
- if (jarNetworkPrefix.equals(Constant.EnterpriseNetwork))
- {
- jarNetworkPrefix = "";
- }
-
- String hostnameWithPrefix = InetAddress.getLocalHost().getHostName();
- if (jarNetworkPrefix != null && !jarNetworkPrefix.isEmpty())
- {
- hostnameWithPrefix = String.format("%s.%s", jarNetworkPrefix,
- hostnameWithPrefix);
- }
-
- return String.format(BaseAddrTemplate, hostnameWithPrefix, port, jobId,
- taskId);
- }
-
-
- /**
- * @description Get service's service operation Timeout
- */
- private void getServiceSettings()
- {
- String serviceOperationTimeoutString = Environment
- .getEnvironmentVariable(Constant.ServiceConfigServiceOperatonTimeoutEnvVar);
- try
- {
- receiveTimeout = Integer.parseInt(serviceOperationTimeoutString);
- } catch (NumberFormatException e)
- {
- ServiceContext.Logger
- .traceEvent(
- Level.ALL,
- "[HpcServiceHost]: Error retrieving ServiceOperationTimeout. Defaulting to binding's default - "
- + e.toString());
- TraceHelper.traceError(e.getMessage());
- receiveTimeout = Constant.DefaultServiceOperationTimeout;
- }
- }
-
- /**
- * @description get environment variables
- * jobID
- * taskTD
- * CoreId
- * procNum
- * cancelTaskGracePeriod
- * enableMessageLevelPreemption
- * @return error code
- */
- private int getEnvironmentVariables()
- {
- String jobidenvvar = Environment.getEnvironmentVariable(Constant.JobIDEnvVar);
- try
- {
- jobId = Integer.parseInt(jobidenvvar);
-
- } catch (Exception e)
- {
- ServiceContext.Logger.traceEvent(Level.SEVERE,
- StringResource.getResource("CantFindJobId"));
- return ErrorCode.ServiceHost_UnexpectedException;
- }
-
- ServiceContext.Logger.traceEvent(Level.ALL,
- "[HpcServiceHost]: Job Id = " + jobId);
-
- String taskidenvvar = Environment.getEnvironmentVariable(Constant.TaskSystemIDEnvVar);
- try
- {
- taskId = Integer.parseInt(taskidenvvar);
- } catch (Exception e)
- {
- ServiceContext.Logger.traceEvent(Level.SEVERE,
- StringResource.getResource("CantFindTaskId"));
- return ErrorCode.ServiceHost_UnexpectedException;
- }
-
- ServiceContext.Logger.traceEvent(Level.ALL,
- "[HpcServiceHost]: Task Id = " + taskId);
-
- String procnumenvvar = Environment
- .getEnvironmentVariable(Constant.ProcNumEnvVar);
- try
- {
- procNum = Integer.parseInt(procnumenvvar);
- } catch (Exception e)
- {
- ServiceContext.Logger.traceEvent(Level.SEVERE,
- StringResource.getResource("CantFindProcNum"));
- return ErrorCode.ServiceHost_UnexpectedException;
- }
-
- ServiceContext.Logger.traceEvent(Level.ALL,
- "[HpcServiceHost]: Number of processors (service capability) = "
- + procNum);
-
- String strServiceInitializationTimeout = Environment
- .getEnvironmentVariable(Constant.ServiceInitializationTimeoutEnvVar);
- try
- {
- retryTimeoutInMilliSecond = Integer
- .parseInt(strServiceInitializationTimeout);
- } catch (Exception e)
- {
- ServiceContext.Logger
- .traceEvent(
- Level.WARNING,
- "[HpcServiceHost]: invalid serviceInitializationTimeout value. Fall back to default value = 60s");
- retryTimeoutInMilliSecond = defaultRetryTimeout;
- }
-
- String cancelTaskGracePeriodEnvVarStr = Environment
- .getEnvironmentVariable(Constant.CancelTaskGracePeriodEnvVar);
- try
- {
- cancelTaskGracePeriod = Integer
- .parseInt(cancelTaskGracePeriodEnvVarStr);
- // Convert to millisecond from second
- cancelTaskGracePeriod *= 1000;
-
- } catch (Exception e)
- {
- cancelTaskGracePeriod = 0;
- }
-
- ServiceContext.Logger.traceEvent(Level.INFO,
- "[HpcServiceHost]: Cancel Task Grace Period = "
- + cancelTaskGracePeriod);
-
- // parse the coreID list to get the first allocate core
- // the core ids is like "0 1 2 5" if allocate 4 cores
- String CoreIds = Environment.getEnvironmentVariable(Constant.CoreIdsEnvVar);
- try
- {
- String[] cores = CoreIds.split(" ");
- portOffset = Integer.parseInt(cores[0]);
- } catch (Exception e)
- {
- ServiceContext.Logger.traceEvent(Level.WARNING,
- "[HpcServiceHost]: Fail to get CoreId use default value.");
- }
- ServiceContext.Logger.traceEvent(Level.INFO,
- "[HpcServiceHost]: First Allocated CoreId = " + portOffset);
-
- // get the preemption switcher from the env var, the default value is
- // true.
- String preemption = Environment
- .getEnvironmentVariable(Constant.EnableMessageLevelPreemptionEnvVar);
- try
- {
- enableMessageLevelPreemption = Boolean.parseBoolean(preemption);
- } catch (Exception e)
- {
- this.enableMessageLevelPreemption = true;
- }
- ServiceContext.Logger.traceEvent(Level.INFO,
- "[HpcServiceHost]: EnableMessageLevelPreemption = "
- + enableMessageLevelPreemption);
-
- return ErrorCode.Success;
- }
-
- private void invokeInitializeControlBreakHandler()
- {
- this.shutdownThread = new ShutdownThread(this);
- Runtime.getRuntime().addShutdownHook(this.shutdownThread);
- }
-
- public void openDummyService() throws UnknownHostException
- {
- getEnvironmentVariables();
- RunAsDummy();
- }
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Set up the Java Servie Host.
+// Host the Customer's Jar or Dummy Service
+// Host the Controller Service
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.servicehost;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.soap.AddressingFeature;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
+import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
+import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
+import org.apache.cxf.ws.addressing.MAPAggregator;
+import org.apache.cxf.ws.addressing.WSAddressingFeature;
+import org.apache.cxf.ws.addressing.soap.MAPCodec;
+
+import com.microsoft.hpc.properties.ErrorCode;
+import com.microsoft.hpc.scheduler.session.Constant;
+import com.microsoft.hpc.scheduler.session.servicecontext.Environment;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration;
+import com.microsoft.hpc.scheduler.session.servicecontext.StringResource;
+import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper;
+
+/**
+ * @author t-junchw
+ * @date May 9, 2011
+ * @description Wrapper class for the construction of host service and
+ * controller service
+ */
+public class HpcServiceHostWrapper
+{
+
+ /**
+ * @field Represents how an endpoint address is finalructed
+ * http://.://
+ */
+ private final String BaseAddrTemplate = "http://%s:%s/%s/%s";
+
+ /**
+ * @field Timeout for Exiting event to execute. This must be the same as
+ * node manager's default CTRL+C timeout
+ */
+ private int cancelTaskGracePeriod = Constant.DefaultCancelTaskGracePeriod;
+
+ private int jobId;
+ private int taskId;
+ private int procNum;
+
+ /**
+ * @field CXF service retry Time out In MilliSecond
+ */
+ private int retryTimeoutInMilliSecond;
+
+ /**
+ * @field 60 second
+ */
+ private final int defaultRetryTimeout = 60 * 1000;
+
+ /**
+ * @field The real jar service host
+ */
+ public JaxWsServerFactoryBean host;
+
+ /**
+ * @field the controller service
+ */
+ public JaxWsServerFactoryBean controllerhost;
+
+ /**
+ * @field Enable the new feature MessageLevelPreemption or not.
+ */
+ public boolean enableMessageLevelPreemption;
+
+ /**
+ * @field This flag is set when host receives Ctrl-C event.
+ */
+ public boolean receivedCancelEvent;
+
+ /**
+ * @field object used for synchronization
+ */
+ public Object syncObjOnExitingCalled = new Object();
+
+ /**
+ * @field This flag indicates if the OnExiting event is triggered.
+ */
+ public boolean isOnExitingCalled = false;
+
+ /**
+ * @field This list stores ids of messages which are invoking the hosted
+ * service. When the response is sent back to the broker, the id is
+ * removed from this list. If a message come to host after Ctrl-C
+ * event, its id won't be saved in this list.
+ */
+ public List processingMessageIds = Collections
+ .synchronizedList(new ArrayList());
+
+ /**
+ * @field the offset to the port
+ */
+ private int portOffset;
+
+ /**
+ * @field the service registration
+ */
+ private ServiceRegistration serviceRegistration;
+
+ /**
+ * @field Http receive Timeout
+ */
+ private long receiveTimeout;
+
+ /**
+ * @field times to retry to host the user service
+ */
+ private int retrytimes = 3;
+
+ /**
+ * @field Ctrl-C hook
+ */
+ public ShutdownThread shutdownThread;
+
+ public HpcServiceHostWrapper(ServiceRegistration serviceRegistration)
+ {
+ this.serviceRegistration = serviceRegistration;
+
+ // Initialize Ctrl-C handler to receive shutdown events from node
+ // manager
+ this.invokeInitializeControlBreakHandler();
+ }
+
+ /**
+ * @description method to host the service
+ * @throws InterruptedException
+ * @throws UnknownHostException
+ */
+ public void publish() throws InterruptedException, UnknownHostException
+ {
+ String errorMsg = null;
+
+ int errorCode = ErrorCode.Success;
+ errorCode = getEnvironmentVariables();
+
+ // initially retry wait period is 0.5 second
+ long retryWaitPeriodInMilliSecond = 500;
+
+ if (errorCode != ErrorCode.Success)
+ {
+ return;
+ }
+
+ int retry = 0;
+ long serviceStartTime = System.currentTimeMillis();
+ while (true)
+ {
+ try
+ {
+ // try to host the user jar
+ errorCode = RunInternal();
+
+ if (retry == Integer.MAX_VALUE)
+ {
+ retry = 0;
+ } else
+ {
+ retry++;
+ }
+
+ if (errorCode != ErrorCode.Success)
+ {
+ if (errorCode < ErrorCode.ServiceHost_ExitCode_Start
+ || errorCode > ErrorCode.ServiceHost_ExitCode_End)
+ {
+ errorCode = ErrorCode.ServiceHost_UnexpectedException;
+ }
+
+ errorMsg = StringResource
+ .getResource("FailedInStartingService");
+ ServiceContext.Logger.traceEvent(Level.SEVERE, errorMsg);
+ }
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.getMessage());
+ errorCode = ErrorCode.ServiceHost_UnexpectedException;
+ errorMsg = e.getMessage();
+ }
+
+ if (errorCode == ErrorCode.ServiceHost_AssemblyLoadingError
+ || errorCode == ErrorCode.ServiceHost_NoContractImplemented)
+ {
+ if (retry >= retrytimes)
+ {
+ break;
+ }
+ }
+
+ if (errorCode == ErrorCode.Success)
+ {
+ break;
+ }
+
+ long serviceStopTime = System.currentTimeMillis();
+
+ // if retry timeout is reached, work is done
+ long elapsedStartTimeInMilliSecond = serviceStopTime
+ - serviceStartTime;
+ if (elapsedStartTimeInMilliSecond > retryTimeoutInMilliSecond)
+ {
+ break;
+ }
+
+ serviceStartTime = System.currentTimeMillis();
+
+ if (elapsedStartTimeInMilliSecond + retryWaitPeriodInMilliSecond > retryTimeoutInMilliSecond)
+ {
+ retryWaitPeriodInMilliSecond = retryTimeoutInMilliSecond
+ - elapsedStartTimeInMilliSecond;
+ }
+
+ ServiceContext.Logger.traceEvent(Level.INFO, String.format(
+ "Wait %s milliseconds and retry",
+ retryWaitPeriodInMilliSecond));
+
+ TraceHelper.traceInformation(String.format(
+ "Wait %d milliseconds and retry.",
+ retryWaitPeriodInMilliSecond));
+
+ // wait and retry
+ Thread.sleep(retryWaitPeriodInMilliSecond);
+
+ // back off
+ retryWaitPeriodInMilliSecond *= 2;
+ }
+ if (errorCode != ErrorCode.Success)
+ {
+ RunAsDummy();
+ }
+ }
+
+ /**
+ * @description host the dummy service method invoked when failed to host
+ * the user jar
+ * @throws UnknownHostException
+ */
+ private void RunAsDummy() throws UnknownHostException
+ {
+
+ String defaultBaseAddr = createEndpointAddress(Constant.ServiceHostPort
+ + portOffset);
+ TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr);
+
+ // destroy the existing host
+ if (host != null)
+ {
+ try
+ {
+ host.getServer().destroy();
+ } catch (Exception e)
+ {
+ // do nothing
+ }
+ }
+
+ host = null;
+ try
+ {
+ DummyProvider dummyService = new DummyProvider();
+
+ host = new JaxWsServerFactoryBean();
+ String listenUri = defaultBaseAddr + "/_defaultEndpoint/";
+ TraceHelper.traceInformation("listenUri = " + listenUri);
+ host.setAddress(listenUri);
+ host.setServiceBean(dummyService);
+
+ // log the in/out bound message
+ host.getInInterceptors().add(new LoggingInInterceptor());
+ host.getOutInterceptors().add(new LoggingOutInterceptor());
+
+ TraceHelper.traceInformation(StringResource
+ .getResource("TryCreateHost"));
+ Server server = host.create();
+
+ JettyHTTPDestination destination = (JettyHTTPDestination) server
+ .getDestination();
+ // Update back end binding's receive timeout with global settings if
+ // they are enabled
+ // update the Service setting
+ getServiceSettings();
+ HTTPServerPolicy httpServerPolicy = new HTTPServerPolicy();
+ httpServerPolicy.setReceiveTimeout(receiveTimeout);
+ destination.setServer(httpServerPolicy);
+
+ TraceHelper.traceInformation(StringResource
+ .getResource("TryOpenCtrlHost"));
+ String endpointAddress = createEndpointAddress(Constant.ServiceHostControllerPort
+ + portOffset);
+ OpenHostController(endpointAddress);
+
+ ServiceContext.Logger.traceEvent(Level.INFO, String.format(
+ "[HpcServiceHost]: Dummy service opened on %s", listenUri));
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ ServiceContext.Logger.traceEvent(Level.SEVERE,
+ String.format("[HpcServiceHost]: " + e.toString()));
+
+ if (host != null)
+ {
+ try
+ {
+ host.getServer().destroy();
+ } catch (Exception ex)
+ {
+ // do nothing
+ }
+ }
+ }
+ }
+
+ /**
+ * @description Open the service host. All exceptions will be directly
+ * thrown out. So the outer program must know how to deal with
+ * those exceptions.
+ * @return error code
+ */
+ private int RunInternal()
+ {
+ ServiceContext.Logger.traceEvent(Level.ALL,
+ "[HpcServiceHost]: Start opening");
+
+ // Load the service jar from the specified path
+ JarClassLoader jarClassLoader = null;
+
+
+ try
+ {
+ jarClassLoader = new JarClassLoader(
+ serviceRegistration.serviceAssemblyFullPath);
+ ServiceContext.Logger.traceEvent(Level.ALL,
+ "[HpcServiceHost]: Jar is loaded.");
+ } catch (IOException e)
+ {
+ TraceHelper.traceError(e.getMessage());
+ return ErrorCode.ServiceHost_AssemblyLoadingError;
+ }
+
+ boolean isimplemented = false;
+ Class> userclass = null;
+ try
+ {
+ // if the user specify the ServiceTypeName
+ if (serviceRegistration.getServiceTypeName() != null)
+ {
+ userclass = jarClassLoader
+ .loadClass(serviceRegistration.serviceTypeName);
+ // if the user specify the ServiceContractName
+ if (serviceRegistration.getServiceContractName() != null)
+ {
+ Class>[] userinterfacesClass = userclass.getInterfaces();
+ for (Class> tempinterface : userinterfacesClass)
+ {
+ if (tempinterface.getName() == serviceRegistration
+ .getServiceContractName())
+ {
+ isimplemented = true;
+ break;
+ }
+ }
+ }
+ if (!isimplemented)
+ {
+ String message = String.format(StringResource
+ .getResource("CantFindServiceContract"),
+ serviceRegistration.serviceContractName,
+ serviceRegistration.serviceAssemblyFileName);
+ TraceHelper.traceError(message);
+ ServiceContext.Logger.traceEvent(Level.SEVERE, message);
+ return ErrorCode.ServiceHost_NoContractImplemented;
+ }
+ }
+ // if the user only specify the ServiceTypeName
+ else if (serviceRegistration.getServiceContractName() != null)
+ {
+ userclass = jarClassLoader
+ .loadClassbyInterface(serviceRegistration
+ .getServiceContractName());
+ }
+ // Try to auto discover the service contract interface from the jar
+ else
+ {
+ userclass = jarClassLoader.findClass();
+ }
+ } catch (ClassNotFoundException e)
+ {
+ TraceHelper.traceError(e.getMessage());
+ return ErrorCode.ServiceHost_ServiceTypeDiscoverError;
+ }
+
+ String defaultBaseAddr = null;
+ try
+ {
+ defaultBaseAddr = createEndpointAddress(Constant.ServiceHostPort
+ + portOffset);
+ } catch (UnknownHostException e)
+ {
+ TraceHelper.traceError(e.toString());
+ return ErrorCode.ServiceHost_UnexpectedException;
+ }
+ TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr);
+
+ String listenUri = defaultBaseAddr + "/_defaultEndpoint";
+ TraceHelper.traceInformation("listenUri = " + listenUri);
+
+ try
+ {
+ host = new JaxWsServerFactoryBean();
+ if(serviceRegistration.getEnableWSAddressing() == true)
+ {
+ // add ws-addressing feature
+ host.getFeatures().add(new WSAddressingFeature());
+ }
+
+ host.setAddress(listenUri);
+ host.setServiceBean(userclass.newInstance());
+
+ LoggingInInterceptor login = new LoggingInInterceptor();
+ LoggingOutInterceptor logout = new LoggingOutInterceptor();
+ // log the in/out bound message
+ host.getInInterceptors().add(login);
+ host.getOutInterceptors().add(logout);
+ host.getOutFaultInterceptors().add(logout);
+ host.getOutFaultInterceptors().add(
+ new AddHeaderOutInterceptor(this));
+
+
+ // if users specify the WSDL location, try to find it from jar
+ WebService annotation = userclass
+ .getAnnotation(javax.jws.WebService.class);
+ String wSDLLocation = null;
+ if (annotation != null)
+ wSDLLocation = annotation.wsdlLocation();
+ String folder = "";
+ if (wSDLLocation != null && !wSDLLocation.isEmpty())
+ {
+ wSDLLocation = wSDLLocation.substring(wSDLLocation
+ .indexOf("file:") + 5);
+ int index = serviceRegistration.getServiceAssemblyFullPath()
+ .lastIndexOf('\\');
+
+ if (index == -1)
+ index = serviceRegistration.getServiceAssemblyFullPath()
+ .lastIndexOf("/");
+ folder = serviceRegistration.getServiceAssemblyFullPath()
+ .substring(0, index + 1);
+ host.setWsdlLocation(folder + wSDLLocation);
+ }
+
+ // Add interceptors if the config enables the message
+ // level preemption.
+ if (this.enableMessageLevelPreemption == true)
+ {
+ host.getInInterceptors().add(
+ new MessagePreemptionInInterceptor(this));
+ host.getOutInterceptors().add(
+ new MessagePreemptionOutInterceptor(this));
+ }
+
+ //enable the debug to stack trace in fault soap message
+ host.getBus().setProperty( "faultStackTraceEnabled", "true");
+ TraceHelper.traceInformation(StringResource
+ .getResource("TryCreateHost"));
+ Server server = host.create();
+
+ // Update backend binding's receive timeout and max message settings
+ // with global settings if they are enabled
+ // update the Service setting
+ getServiceSettings();
+ JettyHTTPDestination destination = (JettyHTTPDestination) server
+ .getDestination();
+
+ // Configure Jetty server max idle time out
+ JettyHTTPServerEngine engine = (JettyHTTPServerEngine) destination.getEngine();
+ engine.getConnector().setMaxIdleTime((int)receiveTimeout);
+
+ HTTPServerPolicy httpServerPolicy = new HTTPServerPolicy();
+ httpServerPolicy.setReceiveTimeout(receiveTimeout);
+
+ ServiceContext.Logger.traceEvent(Level.ALL, "Service Operation Timeout"+receiveTimeout);
+ destination.setServer(httpServerPolicy);
+
+ TraceHelper.traceInformation("Service host successfully opened on "
+ + listenUri);
+
+ TraceHelper.traceInformation(StringResource
+ .getResource("TryOpenCtrlHost"));
+ String endpointAddress = createEndpointAddress(Constant.ServiceHostControllerPort
+ + portOffset);
+ OpenHostController(endpointAddress);
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ TraceHelper.traceStackError(e);
+ ServiceContext.Logger.traceEvent(Level.SEVERE, "[HpcServiceHost]: "
+ + e.toString());
+
+ return ErrorCode.ServiceHost_ServiceHostFailedToOpen;
+ }
+
+ ServiceContext.Logger.traceEvent(Level.INFO, String.format(
+ "[HpcServiceHost]: Service host successfully opened on %s ",
+ listenUri));
+
+ TraceHelper.traceInformation("Service host successfully opened on "
+ + listenUri);
+
+ return ErrorCode.Success;
+ }
+
+ /**
+ * @description opens the service host controller service
+ * @remark port disabled sharing on CNs/WNs, we need to open another port
+ * @param defaultBaseAddr
+ */
+ private void OpenHostController(String defaultBaseAddr)
+ {
+ TraceHelper.traceInformation("defaultBaseAddr of HostController is "
+ + defaultBaseAddr);
+
+ // Open the Control Service Host;
+ TraceHelper.traceInformation("Created ServiceHost for controller.");
+ HpcControllerSvc ControllerService = new HpcControllerSvc(this.jobId,
+ cancelTaskGracePeriod, this);
+
+ TraceHelper.traceInformation("defaultBaseAddr = " + defaultBaseAddr);
+ controllerhost = new JaxWsServerFactoryBean();
+
+ String listenUri = defaultBaseAddr + "/_defaultEndpoint/";
+ TraceHelper.traceInformation("listenUri = " + listenUri);
+
+ TraceHelper.traceInformation("Adding endpoint to controller.");
+ controllerhost.setAddress(listenUri);
+ controllerhost.setServiceBean(ControllerService);
+
+
+ // log the in/out bound message
+ controllerhost.getInInterceptors().add(new LoggingInInterceptor());
+ controllerhost.getOutInterceptors().add(new LoggingOutInterceptor());
+
+ TraceHelper.traceInformation(StringResource
+ .getResource("TryCreateCtrlHost"));
+ controllerhost.create();
+ TraceHelper.traceInformation("Controller opened.");
+
+ }
+
+ /**
+ * @description create the end point address for the service
+ * @param port
+ * @return
+ * @throws UnknownHostException
+ */
+ private String createEndpointAddress(int port) throws UnknownHostException
+ {
+ // The format of default base addr:
+ // http://.://
+
+ String jarNetworkPrefix = Environment
+ .getEnvironmentVariable(Constant.NetworkPrefixEnv);
+ ServiceContext.Logger.traceEvent(Level.ALL,
+ "[HpcServiceHost]: Java network prefix = " + jarNetworkPrefix);
+
+ String hostnameWithPrefix = InetAddress.getLocalHost().getHostName();
+ if (jarNetworkPrefix != null && !jarNetworkPrefix.isEmpty())
+ {
+ hostnameWithPrefix = String.format("%s.%s", jarNetworkPrefix,
+ hostnameWithPrefix);
+ }
+
+ return String.format(BaseAddrTemplate, hostnameWithPrefix, port, jobId,
+ taskId);
+ }
+
+
+ /**
+ * @description Get service's service operation Timeout
+ */
+ private void getServiceSettings()
+ {
+ String serviceOperationTimeoutString = Environment
+ .getEnvironmentVariable(Constant.ServiceConfigServiceOperatonTimeoutEnvVar);
+ try
+ {
+ receiveTimeout = Integer.parseInt(serviceOperationTimeoutString);
+ } catch (NumberFormatException e)
+ {
+ ServiceContext.Logger
+ .traceEvent(
+ Level.ALL,
+ "[HpcServiceHost]: Error retrieving ServiceOperationTimeout. Defaulting to binding's default - "
+ + e.toString());
+ TraceHelper.traceError(e.getMessage());
+ receiveTimeout = Constant.DefaultServiceOperationTimeout;
+ }
+ }
+
+ /**
+ * @description get environment variables
+ * jobID
+ * taskTD
+ * CoreId
+ * procNum
+ * cancelTaskGracePeriod
+ * enableMessageLevelPreemption
+ * @return error code
+ */
+ private int getEnvironmentVariables()
+ {
+ String jobidenvvar = Environment.getEnvironmentVariable(Constant.JobIDEnvVar);
+ try
+ {
+ jobId = Integer.parseInt(jobidenvvar);
+
+ } catch (Exception e)
+ {
+ ServiceContext.Logger.traceEvent(Level.SEVERE,
+ StringResource.getResource("CantFindJobId"));
+ return ErrorCode.ServiceHost_UnexpectedException;
+ }
+
+ ServiceContext.Logger.traceEvent(Level.ALL,
+ "[HpcServiceHost]: Job Id = " + jobId);
+
+ String taskidenvvar = Environment.getEnvironmentVariable(Constant.TaskSystemIDEnvVar);
+ try
+ {
+ taskId = Integer.parseInt(taskidenvvar);
+ } catch (Exception e)
+ {
+ ServiceContext.Logger.traceEvent(Level.SEVERE,
+ StringResource.getResource("CantFindTaskId"));
+ return ErrorCode.ServiceHost_UnexpectedException;
+ }
+
+ ServiceContext.Logger.traceEvent(Level.ALL,
+ "[HpcServiceHost]: Task Id = " + taskId);
+
+ String procnumenvvar = Environment
+ .getEnvironmentVariable(Constant.ProcNumEnvVar);
+ try
+ {
+ procNum = Integer.parseInt(procnumenvvar);
+ } catch (Exception e)
+ {
+ ServiceContext.Logger.traceEvent(Level.SEVERE,
+ StringResource.getResource("CantFindProcNum"));
+ return ErrorCode.ServiceHost_UnexpectedException;
+ }
+
+ ServiceContext.Logger.traceEvent(Level.ALL,
+ "[HpcServiceHost]: Number of processors (service capability) = "
+ + procNum);
+
+ String strServiceInitializationTimeout = Environment
+ .getEnvironmentVariable(Constant.ServiceInitializationTimeoutEnvVar);
+ try
+ {
+ retryTimeoutInMilliSecond = Integer
+ .parseInt(strServiceInitializationTimeout);
+ } catch (Exception e)
+ {
+ ServiceContext.Logger
+ .traceEvent(
+ Level.WARNING,
+ "[HpcServiceHost]: invalid serviceInitializationTimeout value. Fall back to default value = 60s");
+ retryTimeoutInMilliSecond = defaultRetryTimeout;
+ }
+
+ String cancelTaskGracePeriodEnvVarStr = Environment
+ .getEnvironmentVariable(Constant.CancelTaskGracePeriodEnvVar);
+ try
+ {
+ cancelTaskGracePeriod = Integer
+ .parseInt(cancelTaskGracePeriodEnvVarStr);
+ // Convert to millisecond from second
+ cancelTaskGracePeriod *= 1000;
+
+ } catch (Exception e)
+ {
+ cancelTaskGracePeriod = 0;
+ }
+
+ ServiceContext.Logger.traceEvent(Level.INFO,
+ "[HpcServiceHost]: Cancel Task Grace Period = "
+ + cancelTaskGracePeriod);
+
+ // parse the coreID list to get the first allocate core
+ // the core ids is like "0 1 2 5" if allocate 4 cores
+ String CoreIds = Environment.getEnvironmentVariable(Constant.CoreIdsEnvVar);
+ try
+ {
+ String[] cores = CoreIds.split(" ");
+ portOffset = Integer.parseInt(cores[0]);
+ } catch (Exception e)
+ {
+ ServiceContext.Logger.traceEvent(Level.WARNING,
+ "[HpcServiceHost]: Fail to get CoreId use default value.");
+ }
+ ServiceContext.Logger.traceEvent(Level.INFO,
+ "[HpcServiceHost]: First Allocated CoreId = " + portOffset);
+
+ // get the preemption switcher from the env var, the default value is
+ // true.
+ String preemption = Environment
+ .getEnvironmentVariable(Constant.EnableMessageLevelPreemptionEnvVar);
+ try
+ {
+ enableMessageLevelPreemption = Boolean.parseBoolean(preemption);
+ } catch (Exception e)
+ {
+ this.enableMessageLevelPreemption = true;
+ }
+ ServiceContext.Logger.traceEvent(Level.INFO,
+ "[HpcServiceHost]: EnableMessageLevelPreemption = "
+ + enableMessageLevelPreemption);
+
+ return ErrorCode.Success;
+ }
+
+ private void invokeInitializeControlBreakHandler()
+ {
+ this.shutdownThread = new ShutdownThread(this);
+ Runtime.getRuntime().addShutdownHook(this.shutdownThread);
+ }
+
+ public void openDummyService() throws UnknownHostException
+ {
+ getEnvironmentVariables();
+ RunAsDummy();
+ }
+}
diff --git a/src/com/microsoft/hpc/servicehost/InterceptorUtility.java b/src/com/microsoft/hpc/servicehost/InterceptorUtility.java
index 4122664..352461a 100644
--- a/src/com/microsoft/hpc/servicehost/InterceptorUtility.java
+++ b/src/com/microsoft/hpc/servicehost/InterceptorUtility.java
@@ -1,161 +1,213 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Utility for service host
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.servicehost;
-
-import java.util.List;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.cxf.binding.soap.SoapHeader;
-import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.headers.Header;
-import org.apache.cxf.helpers.DOMUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import com.microsoft.hpc.scheduler.session.Constant;
-
-/**
- * @author t-junchw
- * @date May 9, 2011
- * @description utility for CXF interceptor
- */
-public final class InterceptorUtility
-{
-
- /**
- * @description add message header
- * @param message
- * @param name
- * @param namespace
- * @param data
- */
- static public void addMessageHeader(SoapMessage message, String name,
- String namespace, Object data)
- {
- Document document = DOMUtils.createDocument();
- Element root = document.createElementNS(namespace, name);
- root.setTextContent(data.toString());
-
- List headers = message.getHeaders();
- QName headname = new QName(namespace, name);
- SoapHeader header = new SoapHeader(headname, root);
- headers.add(header);
- }
-
- /**
- * @description create fault message detail
- * @param sessionFault
- * @return
- */
- public static Element createDetailElement(com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault sessionFault)
- {
- Element detail = null;
- try
- {
- Document detailDocument = DOMUtils.createDocument();
- detail = detailDocument.createElement("detail");
- Document doc = DOMUtils.createDocument();
- JAXBContext jaxbContext = JAXBContext
- .newInstance(com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault.class);
-
- // Java Class converted to XML
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.marshal(sessionFault, doc);
-
- Node DocImportedNode = detailDocument.importNode(
- doc.getDocumentElement(), true);
- detail.appendChild(DocImportedNode);
-
- if (DocImportedNode.getLocalName().equals("SessionFault"))
- {
- // SessionFault
- Attr sessionAttr = detailDocument.createAttribute("xmlns:i");
- sessionAttr
- .setValue(Constant.XMLSchemaInstanceNS);
- DocImportedNode.getAttributes().setNamedItem(sessionAttr);
- }
-
- // debug the jaxb convert result
- TransformerFactory tfactory = TransformerFactory.newInstance();
- Transformer transformer = tfactory.newTransformer();
- DOMSource source = new DOMSource(doc);
- transformer.transform(source, new StreamResult(System.out));
-
- return detail;
- } catch (Exception e)
- {
- return detail;
- }
- }
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Utility for service host
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.servicehost;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.cxf.binding.soap.SoapHeader;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.helpers.DOMUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import com.microsoft.hpc.scheduler.session.Constant;
+import com.microsoft.hpc.session.RetryOperationError;
+
+/**
+ * @author t-junchw
+ * @date May 9, 2011
+ * @description utility for CXF interceptor
+ */
+public final class InterceptorUtility
+{
+
+ /**
+ * @description add message header
+ * @param message
+ * @param name
+ * @param namespace
+ * @param data
+ */
+ static public void addOrUpdateMessageHeader(SoapMessage message, String name,
+ String namespace, Object data)
+ {
+ Document document = DOMUtils.createDocument();
+ Element root = document.createElementNS(namespace, name);
+ root.setTextContent(data.toString());
+
+ QName headname = new QName(namespace, name);
+ SoapHeader header = null;
+ List headers = message.getHeaders();
+ for(Header h : headers)
+ {
+ if (h.getName().getLocalPart() == name &&
+ h.getName().getNamespaceURI() == namespace) {
+ header = (SoapHeader) h;
+ break;
+ }
+ }
+ if(header == null) {
+ header = new SoapHeader(headname, root);
+ headers.add(header);
+ } else {
+ ((Element)header.getObject()).setTextContent(data.toString());
+ }
+
+ }
+
+ /**
+ * @description create fault message detail
+ * @param sessionFault
+ * @return
+ */
+ public static Element createDetailElement(com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault sessionFault)
+ {
+ Element detail = null;
+ try
+ {
+ Document detailDocument = DOMUtils.createDocument();
+ detail = detailDocument.createElement("detail");
+ Document doc = DOMUtils.createDocument();
+ JAXBContext jaxbContext = JAXBContext
+ .newInstance(com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault.class);
+
+ // Java Class converted to XML
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.marshal(sessionFault, doc);
+
+ Node DocImportedNode = detailDocument.importNode(
+ doc.getDocumentElement(), true);
+ detail.appendChild(DocImportedNode);
+
+ if (DocImportedNode.getLocalName().equals("SessionFault"))
+ {
+ // SessionFault
+ Attr sessionAttr = detailDocument.createAttribute("xmlns:i");
+ sessionAttr
+ .setValue(Constant.XMLSchemaInstanceNS);
+ DocImportedNode.getAttributes().setNamedItem(sessionAttr);
+ }
+
+ // debug the jaxb convert result
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ Transformer transformer = tfactory.newTransformer();
+ DOMSource source = new DOMSource(doc);
+ transformer.transform(source, new StreamResult(System.out));
+
+ return detail;
+ } catch (Exception e)
+ {
+ return detail;
+ }
+ }
+
+ /**
+ * @description create fault message detail
+ * @param sessionFault
+ * @return
+ */
+ public static Element createDetailElement(RetryOperationError error)
+ {
+ Element detail = null;
+ try
+ {
+ Document detailDocument = DOMUtils.createDocument();
+ detail = detailDocument.createElement("detail");
+ Document doc = DOMUtils.createDocument();
+ JAXBContext jaxbContext = JAXBContext
+ .newInstance(RetryOperationError.class);
+
+ // Java Class converted to XML
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.marshal(error, doc);
+
+ Node DocImportedNode = detailDocument.importNode(
+ doc.getDocumentElement(), true);
+ detail.appendChild(DocImportedNode);
+
+ // debug the jaxb convert result
+ TransformerFactory tfactory = TransformerFactory.newInstance();
+ Transformer transformer = tfactory.newTransformer();
+ DOMSource source = new DOMSource(doc);
+ transformer.transform(source, new StreamResult(System.out));
+
+ return detail;
+ } catch (Exception e)
+ {
+ return detail;
+ }
+ }
+}
diff --git a/src/com/microsoft/hpc/servicehost/Main.java b/src/com/microsoft/hpc/servicehost/Main.java
index 4951e14..0d3fd32 100644
--- a/src/com/microsoft/hpc/servicehost/Main.java
+++ b/src/com/microsoft/hpc/servicehost/Main.java
@@ -1,315 +1,315 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// the set-up method for the java service host
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.servicehost;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.text.ParseException;
-import java.util.concurrent.atomic.AtomicReference;
-import com.microsoft.hpc.properties.ErrorCode;
-import com.microsoft.hpc.scheduler.session.Constant;
-import com.microsoft.hpc.scheduler.session.servicecontext.Environment;
-import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration;
-import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistrationRepo;
-import com.microsoft.hpc.scheduler.session.servicecontext.StringResource;
-import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper;
-
-/**
- * @author t-junchw
- * @date May 9, 2011
- * @description entry point of service host
- */
-public class Main
-{
- /**
- * @param args
- * java -jar Microsoft-HpcHost-3.0.jar
- * /JobId jid /TaskSystemId tid /CoreId cid
- * /RegistrationFileName filename /RegistrationPath path
- * /Ccp_Data ccpdata /TaskInstanceId taskinstancsid
- * @throws IOException
- */
- public static void main(String[] args) throws IOException
- {
-
- TraceHelper.traceInformation("HpcServiceHost entry point is called.");
-
- AtomicReference exitCode = new AtomicReference(0);
- if (RunPrePostTask(exitCode))
- {
- // return the exitcode
- System.exit(Integer.parseInt(exitCode.get().toString()));
- }
-
- // jar running without a job
- if (args.length > 0)
- {
- // set the debug mode true
- Environment.isDebug = true;
-
- ParameterContainer param = new ParameterContainer(args);
- try
- {
- if (param.printHelp())
- {
- System.exit(ErrorCode.ServiceHost_PrintCommandHelp);
- } else
- {
- param.Parse();
- }
- } catch (ParseException e)
- {
- TraceHelper.traceError(e.toString());
- System.exit(ErrorCode.ServiceHost_IncorrectCommandLineParameter);
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- System.exit(ErrorCode.ServiceHost_UnexpectedException);
- }
-
- // set the Environment Variable for the debug
- Environment.setEnvironmentVariable(Constant.JobIDEnvVar, param.getJobIdParameter().getValue().toString());
- Environment.setEnvironmentVariable(Constant.TaskSystemIDEnvVar, param.getJobIdParameter().getValue().toString());
- Environment.setEnvironmentVariable(Constant.CoreIdsEnvVar, param.getCoreIdParameter().getValue().toString());
- Environment.setEnvironmentVariable(Constant.RegistryPathEnv, param.getPathParameter().getValue());
- Environment.setEnvironmentVariable(Constant.ServiceConfigFileNameEnvVar, param.getFileNameParameter()
- .getValue());
- Environment.setEnvironmentVariable(Constant.CCP_DATAEnvVar, param.getCCPDATAParameter().getValue());
- Environment.setEnvironmentVariable(Constant.TASKINSTANCEIDEnvVar, param.getTaskinstanceIdParameter()
- .getValue().toString());
- // use default values for following environment variables
- Environment.setEnvironmentVariable(Constant.ProcNumEnvVar, "1");
- Environment.setEnvironmentVariable(Constant.NetworkPrefixEnv, Constant.EnterpriseNetwork);
- Environment.setEnvironmentVariable(Constant.ServiceInitializationTimeoutEnvVar, "60000");
- Environment.setEnvironmentVariable(Constant.CancelTaskGracePeriodEnvVar, "15");
- Environment.setEnvironmentVariable(Constant.ServiceConfigServiceOperatonTimeoutEnvVar, "86400000");
- }
-
- String serviceConfigFullPath;
- HpcServiceHostWrapper hpcServiceHostWrapper = null;
- boolean isOpenDummy = false;
- try
- {
- String serviceConfigFileName = Environment.getEnvironmentVariable(Constant.ServiceConfigFileNameEnvVar);
-
- // exit if there is not such env var
- if (serviceConfigFileName == null || serviceConfigFileName.isEmpty())
- {
- isOpenDummy = true;
- TraceHelper.traceError(StringResource.getResource("ServiceConfigFileNameNotSpecified"));
- throw new Exception(String.valueOf(ErrorCode.ServiceHost_ServiceConfigFileNameNotSpecified));
- }
-
- //get the service config file full path
- serviceConfigFullPath = GetServiceInfo(serviceConfigFileName);
- if (!new File(serviceConfigFullPath).exists())
- {
- isOpenDummy = true;
- TraceHelper.traceError(StringResource
- .getResource("CantFindServiceRegistrationFileserviceConfigFullPath"));
- throw new Exception(String.valueOf(ErrorCode.ServiceHost_ServiceRegistrationFileNotFound));
- }
-
- TraceHelper.traceInformation("serviceConfigFullPath = " + serviceConfigFullPath);
-
- //import the configuration to the service registration
- ServiceRegistration serviceRegistration = Utility.getServiceRegistration(serviceConfigFullPath, exitCode);
- if ((Integer) exitCode.get() != ErrorCode.Success)
- {
- isOpenDummy = true;
- throw new Exception(exitCode.get().toString());
- }
-
- // Open the host
- hpcServiceHostWrapper = new HpcServiceHostWrapper(serviceRegistration);
- hpcServiceHostWrapper.publish();
-
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- TraceHelper.traceStackError(e);
- }
- finally
- {
- if(isOpenDummy)
- {
- if(hpcServiceHostWrapper==null)
- {
- hpcServiceHostWrapper = new HpcServiceHostWrapper(new ServiceRegistration());
- }
- hpcServiceHostWrapper.openDummyService();
- }
- }
- }
-
- /**
- * @description get the service config file full path by the file name
- * @param serviceConfigFileName
- * @return service config file full path
- */
- private static String GetServiceInfo(String serviceConfigFileName)
- {
- String serviceConfigFile = null;
-
- try
- {
-
- String headnode = Environment.getEnvironmentVariable(Constant.HeadnodeEnvVar);
- TraceHelper.traceInformation(Environment.getEnvironmentVariable(Constant.RegistryPathEnv));
- ServiceRegistrationRepo serviceRegistration = new ServiceRegistrationRepo(headnode,
- Environment.getEnvironmentVariable(Constant.RegistryPathEnv));
-
- // Get the path to the service config file name
- serviceConfigFile = serviceRegistration.getServiceRegistrationPath(serviceConfigFileName);
-
- if (serviceConfigFile == null)
- {
- // Make a part for the error message
- String CentrialPath = serviceRegistration.getCentrialPath();
-
- StringBuilder serviceRegDirsBuilder = new StringBuilder();
- if (CentrialPath != null && !CentrialPath.isEmpty())
- {
- serviceRegDirsBuilder.append("\n\t");
- serviceRegDirsBuilder.append(CentrialPath);
- }
- serviceRegDirsBuilder.append("\n");
-
- TraceHelper.traceError(String.format(
- StringResource.getResource("CannotFindServiceRegistrationFileUnderFolders"),
- serviceRegDirsBuilder.toString()));
- }
- } catch (Exception e)
- {
- e.printStackTrace();
- TraceHelper.traceError(String.format(StringResource.getResource("ExceptionInReadingRegistrationFile"),
- serviceConfigFile, e.toString()));
- }
-
- return serviceConfigFile;
- }
-
- /**
- * @description run a pre or post task if it exists
- * @param exitCode
- * @return
- */
- private static boolean RunPrePostTask(AtomicReference exitCode)
- {
- boolean prePostTaskExists = false;
- String prePostTaskCommandLine = Environment.getEnvironmentVariable(Constant.PrePostTaskCommandLineEnvVar);
-
- // Check if a pre/post task exists
- prePostTaskExists = prePostTaskCommandLine != null;
-
- if (prePostTaskExists)
- {
- String serviceWorkingDirectory = null;
- serviceWorkingDirectory = Environment.getEnvironmentVariable(Constant.PrePostTaskOnPremiseWorkingDirEnvVar);
-
- // Run command from comspec (like node manager babysitter) to ensure
- // env vars are expanded and command runs as if launched from node manager
- String commandLine = String.format("\"%s\" /S /c \"%s\"", Environment.getEnvironmentVariable("ComSpec"),
- prePostTaskCommandLine);
- ProcessBuilder pb = new ProcessBuilder(commandLine);
- pb.directory(new File(serviceWorkingDirectory));
- pb.redirectErrorStream();
- TraceHelper.traceInformation(String.format("Executing '%s'", prePostTaskCommandLine));
-
- try
- {
- Process subp = pb.start();
- subp.getErrorStream();
- InputStream is = subp.getErrorStream();
- InputStreamReader isr = new InputStreamReader(is, "GBK");
- BufferedReader br = new BufferedReader(isr);
-
- //wait the sub process to finish
- exitCode.set(subp.waitFor());
- TraceHelper.traceError(br.toString());
- TraceHelper.traceInformation(String.format("ExitCode = %d", exitCode));
-
- if (exitCode.equals(0))
- {
- TraceHelper.traceInformation(String.format("Error output:%s", br.toString()));
- }
-
- } catch (InterruptedException e)
- {
- TraceHelper.traceError(String.format("Cannnot start pre/post task: %s, error message: %s", commandLine,
- e.toString()));
- } catch (IOException e)
- {
- TraceHelper.traceError(String.format("Cannnot start pre/post task: %s, error message: %s", commandLine,
- e.toString()));
- }
-
- }
- return prePostTaskExists;
- }
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// the set-up method for the java service host
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.servicehost;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.text.ParseException;
+import java.util.concurrent.atomic.AtomicReference;
+import com.microsoft.hpc.properties.ErrorCode;
+import com.microsoft.hpc.scheduler.session.Constant;
+import com.microsoft.hpc.scheduler.session.servicecontext.Environment;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistrationRepo;
+import com.microsoft.hpc.scheduler.session.servicecontext.StringResource;
+import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper;
+
+/**
+ * @author t-junchw
+ * @date May 9, 2011
+ * @description entry point of service host
+ */
+public class Main
+{
+ /**
+ * @param args
+ * java -jar Microsoft-HpcHost-3.0.jar
+ * /JobId jid /TaskSystemId tid /CoreId cid
+ * /RegistrationFileName filename /RegistrationPath path
+ * /Ccp_Data ccpdata /TaskInstanceId taskinstancsid
+ * @throws IOException
+ */
+ public static void main(String[] args) throws IOException
+ {
+
+ TraceHelper.traceInformation("HpcServiceHost entry point is called.");
+
+ AtomicReference exitCode = new AtomicReference(0);
+ if (RunPrePostTask(exitCode))
+ {
+ // return the exitcode
+ System.exit(Integer.parseInt(exitCode.get().toString()));
+ }
+
+ // jar running without a job
+ if (args.length > 0)
+ {
+ // set the debug mode true
+ Environment.isDebug = true;
+
+ ParameterContainer param = new ParameterContainer(args);
+ try
+ {
+ if (param.printHelp())
+ {
+ System.exit(ErrorCode.ServiceHost_PrintCommandHelp);
+ } else
+ {
+ param.Parse();
+ }
+ } catch (ParseException e)
+ {
+ TraceHelper.traceError(e.toString());
+ System.exit(ErrorCode.ServiceHost_IncorrectCommandLineParameter);
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ System.exit(ErrorCode.ServiceHost_UnexpectedException);
+ }
+
+ // set the Environment Variable for the debug
+ Environment.setEnvironmentVariable(Constant.JobIDEnvVar, param.getJobIdParameter().getValue().toString());
+ Environment.setEnvironmentVariable(Constant.TaskSystemIDEnvVar, param.getTaskIdParameter().getValue().toString());
+ Environment.setEnvironmentVariable(Constant.CoreIdsEnvVar, param.getCoreIdParameter().getValue().toString());
+ Environment.setEnvironmentVariable(Constant.RegistryPathEnv, param.getPathParameter().getValue());
+ Environment.setEnvironmentVariable(Constant.ServiceConfigFileNameEnvVar, param.getFileNameParameter()
+ .getValue());
+ Environment.setEnvironmentVariable(Constant.CCP_DATAEnvVar, param.getCCPDATAParameter().getValue());
+ Environment.setEnvironmentVariable(Constant.TASKINSTANCEIDEnvVar, param.getTaskinstanceIdParameter()
+ .getValue().toString());
+ // use default values for following environment variables
+ Environment.setEnvironmentVariable(Constant.ProcNumEnvVar, "1");
+ Environment.setEnvironmentVariable(Constant.NetworkPrefixEnv, Constant.EnterpriseNetwork);
+ Environment.setEnvironmentVariable(Constant.ServiceInitializationTimeoutEnvVar, "60000");
+ Environment.setEnvironmentVariable(Constant.CancelTaskGracePeriodEnvVar, "15");
+ Environment.setEnvironmentVariable(Constant.ServiceConfigServiceOperatonTimeoutEnvVar, "86400000");
+ }
+
+ String serviceConfigFullPath;
+ HpcServiceHostWrapper hpcServiceHostWrapper = null;
+ boolean isOpenDummy = false;
+ try
+ {
+ String serviceConfigFileName = Environment.getEnvironmentVariable(Constant.ServiceConfigFileNameEnvVar);
+
+ // exit if there is not such env var
+ if (serviceConfigFileName == null || serviceConfigFileName.isEmpty())
+ {
+ isOpenDummy = true;
+ TraceHelper.traceError(StringResource.getResource("ServiceConfigFileNameNotSpecified"));
+ throw new Exception(String.valueOf(ErrorCode.ServiceHost_ServiceConfigFileNameNotSpecified));
+ }
+
+ //get the service config file full path
+ serviceConfigFullPath = GetServiceInfo(serviceConfigFileName);
+ if (!new File(serviceConfigFullPath).exists())
+ {
+ isOpenDummy = true;
+ TraceHelper.traceError(StringResource
+ .getResource("CantFindServiceRegistrationFileserviceConfigFullPath"));
+ throw new Exception(String.valueOf(ErrorCode.ServiceHost_ServiceRegistrationFileNotFound));
+ }
+
+ TraceHelper.traceInformation("serviceConfigFullPath = " + serviceConfigFullPath);
+
+ //import the configuration to the service registration
+ ServiceRegistration serviceRegistration = Utility.getServiceRegistration(serviceConfigFullPath, exitCode);
+ if ((Integer) exitCode.get() != ErrorCode.Success)
+ {
+ isOpenDummy = true;
+ throw new Exception(exitCode.get().toString());
+ }
+
+ // Open the host
+ hpcServiceHostWrapper = new HpcServiceHostWrapper(serviceRegistration);
+ hpcServiceHostWrapper.publish();
+
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ TraceHelper.traceStackError(e);
+ }
+ finally
+ {
+ if(isOpenDummy)
+ {
+ if(hpcServiceHostWrapper==null)
+ {
+ hpcServiceHostWrapper = new HpcServiceHostWrapper(new ServiceRegistration());
+ }
+ hpcServiceHostWrapper.openDummyService();
+ }
+ }
+ }
+
+ /**
+ * @description get the service config file full path by the file name
+ * @param serviceConfigFileName
+ * @return service config file full path
+ */
+ private static String GetServiceInfo(String serviceConfigFileName)
+ {
+ String serviceConfigFile = null;
+
+ try
+ {
+
+ String headnode = Environment.getEnvironmentVariable(Constant.HeadnodeEnvVar);
+ TraceHelper.traceInformation(Environment.getEnvironmentVariable(Constant.RegistryPathEnv));
+ ServiceRegistrationRepo serviceRegistration = new ServiceRegistrationRepo(headnode,
+ Environment.getEnvironmentVariable(Constant.RegistryPathEnv));
+
+ // Get the path to the service config file name
+ serviceConfigFile = serviceRegistration.getServiceRegistrationPath(serviceConfigFileName);
+
+ if (serviceConfigFile == null)
+ {
+ // Make a part for the error message
+ String CentrialPath = serviceRegistration.getCentrialPath();
+
+ StringBuilder serviceRegDirsBuilder = new StringBuilder();
+ if (CentrialPath != null && !CentrialPath.isEmpty())
+ {
+ serviceRegDirsBuilder.append("\n\t");
+ serviceRegDirsBuilder.append(CentrialPath);
+ }
+ serviceRegDirsBuilder.append("\n");
+
+ TraceHelper.traceError(String.format(
+ StringResource.getResource("CannotFindServiceRegistrationFileUnderFolders"),
+ serviceRegDirsBuilder.toString()));
+ }
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ TraceHelper.traceError(String.format(StringResource.getResource("ExceptionInReadingRegistrationFile"),
+ serviceConfigFile, e.toString()));
+ }
+
+ return serviceConfigFile;
+ }
+
+ /**
+ * @description run a pre or post task if it exists
+ * @param exitCode
+ * @return
+ */
+ private static boolean RunPrePostTask(AtomicReference exitCode)
+ {
+ boolean prePostTaskExists = false;
+ String prePostTaskCommandLine = Environment.getEnvironmentVariable(Constant.PrePostTaskCommandLineEnvVar);
+
+ // Check if a pre/post task exists
+ prePostTaskExists = prePostTaskCommandLine != null;
+
+ if (prePostTaskExists)
+ {
+ String serviceWorkingDirectory = null;
+ serviceWorkingDirectory = Environment.getEnvironmentVariable(Constant.PrePostTaskOnPremiseWorkingDirEnvVar);
+
+ // Run command from comspec (like node manager babysitter) to ensure
+ // env vars are expanded and command runs as if launched from node manager
+ String commandLine = String.format("\"%s\" /S /c \"%s\"", Environment.getEnvironmentVariable("ComSpec"),
+ prePostTaskCommandLine);
+ ProcessBuilder pb = new ProcessBuilder(commandLine);
+ pb.directory(new File(serviceWorkingDirectory));
+ pb.redirectErrorStream();
+ TraceHelper.traceInformation(String.format("Executing '%s'", prePostTaskCommandLine));
+
+ try
+ {
+ Process subp = pb.start();
+ subp.getErrorStream();
+ InputStream is = subp.getErrorStream();
+ InputStreamReader isr = new InputStreamReader(is, "GBK");
+ BufferedReader br = new BufferedReader(isr);
+
+ //wait the sub process to finish
+ exitCode.set(subp.waitFor());
+ TraceHelper.traceError(br.toString());
+ TraceHelper.traceInformation(String.format("ExitCode = %d", exitCode));
+
+ if (exitCode.equals(0))
+ {
+ TraceHelper.traceInformation(String.format("Error output:%s", br.toString()));
+ }
+
+ } catch (InterruptedException e)
+ {
+ TraceHelper.traceError(String.format("Cannnot start pre/post task: %s, error message: %s", commandLine,
+ e.toString()));
+ } catch (IOException e)
+ {
+ TraceHelper.traceError(String.format("Cannnot start pre/post task: %s, error message: %s", commandLine,
+ e.toString()));
+ }
+
+ }
+ return prePostTaskExists;
+ }
+}
diff --git a/src/com/microsoft/hpc/servicehost/MessagePreemptionOutInterceptor.java b/src/com/microsoft/hpc/servicehost/MessagePreemptionOutInterceptor.java
index 56adb4a..c8f8585 100644
--- a/src/com/microsoft/hpc/servicehost/MessagePreemptionOutInterceptor.java
+++ b/src/com/microsoft/hpc/servicehost/MessagePreemptionOutInterceptor.java
@@ -1,155 +1,155 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Outbound interceptor
-// Capture the outbound message
-// For message Preemption
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.servicehost;
-
-import java.util.logging.Level;
-import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.phase.Phase;
-import org.w3c.dom.Element;
-import com.microsoft.hpc.exceptions.SOAFaultCode;
-import com.microsoft.hpc.scheduler.session.Constant;
-import com.microsoft.hpc.scheduler.session.fault.FaultMessageException;
-import com.microsoft.hpc.scheduler.session.fault.ObjectFactory;
-import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
-import com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault;
-
-/**
- * @author t-junchw
- * @date May 10, 2011
- * @description create fault message during message preemption The client should
- * not try to create or attach to a session. It should report the
- * error to their helpdesk. There is something wrong with app's
- * implementation or installation
- */
-public class MessagePreemptionOutInterceptor extends AbstractSoapInterceptor
-{
- private HpcServiceHostWrapper hpcHostWrapper;
-
- public MessagePreemptionOutInterceptor(HpcServiceHostWrapper wrapper)
- {
- super(Phase.PRE_PROTOCOL);
- this.hpcHostWrapper = wrapper;
-
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message)
- */
- @Override
- public void handleMessage(SoapMessage message) throws Fault
- {
- if (hpcHostWrapper.enableMessageLevelPreemption)
- {
- String id = (String) message.getExchange().get("ID");
- ServiceContext.Logger.traceEvent(Level.INFO, id);
- // If the message is not being processed, reply a fault message to
- // the broker.
- if (!this.hpcHostWrapper.processingMessageIds.contains(id))
- {
- // create session fault instance
- ObjectFactory objectFactory = new ObjectFactory();
- SvcHostSessionFault sessionFault = objectFactory
- .createSessionFault();
-
- sessionFault.setCode(SOAFaultCode.Service_Preempted.getCode());
- sessionFault
- .setReason(objectFactory.createSessionFaultReason(String
- .valueOf(this.hpcHostWrapper.processingMessageIds
- .size())));
-
- // create the fault detail
- Element detailElement = InterceptorUtility
- .createDetailElement(sessionFault);
- Fault fault = new Fault(new FaultMessageException("",
- sessionFault));
- fault.setDetail(detailElement);
- throw fault;
-
- } else
- {
- // The service host receives the cancel event when the request
- // is
- // being processed, so add a header to notice the broker.
- // It is mandatory when this response message is the last one.
- // (no incoming request anymore)
- if (this.hpcHostWrapper.receivedCancelEvent)
- {
- int messageCount = this.hpcHostWrapper.processingMessageIds
- .size();
- InterceptorUtility.addMessageHeader(message,
- Constant.MessageHeaderPreemption,
- Constant.HpcHeaderNS, messageCount);
- }
- }
- }
- }
-
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Outbound interceptor
+// Capture the outbound message
+// For message Preemption
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.servicehost;
+
+import java.util.logging.Level;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.phase.Phase;
+import org.w3c.dom.Element;
+import com.microsoft.hpc.exceptions.SOAFaultCode;
+import com.microsoft.hpc.scheduler.session.Constant;
+import com.microsoft.hpc.scheduler.session.fault.FaultMessageException;
+import com.microsoft.hpc.scheduler.session.fault.ObjectFactory;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
+import com.microsoft.hpc.scheduler.session.fault.SvcHostSessionFault;
+
+/**
+ * @author t-junchw
+ * @date May 10, 2011
+ * @description create fault message during message preemption The client should
+ * not try to create or attach to a session. It should report the
+ * error to their helpdesk. There is something wrong with app's
+ * implementation or installation
+ */
+public class MessagePreemptionOutInterceptor extends AbstractSoapInterceptor
+{
+ private HpcServiceHostWrapper hpcHostWrapper;
+
+ public MessagePreemptionOutInterceptor(HpcServiceHostWrapper wrapper)
+ {
+ super(Phase.PRE_PROTOCOL);
+ this.hpcHostWrapper = wrapper;
+
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message)
+ */
+ @Override
+ public void handleMessage(SoapMessage message) throws Fault
+ {
+ if (hpcHostWrapper.enableMessageLevelPreemption)
+ {
+ String id = (String) message.getExchange().get("ID");
+ ServiceContext.Logger.traceEvent(Level.INFO, id);
+ // If the message is not being processed, reply a fault message to
+ // the broker.
+ if (!this.hpcHostWrapper.processingMessageIds.contains(id))
+ {
+ // create session fault instance
+ ObjectFactory objectFactory = new ObjectFactory();
+ SvcHostSessionFault sessionFault = objectFactory
+ .createSessionFault();
+
+ sessionFault.setCode(SOAFaultCode.Service_Preempted.getCode());
+ sessionFault
+ .setReason(objectFactory.createSessionFaultReason(String
+ .valueOf(this.hpcHostWrapper.processingMessageIds
+ .size())));
+
+ // create the fault detail
+ Element detailElement = InterceptorUtility
+ .createDetailElement(sessionFault);
+ Fault fault = new Fault(new FaultMessageException("",
+ sessionFault));
+ fault.setDetail(detailElement);
+ throw fault;
+
+ } else
+ {
+ // The service host receives the cancel event when the request
+ // is
+ // being processed, so add a header to notice the broker.
+ // It is mandatory when this response message is the last one.
+ // (no incoming request anymore)
+ if (this.hpcHostWrapper.receivedCancelEvent)
+ {
+ int messageCount = this.hpcHostWrapper.processingMessageIds
+ .size();
+ InterceptorUtility.addOrUpdateMessageHeader(message,
+ Constant.MessageHeaderPreemption,
+ Constant.HpcHeaderNS, messageCount);
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/com/microsoft/hpc/servicehost/ServiceRegistration.java b/src/com/microsoft/hpc/servicehost/ServiceRegistration.java
index 014d0cb..b399dcc 100644
--- a/src/com/microsoft/hpc/servicehost/ServiceRegistration.java
+++ b/src/com/microsoft/hpc/servicehost/ServiceRegistration.java
@@ -1,249 +1,264 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Save the Service Registration Information
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-package com.microsoft.hpc.servicehost;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import com.microsoft.hpc.properties.ErrorCode;
-import com.microsoft.hpc.scheduler.session.servicecontext.JavaTraceLevelConverterEnum;
-import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper;
-
-/**
- * @author t-junchw
- * @date May 10, 2011
- * @description store the service registration information
- */
-public class ServiceRegistration
-{
-
- public final String serviceConfigurationsName = "microsoft.Hpc.Session.ServiceRegistration";
- public final String serviceDiagnosticsName = "system.diagnostics";
- private final String sourcesNodeName = "sources";
- private final String sourceNodeName = "source";
- private final String traceLevelAttributeName = "switchValue";
- private final String serviceNodeName = "service";
- private final String assemblyAttributeName = "assembly";
- private final String serviceContractAttributeName = "contract";
- private final String serviceTypeAttributeName = "ServiceType";
- private final String includeFaultedExceptionAttributeName = "includeFaultedException";
- public Node serviceConfigNode = null;
- public String serviceAssemblyFullPath = null;
- public String traceLevel = "OFF";
- private boolean includeFaultedException;
-
- public boolean isIncludeFaultedException()
- {
- return includeFaultedException;
- }
-
- /**
- * @field user service type name
- */
- public String serviceTypeName;
-
- /**
- * @field user service Contact name
- */
- public String serviceContractName;
-
- /**
- * @return serviceTypeName
- */
- public String getServiceTypeName()
- {
- return serviceTypeName;
- }
-
- /**
- * @return serviceContractName
- */
- public String getServiceContractName()
- {
- return serviceContractName;
- }
-
- /**
- * @field user jar file name
- */
- public String serviceAssemblyFileName;
-
- /**
- * @description parse the XML node list to get the service registration settings
- * @param nodelist
- */
- public void setserviceConfigNode(NodeList nodelist)
- {
- NodeList serviceConfigurationNodeList = nodelist;
- if (serviceConfigurationNodeList != null)
- {
- // get the user jar setting information
- Node rootNode = serviceConfigurationNodeList.item(0);
- for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode
- .getNextSibling())
- {
- if (rootNode.getNodeName() == serviceNodeName)
- {
- serviceConfigNode = rootNode;
- NamedNodeMap map = serviceConfigNode.getAttributes();
- try
- {
- serviceAssemblyFullPath = map.getNamedItem(
- assemblyAttributeName).getNodeValue();
- } catch (DOMException e)
- {
- TraceHelper.traceError(e.toString());
- System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
- }
-
- try
- {
- serviceContractName = map.getNamedItem(
- serviceContractAttributeName).getNodeValue();
-
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- }
-
- try
- {
- serviceTypeName = map.getNamedItem(
- serviceTypeAttributeName).getNodeValue();
-
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- }
-
- try
- {
- includeFaultedException = Boolean.parseBoolean(map
- .getNamedItem(
- includeFaultedExceptionAttributeName)
- .getNodeValue());
-
- } catch (Exception e)
- {
- TraceHelper.traceError(e.toString());
- }
- }
- }
- }
- }
-
- /**
- * @description parse the XML node list to get the java trace level
- * @param nodeList
- */
- public void setLoggerLevel(NodeList nodeList)
- {
- if (nodeList != null)
- {
- // get the java trace setting information
- Node rootNode = nodeList.item(0);
- for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode
- .getNextSibling())
- {
- if (rootNode.getNodeName() == sourcesNodeName)
- {
- for (Node subNode = rootNode.getFirstChild(); subNode != null; subNode = subNode
- .getNextSibling())
- {
- if (subNode.getNodeName() == sourceNodeName)
- {
- NamedNodeMap map = subNode.getAttributes();
- try
- {
- traceLevel = map.getNamedItem(
- traceLevelAttributeName).getNodeValue();
- traceLevel = traceLevel.substring(0,
- traceLevel.indexOf(','));
-
- // transfer the ETW trace level to java version
- traceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel.trim()).getValue();
- break;
- } catch (DOMException e)
- {
- TraceHelper.traceError(e.toString());
- System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * @return serviceAssemblyFullPath
- */
- public String getServiceAssemblyFullPath()
- {
- return serviceAssemblyFullPath;
- }
-
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Save the Service Registration Information
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+package com.microsoft.hpc.servicehost;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import com.microsoft.hpc.properties.ErrorCode;
+import com.microsoft.hpc.scheduler.session.servicecontext.JavaTraceLevelConverterEnum;
+import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper;
+
+/**
+ * @author t-junchw
+ * @date May 10, 2011
+ * @description store the service registration information
+ */
+public class ServiceRegistration
+{
+
+ public final String serviceConfigurationsName = "microsoft.Hpc.Session.ServiceRegistration";
+ public final String serviceDiagnosticsName = "system.diagnostics";
+ private final String sourcesNodeName = "sources";
+ private final String sourceNodeName = "source";
+ private final String traceLevelAttributeName = "switchValue";
+ private final String serviceNodeName = "service";
+ private final String assemblyAttributeName = "assembly";
+ private final String serviceContractAttributeName = "contract";
+ private final String serviceTypeAttributeName = "ServiceType";
+ private final String includeFaultedExceptionAttributeName = "includeFaultedException";
+ private final String soaDiagTraceLevelAttributeName = "soaDiagTraceLevel";
+ public Node serviceConfigNode = null;
+ public String serviceAssemblyFullPath = null;
+ public String traceLevel = "OFF";
+ public String soaDiagTraceLevel = "Off";
+
+ private boolean includeFaultedException;
+
+ public boolean isIncludeFaultedException()
+ {
+ return includeFaultedException;
+ }
+
+ /**
+ * @field user service type name
+ */
+ public String serviceTypeName;
+
+ /**
+ * @field user service Contact name
+ */
+ public String serviceContractName;
+
+ /**
+ * @return serviceTypeName
+ */
+ public String getServiceTypeName()
+ {
+ return serviceTypeName;
+ }
+
+ /**
+ * @return serviceContractName
+ */
+ public String getServiceContractName()
+ {
+ return serviceContractName;
+ }
+
+
+
+ /**
+ * @field user jar file name
+ */
+ public String serviceAssemblyFileName;
+
+ /**
+ * @description parse the XML node list to get the service registration settings
+ * @param nodelist
+ */
+ public void setserviceConfigNode(NodeList nodelist)
+ {
+ NodeList serviceConfigurationNodeList = nodelist;
+ if (serviceConfigurationNodeList != null)
+ {
+ // get the user jar setting information
+ Node rootNode = serviceConfigurationNodeList.item(0);
+ for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode
+ .getNextSibling())
+ {
+ if (rootNode.getNodeName() == serviceNodeName)
+ {
+ serviceConfigNode = rootNode;
+ NamedNodeMap map = serviceConfigNode.getAttributes();
+ try
+ {
+ serviceAssemblyFullPath = map.getNamedItem(
+ assemblyAttributeName).getNodeValue();
+ } catch (DOMException e)
+ {
+ TraceHelper.traceError(e.toString());
+ System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
+ }
+
+ try
+ {
+ serviceContractName = map.getNamedItem(
+ serviceContractAttributeName).getNodeValue();
+
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ }
+
+ try
+ {
+ serviceTypeName = map.getNamedItem(
+ serviceTypeAttributeName).getNodeValue();
+
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ }
+
+ try
+ {
+ includeFaultedException = Boolean.parseBoolean(map
+ .getNamedItem(
+ includeFaultedExceptionAttributeName)
+ .getNodeValue());
+
+ } catch (Exception e)
+ {
+ TraceHelper.traceError(e.toString());
+ }
+
+ try
+ {
+ if(map.getNamedItem(soaDiagTraceLevelAttributeName) != null &&
+ map.getNamedItem(soaDiagTraceLevelAttributeName).getNodeValue() != null) {
+ soaDiagTraceLevel = map.getNamedItem(soaDiagTraceLevelAttributeName).getNodeValue().split(",")[0];
+ }
+ } catch(Exception e) {
+ TraceHelper.traceError(e.toString());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @description parse the XML node list to get the java trace level
+ * @param nodeList
+ */
+ public void setLoggerLevel(NodeList nodeList)
+ {
+ if (nodeList != null)
+ {
+ // get the java trace setting information
+ Node rootNode = nodeList.item(0);
+ for (rootNode = rootNode.getFirstChild(); rootNode != null; rootNode = rootNode
+ .getNextSibling())
+ {
+ if (rootNode.getNodeName() == sourcesNodeName)
+ {
+ for (Node subNode = rootNode.getFirstChild(); subNode != null; subNode = subNode
+ .getNextSibling())
+ {
+ if (subNode.getNodeName() == sourceNodeName)
+ {
+ NamedNodeMap map = subNode.getAttributes();
+ try
+ {
+ traceLevel = map.getNamedItem(
+ traceLevelAttributeName).getNodeValue();
+ traceLevel = traceLevel.substring(0,
+ traceLevel.indexOf(','));
+
+ // transfer the ETW trace level to java version
+ traceLevel = JavaTraceLevelConverterEnum.valueOf(traceLevel.trim()).getValue();
+ break;
+ } catch (DOMException e)
+ {
+ TraceHelper.traceError(e.toString());
+ System.exit(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @return serviceAssemblyFullPath
+ */
+ public String getServiceAssemblyFullPath()
+ {
+ return serviceAssemblyFullPath;
+ }
+
+}
diff --git a/src/com/microsoft/hpc/servicehost/Utility.java b/src/com/microsoft/hpc/servicehost/Utility.java
index 3319668..1243e27 100644
--- a/src/com/microsoft/hpc/servicehost/Utility.java
+++ b/src/com/microsoft/hpc/servicehost/Utility.java
@@ -1,160 +1,161 @@
-// ------------------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//
-// Utility for service host
-//
-// ------------------------------------------------------------------------------
-/*
-JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-This license governs use of the accompanying software. If you use the
-software, you accept this license. If you do not accept the license, do not
-use the software.
-
-1. Definitions
-The terms "reproduce," "reproduction," "derivative works," and "distribution"
-have the same meaning here as under U.S. copyright law.
-A "contribution. is the original software, or any additions or changes to
-the software.
-A "contributor. is any person that distributes its contribution under this
-license.
-"Licensed patents. are a contributor.s patent claims that read directly on
-its contribution.
-
-2. Grant of Rights
-(A) Copyright Grant- Subject to the terms of this license, including the
-license conditions and limitations in section 3, each contributor grants you
-a non-exclusive, worldwide, royalty-free copyright license to reproduce its
-contribution, prepare derivative works of its contribution, and distribute
-its contribution or any derivative works that you create.
-(B) Patent Grant- Subject to the terms of this license, including the license
-conditions and limitations in section 3, each contributor grants you a
-non-exclusive, worldwide, royalty-free license under its licensed patents to
-make, have made, use, sell, offer for sale, import, and/or otherwise dispose
-of its contribution in the software or derivative works of the contribution
-in the software.
-
-3. Conditions and Limitations
-(A) No Trademark License- This license does not grant you rights to use any
-contributors' name, logo, or trademarks.
-(B) If you bring a patent claim against any contributor over patents that
-you claim are infringed by the software, your patent license from such
-contributor to the software ends automatically.
-(C) If you distribute any portion of the software, you must retain all
-copyright, patent, trademark, and attribution notices that are present in
-the software.
-(D) If you distribute any portion of the software in source code form,
-you may do so only under this license by including a complete copy of this
-license with your distribution. If you distribute any portion of the software
-in compiled or object code form, you may only do so under a license that
-complies with this license.
-(E) The software is licensed "as-is." You bear the risk of using it. The
-contributors give no express warranties, guarantees or conditions. You may
-have additional consumer rights under your local laws which this license
-cannot change. To the extent permitted under your local laws, the contributors
-exclude the implied warranties of merchantability, fitness for a particular
-purpose and non-infringement.
-(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
-only to the software or derivative works that you create that operate with
-Windows HPC Server.
-*/
-
-package com.microsoft.hpc.servicehost;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.logging.Level;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import com.microsoft.hpc.properties.ErrorCode;
-import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
-import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration;
-import com.microsoft.hpc.scheduler.session.servicecontext.StringResource;
-import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper;
-
-/**
- * @author t-junchw
- * @date May 10, 2011
- * @description utility for service host
- */
-public class Utility
-{
- /**
- * @description get service registration info from config file
- * @param serviceConfigName service configuration file
- * @param exitCode error code
- * @return ServiceRegistration
- */
- public static ServiceRegistration getServiceRegistration(String serviceConfigName,
- AtomicReference exitCode)
- {
- // open the service registration configuration section
- ServiceRegistration serviceRegistration = new ServiceRegistration();
- // initiate the exitCode
- exitCode.set(ErrorCode.Success);
-
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- String serviceAssemblyFullPath = null;
- try
- {
- // parse the service registration XML
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- InputStream is = new FileInputStream(serviceConfigName);
- Document doc = dombuilder.parse(is);
- Element root = doc.getDocumentElement();
- serviceRegistration.setserviceConfigNode(root
- .getElementsByTagName(serviceRegistration.serviceConfigurationsName));
-
- serviceAssemblyFullPath = serviceRegistration.getServiceAssemblyFullPath();
- try
- {
- serviceRegistration.setLoggerLevel(root
- .getElementsByTagName(serviceRegistration.serviceDiagnosticsName));
- } catch (Exception e)
- {
- // system.diagnostics tag in hpc xml is not necessary
- }
- TraceHelper.traceInformation("Trace Level is "+serviceRegistration.traceLevel);
- ServiceContext.setTraceLevel(serviceRegistration.traceLevel);
-
- } catch (Exception e)
- {
- // exception occurs when parsing the XML
- ServiceContext.Logger.traceEvent(Level.SEVERE, e.toString());
- TraceHelper.traceError(e.toString());
- exitCode.set(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
- //return null;
- }
-
- if (serviceAssemblyFullPath == null || serviceAssemblyFullPath.isEmpty())
- {
- String message = String.format(StringResource.getResource("AssemblyFileNotRegistered"),
- serviceConfigName);
- TraceHelper.traceError(message);
- ServiceContext.Logger.traceEvent(Level.SEVERE, message);
- exitCode.set(ErrorCode.ServiceHost_AssemblyFileNameNullOrEmpty);
- //return null;
- }
-
- if (!new File(serviceAssemblyFullPath).exists())
- {
- // If the obtained service assembly path is not valid or not
- // existing
- String message = String.format(StringResource.getResource("AssemblyFileCantFind"),
- serviceAssemblyFullPath);
- TraceHelper.traceError(message);
- ServiceContext.Logger.traceEvent(Level.SEVERE, message);
- exitCode.set(ErrorCode.ServiceHost_AssemblyFileNotFound);
- }
- return serviceRegistration;
- }
-
-}
+// ------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// Utility for service host
+//
+// ------------------------------------------------------------------------------
+/*
+JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+This license governs use of the accompanying software. If you use the
+software, you accept this license. If you do not accept the license, do not
+use the software.
+
+1. Definitions
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+A "contribution. is the original software, or any additions or changes to
+the software.
+A "contributor. is any person that distributes its contribution under this
+license.
+"Licensed patents. are a contributor.s patent claims that read directly on
+its contribution.
+
+2. Grant of Rights
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, each contributor grants you
+a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+contribution, prepare derivative works of its contribution, and distribute
+its contribution or any derivative works that you create.
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, each contributor grants you a
+non-exclusive, worldwide, royalty-free license under its licensed patents to
+make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+of its contribution in the software or derivative works of the contribution
+in the software.
+
+3. Conditions and Limitations
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+(B) If you bring a patent claim against any contributor over patents that
+you claim are infringed by the software, your patent license from such
+contributor to the software ends automatically.
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in
+the software.
+(D) If you distribute any portion of the software in source code form,
+you may do so only under this license by including a complete copy of this
+license with your distribution. If you distribute any portion of the software
+in compiled or object code form, you may only do so under a license that
+complies with this license.
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may
+have additional consumer rights under your local laws which this license
+cannot change. To the extent permitted under your local laws, the contributors
+exclude the implied warranties of merchantability, fitness for a particular
+purpose and non-infringement.
+(F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+only to the software or derivative works that you create that operate with
+Windows HPC Server.
+*/
+
+package com.microsoft.hpc.servicehost;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.logging.Level;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import com.microsoft.hpc.properties.ErrorCode;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceContext;
+import com.microsoft.hpc.scheduler.session.servicecontext.ServiceRegistration;
+import com.microsoft.hpc.scheduler.session.servicecontext.StringResource;
+import com.microsoft.hpc.scheduler.session.servicecontext.TraceHelper;
+
+/**
+ * @author t-junchw
+ * @date May 10, 2011
+ * @description utility for service host
+ */
+public class Utility
+{
+ /**
+ * @description get service registration info from config file
+ * @param serviceConfigName service configuration file
+ * @param exitCode error code
+ * @return ServiceRegistration
+ */
+ public static ServiceRegistration getServiceRegistration(String serviceConfigName,
+ AtomicReference exitCode)
+ {
+ // open the service registration configuration section
+ ServiceRegistration serviceRegistration = new ServiceRegistration();
+ // initiate the exitCode
+ exitCode.set(ErrorCode.Success);
+
+ DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
+ String serviceAssemblyFullPath = null;
+ try
+ {
+ // parse the service registration XML
+ DocumentBuilder dombuilder = domfac.newDocumentBuilder();
+ InputStream is = new FileInputStream(serviceConfigName);
+ Document doc = dombuilder.parse(is);
+ Element root = doc.getDocumentElement();
+ serviceRegistration.setserviceConfigNode(root
+ .getElementsByTagName(serviceRegistration.serviceConfigurationsName));
+ serviceRegistration.setEnableWSAddressing(doc);
+ serviceAssemblyFullPath = serviceRegistration.getServiceAssemblyFullPath();
+ try
+ {
+ serviceRegistration.setLoggerLevel(root
+ .getElementsByTagName(serviceRegistration.serviceDiagnosticsName));
+ } catch (Exception e)
+ {
+ // system.diagnostics tag in hpc xml is not necessary
+ }
+ TraceHelper.traceInformation("Trace Level is "+serviceRegistration.traceLevel);
+ ServiceContext.setTraceLevel(serviceRegistration.traceLevel);
+ ServiceContext.setSoaDiagTraceLevel(serviceRegistration.soaDiagTraceLevel);
+
+ } catch (Exception e)
+ {
+ // exception occurs when parsing the XML
+ ServiceContext.Logger.traceEvent(Level.SEVERE, e.toString());
+ TraceHelper.traceError(e.toString());
+ exitCode.set(ErrorCode.ServiceHost_BadServiceRegistrationFileFormat);
+ //return null;
+ }
+
+ if (serviceAssemblyFullPath == null || serviceAssemblyFullPath.isEmpty())
+ {
+ String message = String.format(StringResource.getResource("AssemblyFileNotRegistered"),
+ serviceConfigName);
+ TraceHelper.traceError(message);
+ ServiceContext.Logger.traceEvent(Level.SEVERE, message);
+ exitCode.set(ErrorCode.ServiceHost_AssemblyFileNameNullOrEmpty);
+ //return null;
+ }
+
+ if (!new File(serviceAssemblyFullPath).exists())
+ {
+ // If the obtained service assembly path is not valid or not
+ // existing
+ String message = String.format(StringResource.getResource("AssemblyFileCantFind"),
+ serviceAssemblyFullPath);
+ TraceHelper.traceError(message);
+ ServiceContext.Logger.traceEvent(Level.SEVERE, message);
+ exitCode.set(ErrorCode.ServiceHost_AssemblyFileNotFound);
+ }
+ return serviceRegistration;
+ }
+
+}
diff --git a/src/com/microsoft/hpc/session/RetryOperationError.java b/src/com/microsoft/hpc/session/RetryOperationError.java
index d8d60f4..7eb14b1 100644
--- a/src/com/microsoft/hpc/session/RetryOperationError.java
+++ b/src/com/microsoft/hpc/session/RetryOperationError.java
@@ -1,90 +1,98 @@
-
-package com.microsoft.hpc.session;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- *
Java class for RetryOperationError complex type.
- *
- *
The following schema fragment specifies the expected content contained within this class.
- *
- *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ArrayOfRequestData", propOrder = {
+ "requestData"
+})
+public class ArrayOfRequestData {
+
+ @XmlElement(name = "RequestData", nillable = true)
+ protected List requestData;
+
+ /**
+ * Gets the value of the requestData property.
+ *
+ *
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a set method for the requestData property.
+ *
+ *
+ * For example, to add a new item, do as follows:
+ *
+ * getRequestData().add(newItem);
+ *
+ *
+ *
+ *
+ * Objects of the following type(s) are allowed in the list
+ * {@link RequestData }
+ *
+ *
+ */
+ public List getRequestData() {
+ if (requestData == null) {
+ requestData = new ArrayList();
+ }
+ return this.requestData;
+ }
+
+}
diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestFootprint.java b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestFootprint.java
new file mode 100644
index 0000000..b9b6f0c
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfRequestFootprint.java
@@ -0,0 +1,69 @@
+
+package com.microsoft.hpc;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ *
Java class for ArrayOfRequestFootprint complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ArrayOfRequestFootprint", propOrder = {
+ "requestFootprint"
+})
+public class ArrayOfRequestFootprint {
+
+ @XmlElement(name = "RequestFootprint", nillable = true)
+ protected List requestFootprint;
+
+ /**
+ * Gets the value of the requestFootprint property.
+ *
+ *
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a set method for the requestFootprint property.
+ *
+ *
+ * For example, to add a new item, do as follows:
+ *
+ * getRequestFootprint().add(newItem);
+ *
+ *
+ *
+ *
+ * Objects of the following type(s) are allowed in the list
+ * {@link RequestFootprint }
+ *
+ *
+ */
+ public List getRequestFootprint() {
+ if (requestFootprint == null) {
+ requestFootprint = new ArrayList();
+ }
+ return this.requestFootprint;
+ }
+
+}
diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfTraceEventItem.java b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfTraceEventItem.java
new file mode 100644
index 0000000..265c5d1
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/hpc/ArrayOfTraceEventItem.java
@@ -0,0 +1,69 @@
+
+package com.microsoft.hpc;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ *
Java class for ArrayOfTraceEventItem complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ArrayOfTraceEventItem", propOrder = {
+ "traceEventItem"
+})
+public class ArrayOfTraceEventItem {
+
+ @XmlElement(name = "TraceEventItem", nillable = true)
+ protected List traceEventItem;
+
+ /**
+ * Gets the value of the traceEventItem property.
+ *
+ *
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a set method for the traceEventItem property.
+ *
+ *
+ * For example, to add a new item, do as follows:
+ *
+ * getTraceEventItem().add(newItem);
+ *
+ *
+ *
+ *
+ * Objects of the following type(s) are allowed in the list
+ * {@link TraceEventItem }
+ *
+ *
+ */
+ public List getTraceEventItem() {
+ if (traceEventItem == null) {
+ traceEventItem = new ArrayList();
+ }
+ return this.traceEventItem;
+ }
+
+}
diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTrace.java b/test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTrace.java
new file mode 100644
index 0000000..9a5e481
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/hpc/CleanupTrace.java
@@ -0,0 +1,64 @@
+
+package com.microsoft.hpc;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ *
Java class for anonymous complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "TraceEventItem", propOrder = {
+ "data",
+ "eventId",
+ "level",
+ "processId",
+ "threadId",
+ "timestamp"
+})
+public class TraceEventItem {
+
+ @XmlElementRef(name = "Data", namespace = "http://hpc.microsoft.com", type = JAXBElement.class, required = false)
+ protected JAXBElement data;
+ @XmlElement(name = "EventId")
+ protected Integer eventId;
+ @XmlElement(name = "Level")
+ @XmlSchemaType(name = "unsignedByte")
+ protected Short level;
+ @XmlElement(name = "ProcessId")
+ protected Integer processId;
+ @XmlElement(name = "ThreadId")
+ protected Integer threadId;
+ @XmlElement(name = "Timestamp")
+ protected Long timestamp;
+
+ /**
+ * Gets the value of the data property.
+ *
+ * @return
+ * possible object is
+ * {@link JAXBElement }{@code <}{@link byte[]}{@code >}
+ *
+ */
+ public JAXBElement getData() {
+ return data;
+ }
+
+ /**
+ * Sets the value of the data property.
+ *
+ * @param value
+ * allowed object is
+ * {@link JAXBElement }{@code <}{@link byte[]}{@code >}
+ *
+ */
+ public void setData(JAXBElement value) {
+ this.data = ((JAXBElement ) value);
+ }
+
+ /**
+ * Gets the value of the eventId property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getEventId() {
+ return eventId;
+ }
+
+ /**
+ * Sets the value of the eventId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setEventId(Integer value) {
+ this.eventId = value;
+ }
+
+ /**
+ * Gets the value of the level property.
+ *
+ * @return
+ * possible object is
+ * {@link Short }
+ *
+ */
+ public Short getLevel() {
+ return level;
+ }
+
+ /**
+ * Sets the value of the level property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Short }
+ *
+ */
+ public void setLevel(Short value) {
+ this.level = value;
+ }
+
+ /**
+ * Gets the value of the processId property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getProcessId() {
+ return processId;
+ }
+
+ /**
+ * Sets the value of the processId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setProcessId(Integer value) {
+ this.processId = value;
+ }
+
+ /**
+ * Gets the value of the threadId property.
+ *
+ * @return
+ * possible object is
+ * {@link Integer }
+ *
+ */
+ public Integer getThreadId() {
+ return threadId;
+ }
+
+ /**
+ * Sets the value of the threadId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Integer }
+ *
+ */
+ public void setThreadId(Integer value) {
+ this.threadId = value;
+ }
+
+ /**
+ * Gets the value of the timestamp property.
+ *
+ * @return
+ * possible object is
+ * {@link Long }
+ *
+ */
+ public Long getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Sets the value of the timestamp property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Long }
+ *
+ */
+ public void setTimestamp(Long value) {
+ this.timestamp = value;
+ }
+
+}
diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/package-info.java b/test/SoaDiagServiceClient/com/microsoft/hpc/package-info.java
new file mode 100644
index 0000000..0b8d28c
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/hpc/package-info.java
@@ -0,0 +1,2 @@
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://hpc.microsoft.com", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package com.microsoft.hpc;
diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/scheduler/session/CxfSoaDiagClient.java b/test/SoaDiagServiceClient/com/microsoft/hpc/scheduler/session/CxfSoaDiagClient.java
new file mode 100644
index 0000000..64dea6f
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/hpc/scheduler/session/CxfSoaDiagClient.java
@@ -0,0 +1,170 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+// CxfBrokerControllerClient class
+//
+//------------------------------------------------------------------------------
+/*
+ JAVA INTEROP LIBRARY FOR WINDOWS HPC SERVER
+
+ Copyright (c) Microsoft Corporation. All rights reserved.
+
+ This license governs use of the accompanying software. If you use the
+ software, you accept this license. If you do not accept the license, do not
+ use the software.
+
+ 1. Definitions
+ The terms "reproduce," "reproduction," "derivative works," and "distribution"
+ have the same meaning here as under U.S. copyright law.
+ A "contribution. is the original software, or any additions or changes to
+ the software.
+ A "contributor. is any person that distributes its contribution under this
+ license.
+ "Licensed patents. are a contributor.s patent claims that read directly on
+ its contribution.
+
+ 2. Grant of Rights
+ (A) Copyright Grant- Subject to the terms of this license, including the
+ license conditions and limitations in section 3, each contributor grants you
+ a non-exclusive, worldwide, royalty-free copyright license to reproduce its
+ contribution, prepare derivative works of its contribution, and distribute
+ its contribution or any derivative works that you create.
+ (B) Patent Grant- Subject to the terms of this license, including the license
+ conditions and limitations in section 3, each contributor grants you a
+ non-exclusive, worldwide, royalty-free license under its licensed patents to
+ make, have made, use, sell, offer for sale, import, and/or otherwise dispose
+ of its contribution in the software or derivative works of the contribution
+ in the software.
+
+ 3. Conditions and Limitations
+ (A) No Trademark License- This license does not grant you rights to use any
+ contributors' name, logo, or trademarks.
+ (B) If you bring a patent claim against any contributor over patents that
+ you claim are infringed by the software, your patent license from such
+ contributor to the software ends automatically.
+ (C) If you distribute any portion of the software, you must retain all
+ copyright, patent, trademark, and attribution notices that are present in
+ the software.
+ (D) If you distribute any portion of the software in source code form,
+ you may do so only under this license by including a complete copy of this
+ license with your distribution. If you distribute any portion of the software
+ in compiled or object code form, you may only do so under a license that
+ complies with this license.
+ (E) The software is licensed "as-is." You bear the risk of using it. The
+ contributors give no express warranties, guarantees or conditions. You may
+ have additional consumer rights under your local laws which this license
+ cannot change. To the extent permitted under your local laws, the contributors
+ exclude the implied warranties of merchantability, fitness for a particular
+ purpose and non-infringement.
+ (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend
+ only to the software or derivative works that you create that operate with
+ Windows HPC Server.
+ */
+
+package com.microsoft.hpc.scheduler.session;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+
+import com.microsoft.hpc.ArrayOfRequestData;
+import com.microsoft.hpc.ArrayOfTraceEventItem;
+import com.microsoft.hpc.RequestContinuationToken;
+import com.microsoft.hpc.RequestData;
+import com.microsoft.hpc.RequestState;
+import com.microsoft.hpc.soadiagservice.ISoaDiagService;
+import com.microsoft.hpc.soadiagservice.ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage;
+import com.microsoft.hpc.soadiagservice.ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage;
+import com.microsoft.hpc.soadiagservice.ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage;
+import com.microsoft.hpc.soadiagservice.ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage;
+import com.microsoft.hpc.soadiagservice.ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage;
+
+public class CxfSoaDiagClient {
+ ISoaDiagService soadiagservice;
+ String epr;
+
+ public CxfSoaDiagClient(String hostname) {
+ this.epr = String.format("http://%s/SoaDiagService", hostname);
+
+ QName portName = new QName("http://hpc.microsoft.com",
+ "HpcSoaDiagServiceHttpPort");
+
+ javax.xml.ws.Service soaService = javax.xml.ws.Service
+ .create(new QName("http://hpc.microsoft.com/SoaDiagService/",
+ "SoaDiagService"));
+ soaService.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, this.epr);
+
+ soadiagservice = soaService.getPort(portName, ISoaDiagService.class);
+
+ // Enable logging
+ Client client = ClientProxy.getClient(soadiagservice);
+ org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
+ cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());
+ cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());
+
+ }
+
+ public void cleanupTrace(int sessionId) throws SessionException {
+ try {
+ soadiagservice.cleanupTrace(sessionId);
+ } catch (ISoaDiagServiceCleanupTraceSessionFaultFaultFaultMessage e) {
+ throw Utility.translateFaultException(e.getFaultInfo());
+ }
+ }
+
+ public void queryUserTraceByRequest(int sessionId, RequestData requestData) throws SessionException {
+ Holder request = new Holder();
+ request.value = requestData;
+ try {
+ soadiagservice.queryUserTraceByRequest(sessionId, request);
+ requestData.setDispatchHistory(request.value.getDispatchHistory());
+ requestData.setContext(request.value.getContext());
+ } catch (ISoaDiagServiceQueryUserTraceByRequestSessionFaultFaultFaultMessage e) {
+ throw Utility.translateFaultException(e.getFaultInfo());
+ }
+ }
+
+ public List queryForRequest(int sessionId, RequestState state) throws SessionException {
+ List requests = null;
+ Holder token = new Holder();
+ Holder queryForRequestResult = new Holder();
+ try {
+ soadiagservice.queryForRequest(sessionId, state, token, queryForRequestResult);
+ requests = queryForRequestResult.value.getRequestData();
+ } catch (ISoaDiagServiceQueryForRequestSessionFaultFaultFaultMessage e) {
+ throw Utility.translateFaultException(e.getFaultInfo());
+ }
+ return requests;
+ }
+
+ public ArrayOfTraceEventItem querySessionTrace(int sessionId)
+ throws SessionException {
+ ArrayOfTraceEventItem items = null;
+ try {
+ items = soadiagservice.querySessionTrace(sessionId);
+ } catch (ISoaDiagServiceQuerySessionTraceSessionFaultFaultFaultMessage e) {
+ throw Utility.translateFaultException(e.getFaultInfo());
+ }
+ return items;
+ }
+
+ public byte[] dumpTrace(int sessionId) throws SessionException {
+ byte[] data = null;
+ try {
+ data = soadiagservice.dumpTrace(sessionId);
+ } catch (ISoaDiagServiceDumpTraceSessionFaultFaultFaultMessage e) {
+ throw Utility.translateFaultException(e.getFaultInfo());
+ }
+ return data;
+ }
+}
\ No newline at end of file
diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/session/ObjectFactory.java b/test/SoaDiagServiceClient/com/microsoft/hpc/session/ObjectFactory.java
new file mode 100644
index 0000000..d7a5cf4
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/hpc/session/ObjectFactory.java
@@ -0,0 +1,74 @@
+
+package com.microsoft.hpc.session;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfanyType;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the com.microsoft.hpc.session package.
+ *
An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _SessionFault_QNAME = new QName("http://hpc.microsoft.com/session/", "SessionFault");
+ private final static QName _SessionFaultReason_QNAME = new QName("http://hpc.microsoft.com/session/", "Reason");
+ private final static QName _SessionFaultContext_QNAME = new QName("http://hpc.microsoft.com/session/", "Context");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.hpc.session
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link SessionFault }
+ *
+ */
+ public SessionFault createSessionFault() {
+ return new SessionFault();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link SessionFault }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "SessionFault")
+ public JAXBElement createSessionFault(SessionFault value) {
+ return new JAXBElement(_SessionFault_QNAME, SessionFault.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "Reason", scope = SessionFault.class)
+ public JAXBElement createSessionFaultReason(String value) {
+ return new JAXBElement(_SessionFaultReason_QNAME, String.class, SessionFault.class, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfanyType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://hpc.microsoft.com/session/", name = "Context", scope = SessionFault.class)
+ public JAXBElement createSessionFaultContext(ArrayOfanyType value) {
+ return new JAXBElement(_SessionFaultContext_QNAME, ArrayOfanyType.class, SessionFault.class, value);
+ }
+
+}
diff --git a/test/SoaDiagServiceClient/com/microsoft/hpc/session/SessionFault.java b/test/SoaDiagServiceClient/com/microsoft/hpc/session/SessionFault.java
new file mode 100644
index 0000000..a276e61
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/hpc/session/SessionFault.java
@@ -0,0 +1,121 @@
+
+package com.microsoft.hpc.session;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlType;
+import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfanyType;
+
+
+/**
+ *
Java class for SessionFault complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ArrayOfanyType", propOrder = {
+ "anyType"
+})
+public class ArrayOfanyType {
+
+ @XmlElement(nillable = true)
+ protected List anyType;
+
+ /**
+ * Gets the value of the anyType property.
+ *
+ *
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a set method for the anyType property.
+ *
+ *
+ * For example, to add a new item, do as follows:
+ *
+ * getAnyType().add(newItem);
+ *
+ *
+ *
+ *
+ * Objects of the following type(s) are allowed in the list
+ * {@link Object }
+ *
+ *
+ */
+ public List getAnyType() {
+ if (anyType == null) {
+ anyType = new ArrayList();
+ }
+ return this.anyType;
+ }
+
+}
diff --git a/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java
new file mode 100644
index 0000000..3356f02
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ArrayOfstring.java
@@ -0,0 +1,69 @@
+
+package com.microsoft.schemas._2003._10.serialization.arrays;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ *
Java class for ArrayOfstring complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ArrayOfstring", propOrder = {
+ "string"
+})
+public class ArrayOfstring {
+
+ @XmlElement(nillable = true)
+ protected List string;
+
+ /**
+ * Gets the value of the string property.
+ *
+ *
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a set method for the string property.
+ *
+ *
+ * For example, to add a new item, do as follows:
+ *
+ * getString().add(newItem);
+ *
+ *
+ *
+ *
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List getString() {
+ if (string == null) {
+ string = new ArrayList();
+ }
+ return this.string;
+ }
+
+}
diff --git a/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java
new file mode 100644
index 0000000..d67c202
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/ObjectFactory.java
@@ -0,0 +1,71 @@
+
+package com.microsoft.schemas._2003._10.serialization.arrays;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the com.microsoft.schemas._2003._10.serialization.arrays package.
+ *
An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _ArrayOfanyType_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/Arrays", "ArrayOfanyType");
+ private final static QName _ArrayOfstring_QNAME = new QName("http://schemas.microsoft.com/2003/10/Serialization/Arrays", "ArrayOfstring");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.schemas._2003._10.serialization.arrays
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link ArrayOfstring }
+ *
+ */
+ public ArrayOfstring createArrayOfstring() {
+ return new ArrayOfstring();
+ }
+
+ /**
+ * Create an instance of {@link ArrayOfanyType }
+ *
+ */
+ public ArrayOfanyType createArrayOfanyType() {
+ return new ArrayOfanyType();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfanyType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", name = "ArrayOfanyType")
+ public JAXBElement createArrayOfanyType(ArrayOfanyType value) {
+ return new JAXBElement(_ArrayOfanyType_QNAME, ArrayOfanyType.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ArrayOfstring }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", name = "ArrayOfstring")
+ public JAXBElement createArrayOfstring(ArrayOfstring value) {
+ return new JAXBElement(_ArrayOfstring_QNAME, ArrayOfstring.class, null, value);
+ }
+
+}
diff --git a/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java
new file mode 100644
index 0000000..1e4e6d0
--- /dev/null
+++ b/test/SoaDiagServiceClient/com/microsoft/schemas/_2003/_10/serialization/arrays/package-info.java
@@ -0,0 +1,2 @@
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package com.microsoft.schemas._2003._10.serialization.arrays;
diff --git a/test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.wsdl b/test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.wsdl
new file mode 100644
index 0000000..a9d8424
--- /dev/null
+++ b/test/SoaDiagServiceClient/hpc.microsoft.com.SoaDiagService.wsdl
@@ -0,0 +1,155 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+