当前位置: 首页>>代码示例>>Java>>正文


Java RunningState.ERROR属性代码示例

本文整理汇总了Java中com.esri.ges.core.component.RunningState.ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java RunningState.ERROR属性的具体用法?Java RunningState.ERROR怎么用?Java RunningState.ERROR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.esri.ges.core.component.RunningState的用法示例。


在下文中一共展示了RunningState.ERROR属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stop

@Override
public void stop()
{
	super.stop();
	errorMessage = null;
	if( getRunningState() == RunningState.ERROR )
		setRunningState( RunningState.STOPPED );
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:8,代码来源:TcpSquirtOutboundTransport.java

示例2: stop

private void stop(boolean unregisterAsListener) {
	if (cleanupThread != null) {
		cleanupThread.dismiss();
		cleanupThread = null;
	}

	setErrorMessage(null);
	setRunningState(RunningState.STOPPED);

	if (unregisterAsListener) {
		try {
			GeoEventHttpClient http = httpClientService.createNewClient();
			String logouturl = host + "/user/logout";
			HttpRequestBase request = HttpUtil.createHttpRequest(http,
					logouturl, "POST", "", "application/json",
					"application/x-www-form-urlencoded", "", LOGGER);
			request.setHeader("Cookie", token);
			
			CloseableHttpResponse response;
			try {
				response = http.execute(request, httpTimeoutValue);
				if (response == null) {
					if (getRunningState() == RunningState.ERROR) {
						LOGGER.info("RECONNECTION_MSG", clientUrl);
						setErrorMessage(null);
						setRunningState(RunningState.STARTED);
					}

					context.setHttpResponse(response);
				} else {
					// log only if we were not in error state already
					if (getRunningState() != RunningState.ERROR) {
						;
					}
				}
			} catch (IOException e) {
				if( getRunningState() != RunningState.ERROR )
				{
					
					String errorMsg = LOGGER.translate("ERROR_ACCESSING_URL", clientUrl, e.getMessage());
					LOGGER.error(errorMsg);
					LOGGER.info(e.getMessage(), e);
					
					// set the error state
					setErrorMessage(errorMsg);
					setRunningState(RunningState.ERROR);
				}
			}

		} catch (Throwable t) {
			// Chances are we're shutting down...
			LOGGER.warn("STOP_ERROR", t.getMessage());
		}
	}
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:55,代码来源:MLOBIOutboundTransport.java

示例3: connectToAwsEventHub

private void connectToAwsEventHub()
{
  String errorMessage = null;
  RunningState runningState = RunningState.STARTED;

  try
  {
    applyProperties();
    if (propertiesNeedUpdating)
    {
      cleanup();
      propertiesNeedUpdating = false;
    }

    // iot service type: IOT_TOPIC|IOT_DEVICE
    isEventHubType = AwsIoTServiceType.IOT_TOPIC.toString().equals(iotServiceType);

    // Get KeyStore credentials
    KeyStorePasswordPair pair = AwsIoTHubUtil.getKeyStorePasswordPair(x509Certificate, privateKey, null);

    // create AwsClient
    clientId = String.format("%s-%s", thingName, new BigInteger(128, new SecureRandom()).toString(32));
    awsClient = new AWSIotMqttClient(clientEndpoint, clientId, pair.keyStore, pair.keyPassword);
    if (awsClient == null)
    {
      runningState = RunningState.ERROR;
      errorMessage = LOGGER.translate("FAILED_TO_CREATE_EH_CLIENT", clientEndpoint);
      LOGGER.error(errorMessage);
    }

    // attach device
    if (!isEventHubType)
    {
      LOGGER.info(System.currentTimeMillis() + ": ClientId: " + ": Attaching device:" + geIoTDevice.getThingName());
      geIoTDevice = new AwsIoTHubDevice(thingName);
      awsClient.attach(geIoTDevice);
    }

    // connect
    LOGGER.info(System.currentTimeMillis() + ": ClientId: " + clientId + ": Connecting");
    awsClient.connect();
    LOGGER.info(System.currentTimeMillis() + ": ClientId: " + clientId + ": Connected");

    // geIoTDevice.delete(10000); // delete shadow

    // register topic handler
    iotTopic = new AwsIoTTopicListener(topicName, AWSIotQos.QOS0);
    awsClient.subscribe(iotTopic, true);
    LOGGER.info("Subscribed to topic:" + topicName);

    setErrorMessage(errorMessage);
    setRunningState(runningState);
  }
  catch (AWSIotException iote)
  {
    LOGGER.error("AWSIOT_INIT_ERROR", iote);
    setErrorMessage(iote.getMessage());
    setRunningState(RunningState.ERROR);
  }
  catch (Exception ex)
  {
    LOGGER.error("INIT_ERROR", ex);
    setErrorMessage(ex.getMessage());
    setRunningState(RunningState.ERROR);
  }
}
 
开发者ID:Esri,项目名称:aws-for-geoevent,代码行数:66,代码来源:AwsIoTHubInboundTransport.java


注:本文中的com.esri.ges.core.component.RunningState.ERROR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。