You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/02/08 09:50:04 UTC
[incubator-linkis] branch dev-1.1.0-datasource updated: add spotless plugin to format code (#1378)
This is an automated email from the ASF dual-hosted git repository.
peacewong pushed a commit to branch dev-1.1.0-datasource
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
The following commit(s) were added to refs/heads/dev-1.1.0-datasource by this push:
new 2d7d4d4 add spotless plugin to format code (#1378)
2d7d4d4 is described below
commit 2d7d4d473f36b61007aa86d4621c45241f32fdbb
Author: legendtkl <ta...@gmail.com>
AuthorDate: Tue Feb 8 17:49:54 2022 +0800
add spotless plugin to format code (#1378)
---
.../linkis/common/errorcode/ErrorCodeUtils.java | 7 +-
.../errorcode/LinkisCommonsErrorCodeSummary.java | 29 +-
...inkisComputationGovernanceErrorCodeSummary.java | 41 +-
.../LinkisEngineConnErrorCodeSummary.java | 30 +-
.../common/errorcode/LinkisErrorCodeSummary.java | 44 +-
.../errorcode/LinkisExtensionErrorCodeSummary.java | 12 +-
.../errorcode/LinkisFrameErrorCodeSummary.java | 15 +-
.../LinkisPublicEnhancementErrorCodeSummary.java | 12 +-
.../LinkisSpringCloudServiceErrorCodeSummary.java | 15 +-
.../linkis/common/exception/ErrorException.java | 14 +-
.../linkis/common/exception/ExceptionLevel.java | 20 +-
.../linkis/common/exception/ExceptionManager.java | 40 +-
.../linkis/common/exception/FatalException.java | 14 +-
.../exception/LinkisCommonErrorException.java | 12 +-
.../linkis/common/exception/LinkisException.java | 60 +-
.../common/exception/LinkisRetryException.java | 9 +-
.../common/exception/LinkisRuntimeException.java | 51 +-
.../linkis/common/exception/WarnException.java | 14 +-
.../main/java/org/apache/linkis/common/io/Fs.java | 8 +-
.../java/org/apache/linkis/common/io/FsPath.java | 112 +-
.../apache/linkis/common/utils/ByteTimeUtils.java | 592 ++++-----
.../org/apache/linkis/common/utils/DESUtil.java | 40 +-
.../linkis/hadoop/common/utils/KerberosUtils.java | 38 +-
.../apache/linkis/message/annotation/Chain.java | 7 +-
.../apache/linkis/message/annotation/Implicit.java | 10 +-
.../apache/linkis/message/annotation/Method.java | 7 +-
.../linkis/message/annotation/NotImplicit.java | 10 +-
.../apache/linkis/message/annotation/Order.java | 7 +-
.../apache/linkis/message/annotation/Receiver.java | 10 +-
.../linkis/message/builder/DefaultMessageJob.java | 35 +-
.../message/builder/DefaultMessageJobBuilder.java | 8 +-
.../builder/DefaultServiceMethodContext.java | 16 +-
.../org/apache/linkis/message/builder/Future.java | 7 +-
.../apache/linkis/message/builder/MessageJob.java | 9 +-
.../linkis/message/builder/MessageJobBuilder.java | 7 +-
.../linkis/message/builder/MessageJobListener.java | 24 +-
.../message/builder/MessageJobTimeoutPolicy.java | 8 +-
.../message/builder/ServiceMethodContext.java | 10 +-
.../linkis/message/conf/MessageSchedulerConf.java | 50 +-
.../context/AbstractMessageSchedulerContext.java | 8 +-
.../context/DefaultMessageSchedulerContext.java | 16 +-
.../linkis/message/context/MSContextInstance.java | 18 +-
.../message/context/MessageSchedulerContext.java | 8 +-
.../context/SpringMessageSchedulerContext.java | 10 +-
.../message/exception/MessageErrorException.java | 8 +-
.../message/exception/MessageWarnException.java | 8 +-
.../message/parser/DefaultImplicitParser.java | 15 +-
.../message/parser/DefaultServiceParser.java | 34 +-
.../linkis/message/parser/ImplicitMethod.java | 7 +-
.../linkis/message/parser/ImplicitParser.java | 8 +-
.../linkis/message/parser/ServiceMethod.java | 7 +-
.../linkis/message/parser/ServiceParser.java | 10 +-
.../publisher/AbstractMessagePublisher.java | 164 ++-
.../message/publisher/DefaultMessagePublisher.java | 8 +-
.../linkis/message/publisher/MessagePublisher.java | 9 +-
.../message/registry/AbstractImplicitRegistry.java | 37 +-
.../message/registry/AbstractServiceRegistry.java | 28 +-
.../linkis/message/registry/ImplicitRegistry.java | 8 +-
.../linkis/message/registry/ServiceRegistry.java | 8 +-
.../message/registry/SpringImplicitRegistry.java | 18 +-
.../message/registry/SpringServiceRegistry.java | 19 +-
.../message/scheduler/AbstractMessageExecutor.java | 175 ++-
.../message/scheduler/DefaultMessageExecutor.java | 40 +-
.../message/scheduler/DefaultMessageScheduler.java | 33 +-
.../linkis/message/scheduler/MessageExecutor.java | 9 +-
.../scheduler/MessageExecutorExecutionManager.java | 31 +-
.../linkis/message/scheduler/MessageScheduler.java | 8 +-
.../message/scheduler/MethodExecuteWrapper.java | 9 +-
.../message/tx/SpringTransactionManager.java | 9 +-
.../linkis/message/tx/TransactionManager.java | 14 +-
.../apache/linkis/message/utils/MessageUtils.java | 18 +-
.../linkis/message/DefaultRequestProtocol.java | 14 +-
.../apache/linkis/message/ImplicitInterface.java | 14 +-
.../linkis/message/ImplicitInterfaceImpl.java | 13 +-
.../org/apache/linkis/message/ImplicitObject.java | 10 +-
.../linkis/message/SchedulerMessageTest.java | 25 +-
.../org/apache/linkis/message/TestService.java | 24 +-
.../org/apache/linkis/message/TestService2.java | 13 +-
.../apache/linkis/DataWorkCloudApplication.java | 165 +--
.../org/apache/linkis/LinkisBaseServerApp.java | 18 +-
.../apache/linkis/server/utils/AopTargetUtils.java | 27 +-
.../apache/linkis/mybatis/DataSourceConfig.java | 48 +-
.../linkis/mybatis/MyBatisMapperScannerConfig.java | 17 +-
.../mybatis/MybatisConfigurationFactory.java | 77 +-
.../linkis/mybatis/conf/MybatisConfiguration.java | 85 +-
.../linkis/protocol/AbstractRetryableProtocol.java | 10 +-
.../linkis/protocol/constants/TaskConstant.java | 8 +-
.../apache/linkis/protocol/engine/EngineInfo.java | 7 +-
.../apache/linkis/protocol/engine/EngineState.java | 19 +-
.../protocol/label/InsLabelAttachRequest.java | 23 +-
.../protocol/label/InsLabelQueryRequest.java | 15 +-
.../protocol/label/InsLabelQueryResponse.java | 9 +-
.../protocol/label/InsLabelRefreshRequest.java | 15 +-
.../protocol/label/InsLabelRemoveRequest.java | 15 +-
.../protocol/label/LabelInsQueryRequest.java | 11 +-
.../protocol/label/LabelInsQueryResponse.java | 8 +-
.../apache/linkis/protocol/label/LabelRequest.java | 10 +-
.../linkis/protocol/label/NodeLabelAddRequest.java | 12 +-
.../protocol/label/NodeLabelRemoveRequest.java | 11 +-
.../linkis/protocol/message/HttpProtocol.java | 11 +-
.../linkis/protocol/message/RequestMethod.java | 8 +-
.../linkis/protocol/message/RequestProtocol.java | 11 +-
.../linkis/protocol/query/QueryProtocol.java | 10 +-
.../linkis/protocol/query/cache/CacheNotFound.java | 9 +-
.../protocol/query/cache/CacheTaskResult.java | 6 +-
.../protocol/query/cache/FailedToDeleteCache.java | 6 +-
.../protocol/query/cache/FailedToWriteCache.java | 7 +-
.../protocol/query/cache/RequestDeleteCache.java | 6 +-
.../protocol/query/cache/RequestReadCache.java | 10 +-
.../protocol/query/cache/RequestWriteCache.java | 13 +-
.../protocol/query/cache/ResponseDeleteCache.java | 9 +-
.../protocol/query/cache/ResponseReadCache.java | 9 +-
.../protocol/query/cache/ResponseWriteCache.java | 9 +-
.../protocol/query/cache/SuccessDeletedCache.java | 9 +-
.../protocol/query/cache/SuccessWriteCache.java | 9 +-
.../linkis/protocol/usercontrol/RequestLogin.java | 10 +-
.../protocol/usercontrol/RequestRegister.java | 9 +-
.../usercontrol/RequestUserListFromWorkspace.java | 9 +-
.../protocol/usercontrol/RequestUserWorkspace.java | 11 +-
.../linkis/protocol/usercontrol/ResponseLogin.java | 7 +-
.../protocol/usercontrol/ResponseRegister.java | 9 +-
.../usercontrol/ResponseUserWorkspace.java | 11 +-
.../usercontrol/ResponseWorkspaceUserList.java | 7 +-
.../usercontrol/UserControlLoginProtocol.java | 10 +-
.../usercontrol/UserControlRegtisterProtocol.java | 10 +-
.../apache/linkis/protocol/util/ImmutablePair.java | 10 +-
.../apache/linkis/rpc/serializer/NoneDelegate.java | 11 +-
.../rpc/serializer/ProtostuffSerializeUtil.java | 35 +-
.../linkis/storage/domain/FsPathListWithError.java | 13 +-
.../linkis/storage/excel/ExcelStorageReader.java | 23 +-
.../org/apache/linkis/storage/excel/XlsUtils.java | 31 +-
.../org/apache/linkis/storage/excel/XlsxUtils.java | 45 +-
.../storage/exception/FSNotInitException.java | 9 +-
.../linkis/storage/exception/StorageErrorCode.java | 21 +-
.../storage/exception/StorageErrorException.java | 14 +-
.../storage/exception/StorageFatalException.java | 17 +-
.../storage/exception/StorageWarnException.java | 15 +-
.../linkis/storage/factory/BuildFactory.java | 7 +-
.../storage/factory/impl/BuildHDFSFileSystem.java | 20 +-
.../storage/factory/impl/BuildLocalFileSystem.java | 18 +-
.../org/apache/linkis/storage/fs/FileSystem.java | 29 +-
.../linkis/storage/fs/impl/HDFSFileSystem.java | 70 +-
.../linkis/storage/fs/impl/LocalFileSystem.java | 186 +--
.../storage/pipeline/DefaultPipelineFactory.java | 10 +-
.../linkis/storage/pipeline/PipelineReader.java | 19 +-
.../linkis/storage/pipeline/PipelineWriter.java | 12 +-
.../cli/application/LinkisClientApplication.java | 277 +++--
.../cli/application/constants/AppConstants.java | 19 +-
.../application/constants/LinkisClientKeys.java | 86 +-
.../cli/application/constants/LinkisConstants.java | 8 +-
.../cli/application/constants/LinkisKeys.java | 12 +-
.../constants/UjesClientDriverConstants.java | 12 +-
.../linkis/cli/application/data/FinishedData.java | 8 +-
.../linkis/cli/application/data/PreparedData.java | 11 +-
.../linkis/cli/application/data/ProcessedData.java | 13 +-
.../cli/application/driver/LinkisClientDriver.java | 30 +-
.../cli/application/driver/UjesClientDriver.java | 417 +++++--
.../driver/UjesClientDriverBuilder.java | 66 +-
.../driver/context/LinkisClientDriverContext.java | 8 +-
.../driver/context/UjesClientDriverContext.java | 12 +-
.../driver/transformer/DriverTransformer.java | 21 +-
.../transformer/UjesClientDriverTransformer.java | 276 +++--
.../interactor/command/LinkisCmdType.java | 15 +-
.../command/template/UniversalCmdTemplate.java | 324 +++--
.../executor/LinkisJobManExecutorBuilder.java | 28 +-
.../executor/LinkisJobManageExecutor.java | 89 +-
.../execution/executor/LinkisSubmitExecutor.java | 142 ++-
.../executor/LinkisSubmitExecutorBuilder.java | 27 +-
.../execution/jobexec/LinkisJobInfo.java | 7 +-
.../execution/jobexec/LinkisJobKill.java | 17 +-
.../execution/jobexec/LinkisJobSubmitExec.java | 18 +-
.../cli/application/interactor/job/LinkisJob.java | 10 +-
.../interactor/job/LinkisJobBuilder.java | 165 ++-
.../application/interactor/job/LinkisJobMan.java | 7 +-
.../interactor/job/LinkisJobManBuilder.java | 18 +-
.../interactor/result/PresentResultHandler.java | 17 +-
.../interactor/validate/LinkisJobValidator.java | 120 +-
.../interactor/validate/UjesContextValidator.java | 35 +-
.../presenter/DefaultStdOutPresenter.java | 11 +-
.../presenter/LinkisJobLogPresenter.java | 171 +--
.../presenter/LinkisJobResultPresenter.java | 176 ++-
.../application/presenter/QueryBasedPresenter.java | 31 +-
.../converter/LinkisJobInfoModelConverter.java | 67 +-
.../converter/LinkisJobKillModelConverter.java | 37 +-
.../converter/LinkisLogModelConverter.java | 20 +-
.../converter/LinkisResultModelConverter.java | 18 +-
.../presenter/model/LinkisJobIncLogModel.java | 12 +-
.../presenter/model/LinkisJobInfoModel.java | 33 +-
.../presenter/model/LinkisJobKillResultModel.java | 17 +-
.../presenter/model/LinkisJobResultModel.java | 11 +-
.../cli/application/suite/ExecutionSuite.java | 21 +-
.../application/suite/ExecutionSuiteFactory.java | 7 +-
.../cli/application/suite/SuiteFactoryImpl.java | 21 +-
.../apache/linkis/cli/application/utils/Utils.java | 18 +-
.../application/LinkisClientApplicationTest.java | 267 ++---
.../cli/application/constants/TestConstants.java | 48 +-
.../command/template/ProcessInputUtil.java | 89 +-
.../interactor/command/template/TestCmdType.java | 13 +-
.../command/template/TestParamMapper.java | 41 +-
.../command/template/TestSparkCmdTemplate.java | 272 +++--
.../interactor/execution/LinkisExecutorTest.java | 110 +-
.../interactor/job/LinkisJobBuilderTest.java | 109 +-
.../cli/common/constants/CommonConstants.java | 8 +-
.../cli/common/entity/command/CmdOption.java | 7 +-
.../cli/common/entity/command/CmdTemplate.java | 17 +-
.../linkis/cli/common/entity/command/CmdType.java | 8 +-
.../cli/common/entity/command/ParamItem.java | 34 +-
.../linkis/cli/common/entity/command/Params.java | 29 +-
.../common/entity/context/LinkisClientContext.java | 40 +-
.../entity/execution/CommonSubExecutionType.java | 9 +-
.../cli/common/entity/execution/Execution.java | 13 +-
.../common/entity/execution/ExecutionResult.java | 16 +-
.../common/entity/execution/SubExecutionType.java | 8 +-
.../common/entity/execution/executor/Executor.java | 12 +-
.../entity/execution/executor/ExecutorContext.java | 11 +-
.../entity/execution/jobexec/ExecutionStatus.java | 9 +-
.../common/entity/execution/jobexec/JobExec.java | 9 +-
.../common/entity/execution/jobexec/JobStatus.java | 13 +-
.../apache/linkis/cli/common/entity/job/Job.java | 55 +-
.../linkis/cli/common/entity/job/OutputWay.java | 9 +-
.../common/entity/properties/ClientProperties.java | 19 +-
.../cli/common/entity/result/ResultHandler.java | 6 +-
.../entity/version/ClientVersionInformation.java | 12 +-
.../common/exception/LinkisClientException.java | 12 +-
.../exception/LinkisClientRuntimeException.java | 45 +-
.../cli/common/exception/error/ErrorLevel.java | 23 +-
.../cli/common/exception/error/ErrorMsg.java | 9 +-
.../common/exception/handler/ExceptionHandler.java | 9 +-
.../linkis/cli/common/utils/GenericsUtils.java | 17 +-
.../utils/converter/AbstractStringConverter.java | 13 +-
.../cli/common/utils/converter/Converter.java | 10 +-
.../linkis/cli/core/builder/AbstractBuilder.java | 14 +-
.../cli/core/builder/BuildableByVarAccess.java | 22 +-
.../apache/linkis/cli/core/builder/Builder.java | 9 +-
.../linkis/cli/core/constants/CommonKeys.java | 12 +-
.../linkis/cli/core/constants/Constants.java | 13 +-
.../apache/linkis/cli/core/data/ClientContext.java | 13 +-
.../cli/core/exception/BuilderException.java | 14 +-
.../cli/core/exception/CommandException.java | 23 +-
.../cli/core/exception/ExecutorException.java | 27 +-
.../cli/core/exception/PresenterException.java | 16 +-
.../linkis/cli/core/exception/PropsException.java | 12 +-
.../cli/core/exception/TransformerException.java | 15 +-
.../cli/core/exception/UnknownException.java | 12 +-
.../cli/core/exception/ValidateException.java | 14 +-
.../cli/core/exception/VarAccessException.java | 17 +-
.../cli/core/exception/error/CommonErrMsg.java | 63 +-
.../exception/handler/CommandExceptionHandler.java | 17 +-
.../exception/handler/DefaultExceptionHandler.java | 14 +-
.../interactor/command/fitter/AbstractFitter.java | 120 +-
.../cli/core/interactor/command/fitter/Fitter.java | 11 +-
.../interactor/command/fitter/FitterResult.java | 13 +-
.../interactor/command/fitter/FitterUtils.java | 10 +-
.../interactor/command/fitter/SingleTplFitter.java | 19 +-
.../interactor/command/parser/AbstarctParser.java | 77 +-
.../cli/core/interactor/command/parser/Parser.java | 12 +-
.../interactor/command/parser/SingleCmdParser.java | 27 +-
.../command/parser/result/ParseResult.java | 12 +-
.../command/parser/transformer/ParamKeyMapper.java | 46 +-
.../command/template/AbstractCmdTemplate.java | 337 ++++--
.../command/template/option/BaseOption.java | 29 +-
.../interactor/command/template/option/Flag.java | 40 +-
.../command/template/option/MapOption.java | 49 +-
.../command/template/option/Parameter.java | 34 +-
.../command/template/option/SpecialMapOption.java | 17 +-
.../command/template/option/StdOption.java | 35 +-
.../core/interactor/execution/AsyncSubmission.java | 13 +-
.../interactor/execution/ExecutionResultImpl.java | 12 +-
.../core/interactor/execution/HelpExecution.java | 6 +-
.../core/interactor/execution/JobManSubType.java | 10 +-
.../core/interactor/execution/JobManagement.java | 57 +-
.../core/interactor/execution/SyncSubmission.java | 108 +-
.../execution/executor/AsyncBackendExecutor.java | 12 +-
.../execution/executor/ExecutorBuilder.java | 10 +-
.../executor/JobManagableBackendExecutor.java | 6 +-
.../execution/executor/LogRetrievable.java | 11 +-
.../execution/executor/SyncBackendExecutor.java | 12 +-
.../interactor/execution/jobexec/JobManExec.java | 15 +-
.../execution/jobexec/JobSubmitExec.java | 32 +-
.../execution/observer/event/IncLogEvent.java | 23 +-
.../observer/event/LinkisClientEvent.java | 12 +-
.../observer/event/SingleObserverEvent.java | 12 +-
.../execution/observer/event/TriggerEvent.java | 11 +-
.../observer/listener/IncLogEventListener.java | 24 +-
.../observer/listener/LinkisClientObserver.java | 9 +-
.../observer/listener/TriggerObserver.java | 9 +-
.../linkis/cli/core/interactor/job/JobBuilder.java | 10 +-
.../interactor/properties/PropertiesLoader.java | 9 +-
.../interactor/properties/PropsFilesScanner.java | 40 +-
.../core/interactor/properties/StdPropsLoader.java | 15 +-
.../properties/reader/PropertiesReader.java | 9 +-
.../properties/reader/PropsFileReader.java | 27 +-
.../interactor/properties/reader/SysEnvReader.java | 16 +-
.../properties/reader/SysPropsReader.java | 20 +-
.../interactor/result/DefaultResultHandler.java | 10 +-
.../core/interactor/validate/ParamValidator.java | 12 +-
.../interactor/validate/ParsedTplValidator.java | 44 +-
.../core/interactor/validate/PropsValidator.java | 14 +-
.../cli/core/interactor/validate/Validator.java | 9 +-
.../cli/core/interactor/var/StdVarAccess.java | 134 ++-
.../cli/core/interactor/var/SysVarAccess.java | 34 +-
.../linkis/cli/core/interactor/var/VarAccess.java | 13 +-
.../cli/core/presenter/HelpInfoPresenter.java | 35 +-
.../linkis/cli/core/presenter/Presenter.java | 13 +-
.../cli/core/presenter/display/DisplayDriver.java | 13 +-
.../presenter/display/PlainTextFileDriver.java | 45 +-
.../cli/core/presenter/display/StdOutDriver.java | 13 +-
.../core/presenter/display/data/FileOutData.java | 9 +-
.../display/factory/DisplayDriverFactory.java | 14 +-
.../cli/core/presenter/model/HelpInfoModel.java | 10 +-
.../cli/core/presenter/model/JobExecModel.java | 32 +-
.../cli/core/presenter/model/ModelConverter.java | 7 +-
.../cli/core/presenter/model/PresenterModel.java | 13 +-
.../apache/linkis/cli/core/utils/CommonUtils.java | 19 +-
.../org/apache/linkis/cli/core/utils/LogUtils.java | 10 +-
.../apache/linkis/cli/core/utils/SpecialMap.java | 10 +-
.../converter/PredefinedStringConverters.java | 269 +++--
.../linkis/cli/core/constants/TestConstants.java | 34 +-
.../handler/CommandExceptionHandlerTest.java | 26 +-
.../cli/core/interactor/command/TestCmdType.java | 13 +-
.../command/fitter/SingleTplFitterTest.java | 127 +-
.../command/parser/SingleCmdParserTest.java | 151 +--
.../command/template/TestParamMapper.java | 15 +-
.../command/template/TestSparkCmdTemplate.java | 247 ++--
.../interactor/properties/StdPropsLoaderTest.java | 88 +-
.../cli/core/interactor/var/StdVarAccessTest.java | 303 +++--
.../apache/linkis/cli/core/utils/TestUtils.java | 13 +-
.../computation/client/FlinkOnceJobTest.java | 93 +-
.../computation/client/InteractiveJobTest.java | 26 +-
.../ujes/client/PythonImageJavaClientTest.java | 177 +--
.../linkis/ujes/client/UJESClientImplTestJ.java | 65 +-
.../common/entity/ExecutionNodeStatus.java | 18 +-
.../governance/common/entity/NodeExistStatus.java | 10 +-
.../governance/common/entity/job/JobRequest.java | 34 +-
.../common/entity/job/JobRequestWithDetail.java | 7 +-
.../common/entity/job/QueryException.java | 7 +-
.../governance/common/entity/job/SubJobDetail.java | 189 ++-
.../governance/common/entity/job/SubJobInfo.java | 100 +-
.../common/entity/task/RequestInsertTask.java | 10 +-
.../common/entity/task/RequestOneTask.java | 6 +-
.../common/entity/task/RequestPersistTask.java | 108 +-
.../common/entity/task/RequestQueryTask.java | 11 +-
.../common/entity/task/RequestReadAllTask.java | 12 +-
.../common/entity/task/RequestUpdateTask.java | 10 +-
.../common/entity/task/ResponsePersist.java | 27 +-
.../linkis/ecm/server/LinkisECMApplication.java | 17 +-
.../acessible/executor/log/AbstractLogCache.java | 7 +-
.../acessible/executor/log/LogCache.java | 14 +-
.../acessible/executor/log/MountLogCache.java | 10 +-
.../acessible/executor/log/SendAppender.java | 47 +-
.../acessible/executor/log/TimeLogCache.java | 14 +-
.../linkis/entrance/LinkisEntranceApplication.java | 9 +-
.../BackGroundServiceBeanAnnotation.java | 17 +-
.../annotation/ConsumerManagerBeanAnnotation.java | 17 +-
.../annotation/EngineBuilderBeanAnnotation.java | 17 +-
.../annotation/EngineManagerBeanAnnotation.java | 17 +-
.../annotation/EngineRequesterBeanAnnotation.java | 17 +-
.../annotation/EngineSelectorBeanAnnotation.java | 17 +-
.../annotation/EntranceContextBeanAnnotation.java | 17 +-
.../EntranceExecutorManagerBeanAnnotation.java | 19 +-
.../EntranceInterceptorBeanAnnotation.java | 19 +-
.../EntranceListenerBusBeanAnnotation.java | 16 +-
.../EntranceLogListenerBusBeanAnnotation.java | 16 +-
.../annotation/EntranceParserBeanAnnotation.java | 17 +-
.../annotation/EntranceServerBeanAnnotation.java | 17 +-
.../ErrorCodeListenerBeanAnnotation.java | 17 +-
.../annotation/ErrorCodeManagerBeanAnnotation.java | 17 +-
.../annotation/GroupFactoryBeanAnnotation.java | 17 +-
.../annotation/LogManagerBeanAnnotation.java | 19 +-
.../NewEngineBroadcastListenerBeanAnnotation.java | 17 +-
.../PersistenceEngineBeanAnnotation.java | 17 +-
.../PersistenceManagerBeanAnnotation.java | 17 +-
.../annotation/ReceiverChooserBeanAnnotation.java | 17 +-
...atusChangedBroadcastListenerBeanAnnotation.java | 17 +-
.../annotation/ResultSetEngineBeanAnnotation.java | 17 +-
.../annotation/SchedulerBeanAnnotation.java | 17 +-
.../annotation/SchedulerContextBeanAnnotation.java | 17 +-
.../entrance/conf/EntranceSpringConfiguration.java | 150 ++-
.../entrance/context/DefaultEntranceContext.java | 34 +-
.../entrance/exception/EntranceErrorCode.java | 17 +-
.../exception/EntranceIllegalParamException.java | 9 +-
.../entrance/exception/EntranceRPCException.java | 16 +-
.../entrance/exception/QueryFailedException.java | 15 +-
.../entrance/job/EntranceExecuteRequest.java | 23 +-
.../linkis/entrance/job/EntranceExecutionJob.java | 178 +--
.../entrance/parser/AbstractEntranceParser.java | 79 +-
.../apache/linkis/entrance/parser/ParserUtils.java | 47 +-
.../persistence/AbstractPersistenceEngine.java | 10 +-
.../persistence/QueryPersistenceEngine.java | 150 ++-
.../persistence/QueryPersistenceManager.java | 76 +-
.../entrance/restful/EntranceRestfulApi.java | 292 +++--
.../entrance/server/DefaultEntranceServer.java | 23 +-
.../label/builder/AbstractGenericLabelBuilder.java | 242 ++--
.../label/builder/CombinedLabelBuilder.java | 21 +-
.../label/builder/DefaultGlobalLabelBuilder.java | 252 ++--
.../label/builder/ExtensibleLabelBuilder.java | 30 +-
.../manager/label/builder/GenericLabelBuilder.java | 53 +-
.../linkis/manager/label/builder/LabelBuilder.java | 15 +-
.../manager/label/builder/LabelBuilderAdapter.java | 61 +-
.../label/builder/factory/LabelBuilderFactory.java | 35 +-
.../factory/LabelBuilderFactoryContext.java | 15 +-
.../builder/factory/StdLabelBuilderFactory.java | 137 ++-
.../manager/label/conf/LabelCommonConfig.java | 67 +-
.../manager/label/constant/LabelConstant.java | 8 +-
.../manager/label/constant/LabelKeyConstant.java | 6 +-
.../manager/label/entity/CloneableLabel.java | 11 +-
.../linkis/manager/label/entity/CombinedLabel.java | 9 +-
.../manager/label/entity/CombinedLabelImpl.java | 27 +-
.../linkis/manager/label/entity/EMNodeLabel.java | 9 +-
.../manager/label/entity/EngineNodeLabel.java | 9 +-
.../linkis/manager/label/entity/Feature.java | 44 +-
.../linkis/manager/label/entity/FunctionLabel.java | 9 +-
.../linkis/manager/label/entity/GenericLabel.java | 22 +-
.../manager/label/entity/InheritableLabel.java | 16 +-
.../apache/linkis/manager/label/entity/Label.java | 23 +-
.../linkis/manager/label/entity/NodeLabel.java | 9 +-
.../linkis/manager/label/entity/ResourceLabel.java | 9 +-
.../manager/label/entity/SerializableLabel.java | 97 +-
.../linkis/manager/label/entity/TenantLabel.java | 23 +-
.../manager/label/entity/UserModifiable.java | 7 +-
.../manager/label/entity/annon/KeyMethod.java | 11 +-
.../manager/label/entity/annon/ValueSerialNum.java | 8 +-
.../manager/label/entity/cache/CacheLabel.java | 8 +-
.../manager/label/entity/cluster/ClusterLabel.java | 10 +-
.../manager/label/entity/cluster/EnvLabel.java | 17 +-
.../label/entity/config/ConfigurationLabel.java | 9 +-
.../manager/label/entity/em/EMInstanceLabel.java | 26 +-
.../label/entity/engine/CodeLanguageLabel.java | 8 +-
.../entity/engine/ConcurrentEngineConnLabel.java | 7 +-
.../label/entity/engine/EngineBaseInfoLabel.java | 7 +-
.../label/entity/engine/EngineInstanceLabel.java | 15 +-
.../label/entity/engine/EngineTypeLabel.java | 7 +-
.../label/entity/engine/ReuseExclusionLabel.java | 9 +-
.../label/entity/engine/UserCreatorLabel.java | 17 +-
.../label/entity/entrance/BindEngineLabel.java | 122 +-
.../label/entity/entrance/ExecuteOnceLabel.java | 9 +-
.../entity/entrance/JobQueuingTimeoutLabel.java | 11 +-
.../entity/entrance/JobRunningTimeoutLabel.java | 11 +-
.../label/entity/entrance/JobStrategyLabel.java | 9 +-
.../label/entity/entrance/LoadBalanceLabel.java | 13 +-
.../entity/node/AliasServiceInstanceLabel.java | 7 +-
.../label/entity/node/NodeInstanceLabel.java | 10 +-
.../manager/label/entity/route/RouteLabel.java | 23 +-
.../label/entity/search/SearchableLabel.java | 14 +-
.../label/exception/LabelErrorException.java | 10 +-
.../label/exception/LabelRuntimeException.java | 9 +-
.../label/utils/EngineTypeLabelCreator.java | 55 +-
.../linkis/manager/label/utils/LabelUtils.java | 214 ++--
.../linkis/manager/label/TestLabelBuilder.java | 14 +-
.../manager/am/LinkisManagerApplication.java | 15 +-
.../linkis/manager/am/exception/AMErrorCode.java | 21 +-
.../manager/am/exception/AMErrorException.java | 7 +-
.../manager/am/exception/AMRetryException.java | 8 +-
.../linkis/manager/am/restful/EMRestfulApi.java | 265 ++--
.../manager/am/restful/EngineRestfulApi.java | 223 ++--
.../linkis/manager/am/vo/AMEngineNodeVo.java | 11 +-
.../org/apache/linkis/manager/am/vo/EMNodeVo.java | 12 +-
.../linkis/manager/common/constant/AMConstant.java | 8 +-
.../common/entity/enumeration/NodeHealthy.java | 27 +-
.../common/entity/enumeration/NodeStatus.java | 68 +-
.../manager/common/entity/label/LabelKeyValue.java | 11 +-
.../common/entity/metrics/AMNodeMetrics.java | 9 +-
.../common/entity/metrics/NodeHealthyInfo.java | 7 +-
.../manager/common/entity/metrics/NodeMetrics.java | 8 +-
.../common/entity/metrics/NodeOverLoadInfo.java | 7 +-
.../common/entity/metrics/NodeTaskInfo.java | 7 +-
.../manager/common/entity/node/AMEMNode.java | 27 +-
.../manager/common/entity/node/AMEngineNode.java | 32 +-
.../linkis/manager/common/entity/node/AMNode.java | 10 +-
.../entity/node/DefaultScoreServiceInstance.java | 7 +-
.../linkis/manager/common/entity/node/EMNode.java | 11 +-
.../manager/common/entity/node/EngineNode.java | 10 +-
.../manager/common/entity/node/InfoRMNode.java | 7 +-
.../manager/common/entity/node/LabelNode.java | 9 +-
.../linkis/manager/common/entity/node/Node.java | 12 +-
.../linkis/manager/common/entity/node/RMNode.java | 7 +-
.../common/entity/node/ScoreServiceInstance.java | 14 +-
.../entity/persistence/PersistenceLabel.java | 11 +-
.../entity/persistence/PersistenceLabelRel.java | 1 -
.../common/entity/persistence/PersistenceLock.java | 7 +-
.../common/entity/persistence/PersistenceNode.java | 8 +-
.../entity/persistence/PersistenceNodeEntity.java | 13 +-
.../entity/persistence/PersistenceNodeMetrics.java | 16 +-
.../persistence/PersistenceNodeMetricsEntity.java | 13 +-
.../entity/persistence/PersistenceResource.java | 12 +-
.../common/entity/resource/CommonNodeResource.java | 38 +-
.../common/entity/resource/NodeResource.java | 10 +-
.../common/entity/resource/ResourceType.java | 16 +-
.../common/entity/resource/UserResource.java | 3 +-
.../common/exception/ResourceWarnException.java | 11 +-
.../manager/common/protocol/bml/BmlResource.java | 54 +-
.../protocol/conf/RemoveCacheConfRequest.java | 6 +-
.../common/protocol/em/EMInfoClearRequest.java | 9 +-
.../manager/common/protocol/em/EMRequest.java | 7 +-
.../common/protocol/em/EMResourceClearRequest.java | 3 +-
.../common/protocol/em/GetEMEnginesRequest.java | 7 +-
.../common/protocol/em/GetEMInfoRequest.java | 7 +-
.../manager/common/protocol/em/PauseEMRequest.java | 7 +-
.../manager/common/protocol/em/StopEMRequest.java | 7 +-
.../common/protocol/engine/EngineAskRequest.java | 33 +-
.../protocol/engine/EngineConnReleaseRequest.java | 16 +-
.../protocol/engine/EngineCreateRequest.java | 28 +-
.../protocol/engine/EngineInfoClearRequest.java | 12 +-
.../common/protocol/engine/EngineLockType.java | 13 +-
.../protocol/engine/EngineRecyclingRequest.java | 7 +-
.../common/protocol/engine/EngineRequest.java | 7 +-
.../common/protocol/engine/EngineReuseRequest.java | 21 +-
.../common/protocol/engine/EngineStopRequest.java | 22 +-
.../common/protocol/engine/EngineStopResponse.java | 8 +-
.../protocol/engine/EngineSuicideRequest.java | 23 +-
.../protocol/engine/EngineSwitchRequest.java | 7 +-
.../common/protocol/node/HeartbeatProtocol.java | 10 +-
.../common/protocol/node/NodeHeartbeatMsg.java | 17 +-
.../common/protocol/node/NodeHeartbeatRequest.java | 7 +-
.../common/protocol/node/NodeRequestProtocol.java | 10 +-
.../common/protocol/node/NodeStatusProtocol.java | 10 +-
.../common/protocol/node/RequestNodeStatus.java | 7 +-
.../common/protocol/node/ResponseNodeStatus.java | 7 +-
.../common/protocol/node/StopNodeRequest.java | 7 +-
.../linkis/manager/common/utils/ManagerUtils.java | 16 +-
.../exception/RMErrorException.java | 10 +-
.../exception/RMFatalException.java | 7 +-
.../resourcemanager/exception/RMWarnException.java | 7 +-
.../protocol/TimeoutEMEngineRequest.java | 6 +-
.../protocol/TimeoutEMEngineResponse.java | 6 +-
.../manager/PersistenceSpringConfiguration.java | 65 +-
.../linkis/manager/dao/LabelManagerMapper.java | 100 +-
.../linkis/manager/dao/LockManagerMapper.java | 17 +-
.../linkis/manager/dao/NodeManagerMapper.java | 137 ++-
.../manager/dao/NodeMetricManagerMapper.java | 105 +-
.../linkis/manager/dao/ResourceManagerMapper.java | 99 +-
.../org/apache/linkis/manager/entity/Tunple.java | 7 +-
.../exception/NodeInstanceDuplicateException.java | 9 +-
.../exception/NodeInstanceNotFoundException.java | 7 +-
.../exception/PersistenceErrorException.java | 14 +-
.../exception/PersistenceWarnException.java | 7 +-
.../persistence/LabelManagerPersistence.java | 38 +-
.../persistence/LockManagerPersistence.java | 11 +-
.../manager/persistence/ManagerPersistence.java | 10 +-
.../persistence/NodeManagerPersistence.java | 23 +-
.../persistence/NodeMetricManagerPersistence.java | 16 +-
.../persistence/ResourceLabelPersistence.java | 31 +-
.../persistence/ResourceManagerPersistence.java | 53 +-
.../impl/DefaultLabelManagerPersistence.java | 158 ++-
.../impl/DefaultLockManagerPersistence.java | 30 +-
.../impl/DefaultManagerPersistence.java | 16 +-
.../impl/DefaultNodeManagerPersistence.java | 86 +-
.../impl/DefaultNodeMetricManagerPersistence.java | 51 +-
.../impl/DefaultResourceLabelPersistence.java | 111 +-
.../impl/DefaultResourceManagerPersistence.java | 92 +-
.../linkis/manager/util/PersistenceUtils.java | 52 +-
.../src/test/java/PersistenceTest.java | 112 +-
.../src/test/java/Scan.java | 19 +-
.../resourcemanager/domain/RMLabelContainer.java | 70 +-
.../resourcemanager/exception/RMErrorCode.java | 34 +-
.../external/dao/ExternalResourceProviderDao.java | 7 +-
.../external/domain/ExternalAppInfo.java | 9 +-
.../domain/ExternalResourceIdentifier.java | 6 +-
.../external/domain/ExternalResourceProvider.java | 22 +-
.../parser/ExternalResourceIdentifierParser.java | 7 +-
.../parser/YarnResourceIdentifierParser.java | 6 +-
.../request/ExternalResourceRequester.java | 14 +-
.../external/service/ExternalResourceService.java | 33 +-
.../service/impl/ExternalResourceServiceImpl.java | 153 ++-
.../external/yarn/YarnResourceIdentifier.java | 8 +-
.../restful/vo/ApplicationListVo.java | 9 +-
.../restful/vo/EngineInstanceVo.java | 6 +-
.../linkis/resourcemanager/utils/AlertUtils.java | 84 +-
.../utils/RequestKerberosUrlUtils.java | 121 +-
.../flink/client/config/Environment.java | 601 +++++-----
.../flink/client/config/entries/ConfigEntry.java | 72 +-
.../client/config/entries/ExecutionEntry.java | 676 ++++++-----
.../flink/client/context/ExecutionContext.java | 1259 ++++++++++----------
.../deployment/ClusterDescriptorAdapter.java | 335 +++---
.../ClusterDescriptorAdapterFactory.java | 38 +-
.../YarnApplicationClusterDescriptorAdapter.java | 52 +-
.../YarnPerJobClusterDescriptorAdapter.java | 102 +-
.../factory/LinkisYarnClusterClientFactory.java | 46 +-
.../flink/client/result/AbstractResult.java | 51 +-
.../flink/client/result/BatchResult.java | 213 ++--
.../flink/client/result/ChangelogResult.java | 452 +++----
.../flink/client/result/Result.java | 43 +-
.../flink/client/result/ResultUtil.java | 154 +--
.../flink/client/result/TypedResult.java | 131 +-
.../client/sql/operation/AbstractJobOperation.java | 46 +-
.../flink/client/sql/operation/JobOperation.java | 20 +-
.../client/sql/operation/NonJobOperation.java | 10 +-
.../flink/client/sql/operation/Operation.java | 13 +-
.../client/sql/operation/OperationFactory.java | 16 +-
.../client/sql/operation/OperationFactoryImpl.java | 29 +-
.../flink/client/sql/operation/OperationUtil.java | 90 +-
.../sql/operation/impl/CreateViewOperation.java | 73 +-
.../client/sql/operation/impl/DDLOperation.java | 123 +-
.../sql/operation/impl/DescribeTableOperation.java | 135 ++-
.../sql/operation/impl/DropViewOperation.java | 85 +-
.../sql/operation/impl/ExplainOperation.java | 88 +-
.../client/sql/operation/impl/InsertOperation.java | 84 +-
.../client/sql/operation/impl/ResetOperation.java | 43 +-
.../client/sql/operation/impl/SelectOperation.java | 113 +-
.../client/sql/operation/impl/SetOperation.java | 144 +--
.../sql/operation/impl/ShowCatalogsOperation.java | 35 +-
.../impl/ShowCurrentCatalogOperation.java | 32 +-
.../impl/ShowCurrentDatabaseOperation.java | 32 +-
.../sql/operation/impl/ShowDatabasesOperation.java | 35 +-
.../sql/operation/impl/ShowFunctionsOperation.java | 35 +-
.../sql/operation/impl/ShowModulesOperation.java | 35 +-
.../sql/operation/impl/ShowTablesOperation.java | 69 +-
.../sql/operation/impl/ShowViewsOperation.java | 64 +-
.../sql/operation/impl/UseCatalogOperation.java | 60 +-
.../sql/operation/impl/UseDatabaseOperation.java | 52 +-
.../client/sql/operation/result/ColumnInfo.java | 142 ++-
.../client/sql/operation/result/ConstantNames.java | 54 +-
.../client/sql/operation/result/ResultKind.java | 18 +-
.../client/sql/operation/result/ResultSet.java | 313 +++--
.../result/ResultSetJsonDeserializer.java | 328 +++--
.../operation/result/ResultSetJsonSerializer.java | 170 ++-
.../flink/client/sql/parser/SqlCommand.java | 28 +-
.../flink/client/sql/parser/SqlCommandCall.java | 6 +-
.../flink/client/sql/parser/SqlCommandParser.java | 19 +-
.../client/sql/parser/SqlCommandParserImpl.java | 94 +-
.../flink/client/utils/YarnConfLoader.java | 92 +-
.../flink/exception/ExecutorInitException.java | 37 +-
.../flink/exception/FlinkInitFailedException.java | 25 +-
.../flink/exception/JobExecutionException.java | 25 +-
.../flink/exception/SqlExecutionException.java | 25 +-
.../flink/exception/SqlParseException.java | 25 +-
.../linkis/engineplugin/hive/log/HiveProgress.java | 6 +-
.../hive/serde/CustomerDelimitedJSONSerDe.java | 363 ++++--
.../engineplugin/io/utils/ReflectionUtils.java | 7 +-
.../engineplugin/jdbc/ConnectionManager.java | 91 +-
.../manager/engineplugin/jdbc/JdbcAuthType.java | 7 +-
.../engineplugin/jdbc/TestConnectionManager.java | 5 +-
.../engineplugin/cache/EngineConnPluginCache.java | 17 +-
.../cache/GuavaEngineConnPluginCache.java | 135 ++-
.../cache/config/EngineConnPluginCacheConfig.java | 17 +-
.../DefaultRefreshPluginCacheContainer.java | 208 ++--
.../cache/refresh/PluginCacheRefresher.java | 7 +-
.../cache/refresh/RefreshPluginCacheContainer.java | 15 +-
.../cache/refresh/RefreshPluginCacheOperation.java | 37 +-
.../refresh/RefreshableEngineConnPluginCache.java | 16 +-
.../classloader/EngineConnPluginClassLoader.java | 80 +-
.../loaders/CacheablesEngineConnPluginLoader.java | 86 +-
.../loaders/DefaultEngineConnPluginLoader.java | 199 ++--
.../manager/loaders/EngineConnPluginsLoader.java | 11 +-
.../loaders/EngineConnPluginsResourceLoader.java | 15 +-
.../BmlEngineConnPluginResourceLoader.java | 227 ++--
.../LocalEngineConnPluginResourceLoader.java | 32 +-
.../manager/loaders/resource/PluginResource.java | 23 +-
.../manager/utils/EngineConnPluginUtils.java | 93 +-
.../manager/utils/ExceptionHelper.java | 10 +-
.../src/test/java/EngineConnPluginLoaderTest.java | 16 +-
.../server/LinkisEngineConnPluginServer.java | 8 +-
.../conf/EngineConnPluginSpringConfiguration.java | 9 +-
.../server/dao/EngineConnBmlResourceDao.java | 12 +-
.../server/entity/EngineConnBmlResource.java | 7 +-
.../computation/utils/TaskTreeUtil.java | 22 +-
.../linkis/orchestrator/ecm/entity/Policy.java | 19 +-
.../linkis/bml/client/AbstractBmlClient.java | 6 +-
.../org/apache/linkis/bml/client/BmlClient.java | 68 +-
.../apache/linkis/bml/client/BmlClientFactory.java | 15 +-
.../apache/linkis/bml/model/AbstractAuditable.java | 7 +-
.../org/apache/linkis/bml/Entity/BmlProject.java | 6 +-
.../apache/linkis/bml/Entity/DownloadModel.java | 50 +-
.../org/apache/linkis/bml/Entity/Resource.java | 70 +-
.../org/apache/linkis/bml/Entity/ResourceTask.java | 244 ++--
.../apache/linkis/bml/Entity/ResourceVersion.java | 22 +-
.../java/org/apache/linkis/bml/Entity/Version.java | 6 +-
.../apache/linkis/bml/LinkisBMLApplication.java | 7 +-
.../org/apache/linkis/bml/common/Constant.java | 11 +-
.../apache/linkis/bml/common/ExecutorManager.java | 178 +--
.../linkis/bml/common/HdfsResourceHelper.java | 76 +-
.../linkis/bml/common/LocalResourceHelper.java | 62 +-
.../apache/linkis/bml/common/OperationEnum.java | 14 +-
.../apache/linkis/bml/common/ResourceHelper.java | 16 +-
.../linkis/bml/common/ResourceHelperFactory.java | 18 +-
.../apache/linkis/bml/common/ScheduledTask.java | 37 +-
.../org/apache/linkis/bml/dao/BmlProjectDao.java | 89 +-
.../org/apache/linkis/bml/dao/DownloadDao.java | 8 +-
.../org/apache/linkis/bml/dao/ResourceDao.java | 10 +-
.../java/org/apache/linkis/bml/dao/TaskDao.java | 71 +-
.../java/org/apache/linkis/bml/dao/VersionDao.java | 62 +-
.../linkis/bml/restful/BmlProjectRestful.java | 341 ++++--
.../apache/linkis/bml/restful/BmlRestfulApi.java | 693 +++++++----
.../apache/linkis/bml/restful/RestfulUtils.java | 58 +-
.../linkis/bml/service/BmlProjectService.java | 15 +-
.../org/apache/linkis/bml/service/BmlService.java | 10 +-
.../bml/service/BmlShareResourceService.java | 22 +-
.../apache/linkis/bml/service/DownloadService.java | 6 +-
.../apache/linkis/bml/service/ResourceService.java | 45 +-
.../org/apache/linkis/bml/service/TaskService.java | 57 +-
.../apache/linkis/bml/service/VersionService.java | 90 +-
.../bml/service/impl/BmlProjectServiceImpl.java | 75 +-
.../linkis/bml/service/impl/BmlServiceImpl.java | 11 +-
.../service/impl/BmlShareResourceServiceImpl.java | 26 +-
.../bml/service/impl/DownloadServiceImpl.java | 10 +-
.../bml/service/impl/ResourceServiceImpl.java | 76 +-
.../linkis/bml/service/impl/TaskServiceImpl.java | 357 +++---
.../bml/service/impl/VersionServiceImpl.java | 110 +-
.../org/apache/linkis/bml/threading/Scheduler.java | 10 +-
.../java/org/apache/linkis/bml/threading/Task.java | 10 +-
.../org/apache/linkis/bml/threading/TaskState.java | 26 +-
.../apache/linkis/bml/util/HttpRequestHelper.java | 18 +-
.../java/org/apache/linkis/bml/util/MD5Utils.java | 15 +-
.../org/apache/linkis/bml/vo/ResourceBasicVO.java | 11 +-
.../java/org/apache/linkis/bml/vo/ResourceVO.java | 6 +-
.../apache/linkis/bml/vo/ResourceVersionsVO.java | 22 +-
.../cs/contextcache/ContextCacheService.java | 35 +-
.../contextcache/DefaultContextCacheService.java | 146 ++-
.../linkis/cs/contextcache/cache/ContextCache.java | 8 +-
.../cs/contextcache/cache/DefaultContextCache.java | 89 +-
.../cs/contextcache/cache/csid/ContextIDValue.java | 8 +-
.../cache/csid/ContextIDValueGenerator.java | 8 +-
.../csid/impl/ContextIDValueGeneratorImpl.java | 57 +-
.../cache/csid/impl/ContextIDValueImpl.java | 32 +-
.../cache/cskey/ContextKeyValueContext.java | 16 +-
.../cache/cskey/ContextValueMapSet.java | 7 +-
.../cache/cskey/impl/ContextValueMapSetImpl.java | 49 +-
.../cskey/impl/DefaultContextKeyValueContext.java | 64 +-
.../cache/guava/ContextIDRemoveListener.java | 24 +-
.../cs/contextcache/cleaner/AUTOCleaner.java | 8 +-
.../cs/contextcache/conf/ContextCacheConf.java | 14 +-
.../contextcache/index/ContextInvertedIndex.java | 6 +-
.../index/ContextInvertedIndexSet.java | 7 +-
.../index/ContextInvertedIndexSetImpl.java | 21 +-
.../index/DefaultContextInvertedIndex.java | 19 +-
.../cs/contextcache/metric/ClassIntrospector.java | 105 +-
.../cs/contextcache/metric/ContextCacheMetric.java | 7 +-
.../cs/contextcache/metric/ContextIDMetric.java | 8 +-
.../metric/DefaultContextCacheMetric.java | 13 +-
.../metric/DefaultContextIDMetric.java | 6 +-
.../linkis/cs/contextcache/metric/Metrtic.java | 9 +-
.../linkis/cs/contextcache/metric/ObjectInfo.java | 118 +-
.../cs/contextcache/metric/SizeEstimator.java | 13 +-
.../contextcache/parser/ContextKeyValueParser.java | 6 +-
.../parser/DefaultContextKeyValueParser.java | 52 +-
.../cs/contextcache/utils/ContextCacheUtils.java | 9 +-
.../cs/contextcache/test/csid/TestContextID.java | 6 +-
.../contextcache/test/keyword/TestContextKey.java | 20 +-
.../test/keyword/TestContextKeyValue.java | 8 +-
.../test/keyword/TestContextKeyValueParser.java | 8 +-
.../test/keyword/TestContextValue.java | 10 +-
.../test/service/TestContextCacheService.java | 74 +-
.../linkis/cs/client/AbstractContextClient.java | 11 +-
.../java/org/apache/linkis/cs/client/Context.java | 42 +-
.../org/apache/linkis/cs/client/ContextClient.java | 88 +-
.../org/apache/linkis/cs/client/LinkisContext.java | 11 +-
.../linkis/cs/client/LinkisWorkFlowContext.java | 48 +-
.../cs/client/builder/ContextClientConfig.java | 10 +-
.../cs/client/builder/ContextClientFactory.java | 16 +-
.../cs/client/builder/HttpContextClientConfig.java | 56 +-
.../client/builder/RPCHttpContextClientConfig.java | 9 +-
.../cs/client/http/ContextPostActionBuilder.java | 9 +-
.../linkis/cs/client/http/HttpContextClient.java | 572 +++++----
.../linkis/cs/client/http/HttpHeartBeater.java | 97 +-
.../cs/client/listener/ContextClientEvent.java | 10 +-
.../cs/client/listener/ContextClientListener.java | 8 +-
.../client/listener/ContextClientListenerBus.java | 16 +-
.../listener/ContextClientListenerManager.java | 24 +-
.../cs/client/listener/ContextIDListener.java | 55 +-
.../cs/client/listener/ContextKeyListener.java | 43 +-
.../cs/client/listener/ContextUpdateEvent.java | 9 +-
.../linkis/cs/client/listener/HeartBeater.java | 12 +-
.../cs/client/service/CSMetaDataService.java | 26 +-
.../linkis/cs/client/service/CSNodeService.java | 7 +-
.../cs/client/service/CSNodeServiceImpl.java | 18 +-
.../cs/client/service/CSResourceService.java | 37 +-
.../cs/client/service/CSResultDataService.java | 14 +-
.../cs/client/service/CSResultDataServiceImpl.java | 57 +-
.../linkis/cs/client/service/CSTableService.java | 58 +-
.../cs/client/service/CSVariableService.java | 30 +-
.../linkis/cs/client/service/CSWorkService.java | 9 +-
.../cs/client/service/CSWorkServiceImpl.java | 29 +-
.../service/ContextHistoryClientService.java | 9 +-
.../service/ContextHistoryClientServiceImpl.java | 16 +-
.../cs/client/service/DefaultSearchService.java | 120 +-
.../cs/client/service/LinkisJobDataService.java | 14 +-
.../client/service/LinkisJobDataServiceImpl.java | 41 +-
.../linkis/cs/client/service/MetaDataService.java | 11 +-
.../linkis/cs/client/service/ResourceService.java | 13 +-
.../linkis/cs/client/service/SearchService.java | 28 +-
.../linkis/cs/client/service/TableService.java | 18 +-
.../linkis/cs/client/service/VariableService.java | 12 +-
.../cs/client/utils/ContextServiceUtils.java | 74 +-
.../linkis/cs/client/utils/ExceptionHelper.java | 9 +-
.../linkis/cs/client/utils/SerializeHelper.java | 47 +-
.../org/apache/linkis/cs/client/test/Test.java | 21 +-
.../cs/client/test/bean/ClientTestContextKey.java | 31 +-
.../client/test/bean/ClientTestContextValue.java | 9 +-
.../cs/client/test/bean/ResourceValueBean.java | 10 +-
.../test/listener/CommonContextKeyListener.java | 10 +-
.../cs/client/test/restful/ListenerTest.java | 9 +-
.../linkis/cs/client/test/restful/RestfulTest.java | 28 +-
.../linkis/cs/client/test/service/TestInfo.java | 28 +-
.../linkis/cs/client/test/service/TestRemove.java | 23 +-
.../cs/client/test/service/TestSearchService.java | 37 +-
.../test/test_multiuser/TestChangeContext.java | 23 +-
.../test/test_multiuser/TestCreateContext.java | 27 +-
.../linkis/cs/common/annotation/KeywordMethod.java | 7 +-
.../linkis/cs/common/entity/data/CSResultData.java | 10 +-
.../apache/linkis/cs/common/entity/data/Data.java | 6 +-
.../linkis/cs/common/entity/data/JobData.java | 6 +-
.../cs/common/entity/data/LinkisJobData.java | 8 +-
.../cs/common/entity/enumeration/ContextScope.java | 16 +-
.../cs/common/entity/enumeration/ContextType.java | 21 +-
.../cs/common/entity/enumeration/DBType.java | 17 +-
.../cs/common/entity/enumeration/ExpireType.java | 14 +-
.../cs/common/entity/enumeration/WorkType.java | 7 +-
.../apache/linkis/cs/common/entity/env/Env.java | 10 +-
.../apache/linkis/cs/common/entity/env/OSEnv.java | 8 +-
.../linkis/cs/common/entity/env/SoftWareEnv.java | 7 +-
.../cs/common/entity/env/SoftwareLibEnv.java | 7 +-
.../entity/history/AbstractContextHistory.java | 6 +-
.../entity/history/CommonResourceHistory.java | 10 +-
.../cs/common/entity/history/ContextHistory.java | 7 +-
.../entity/history/ContextHistoryIndexer.java | 6 +-
.../common/entity/history/EnvContextHistory.java | 8 +-
.../history/GlobalPropertyContextHistory.java | 15 +-
.../entity/history/KeywordContextHistroy.java | 8 +-
.../entity/history/ResourceContextHistory.java | 13 +-
.../history/metadata/CSTableLineageHistory.java | 12 +-
.../metadata/CSTableMetadataContextHistory.java | 7 +-
.../history/metadata/DBMetadataContextHistory.java | 9 +-
.../history/metadata/MetadataContextHistory.java | 14 +-
.../history/metadata/TableLineageHistory.java | 8 +-
.../history/metadata/TableOperationType.java | 13 +-
.../listener/CommonContextIDListenerDomain.java | 9 +-
.../listener/CommonContextKeyListenerDomain.java | 11 +-
.../entity/listener/ContextIDListenerDomain.java | 8 +-
.../entity/listener/ContextKeyListenerDomain.java | 8 +-
.../cs/common/entity/listener/ListenerDomain.java | 8 +-
.../linkis/cs/common/entity/metadata/CSColumn.java | 7 +-
.../linkis/cs/common/entity/metadata/CSDB.java | 10 +-
.../cs/common/entity/metadata/CSPartition.java | 7 +-
.../linkis/cs/common/entity/metadata/CSTable.java | 8 +-
.../linkis/cs/common/entity/metadata/Column.java | 7 +-
.../linkis/cs/common/entity/metadata/DB.java | 7 +-
.../cs/common/entity/metadata/Partition.java | 6 +-
.../linkis/cs/common/entity/metadata/Table.java | 6 +-
.../cs/common/entity/object/CSFlowInfos.java | 8 +-
.../linkis/cs/common/entity/object/CSInfos.java | 7 +-
.../linkis/cs/common/entity/object/CSProperty.java | 7 +-
.../entity/object/CommonGlobalConfiguration.java | 12 +-
.../cs/common/entity/object/CommonProperty.java | 8 +-
.../cs/common/entity/object/LinkisVariable.java | 10 +-
.../cs/common/entity/resource/BMLResource.java | 8 +-
.../common/entity/resource/CommonFxResource.java | 7 +-
.../common/entity/resource/CommonUDFResource.java | 7 +-
.../cs/common/entity/resource/FxResource.java | 7 +-
.../common/entity/resource/LinkisBMLResource.java | 8 +-
.../linkis/cs/common/entity/resource/Resource.java | 10 +-
.../cs/common/entity/resource/UDFResource.java | 7 +-
.../entity/source/CombinedNodeIDContextID.java | 10 +-
.../cs/common/entity/source/CommonContextID.java | 11 +-
.../cs/common/entity/source/CommonContextKey.java | 16 +-
.../entity/source/CommonContextKeyValue.java | 8 +-
.../common/entity/source/CommonContextValue.java | 14 +-
.../cs/common/entity/source/CommonHAContextID.java | 7 +-
.../linkis/cs/common/entity/source/ContextID.java | 15 +-
.../cs/common/entity/source/ContextIDParser.java | 8 +-
.../linkis/cs/common/entity/source/ContextKey.java | 11 +-
.../cs/common/entity/source/ContextKeyValue.java | 7 +-
.../cs/common/entity/source/ContextValue.java | 10 +-
.../cs/common/entity/source/CreatorContextKey.java | 7 +-
.../cs/common/entity/source/HAContextID.java | 8 +-
.../entity/source/LinkisHAWorkFlowContextID.java | 10 +-
.../entity/source/LinkisWorkflowContextID.java | 10 +-
.../cs/common/entity/source/OrderContextKey.java | 7 +-
.../linkis/cs/common/entity/source/Source.java | 10 +-
.../cs/common/entity/source/UserContextID.java | 9 +-
.../linkis/cs/common/entity/source/ValueBean.java | 7 +-
.../cs/common/entity/source/VersionContextKey.java | 7 +-
.../cs/common/entity/source/WorkflowContextID.java | 8 +-
.../cs/common/entity/source/YMLContextKey.java | 8 +-
.../cs/common/exception/CSErrorException.java | 11 +-
.../cs/common/exception/CSWarnException.java | 6 +-
.../linkis/cs/common/exception/ErrorCode.java | 9 +-
.../cs/common/listener/ContextIDListener.java | 6 +-
.../cs/common/listener/ContextKeyListener.java | 8 +-
.../cs/common/protocol/ContextHTTPConstant.java | 8 +-
.../cs/common/protocol/ContextHistoryType.java | 13 +-
.../linkis/cs/common/protocol/ContextIDType.java | 26 +-
.../linkis/cs/common/protocol/ContextKeyType.java | 17 +-
.../cs/common/protocol/ContextKeyValueType.java | 11 +-
.../cs/common/protocol/ContextValueType.java | 17 +-
.../search/ContextSearchConditionMapBuilder.java | 87 +-
.../cs/common/serialize/AbstractSerializer.java | 22 +-
.../cs/common/serialize/ContextSerializer.java | 8 +-
.../helper/AbstractSerializationHelper.java | 31 +-
.../helper/ContextSerializationHelper.java | 25 +-
.../serialize/helper/SerializationHelper.java | 9 +-
.../context/CombinedNodeIDContextIDSerializer.java | 16 +-
.../impl/context/CommonContextKeySerializer.java | 10 +-
.../impl/context/ContextKeyValueSerializer.java | 13 +-
.../impl/context/ContextValueSerializer.java | 17 +-
.../LinkisHAWorkFlowContextIDSerializer.java | 19 +-
.../impl/history/CommonHistorySerializer.java | 7 +-
.../history/CommonResourceHistorySerializer.java | 17 +-
.../history/metadata/CSTableLineageSerializer.java | 26 +-
.../metadata/CSTableMetadataHistorySerializer.java | 14 +-
.../impl/value/LinkisBMLResourceSerializer.java | 11 +-
.../impl/value/data/CSResultDataSerializer.java | 11 +-
.../impl/value/data/LinkisJobDataSerializer.java | 8 +-
.../impl/value/metadata/CSTableSerializer.java | 9 +-
.../impl/value/object/CSFlowInfosSerializer.java | 8 +-
.../value/object/LinkisVariableSerializer.java | 8 +-
.../linkis/cs/common/utils/CSCommonUtils.java | 39 +-
.../cs/common/utils/CSHighAvailableUtils.java | 65 +-
.../test/ContextSerializationHelperTest.java | 54 +-
.../cs/highavailable/AbstractContextHAManager.java | 6 +-
.../linkis/cs/highavailable/ContextHAManager.java | 12 +-
.../cs/highavailable/DefaultContextHAManager.java | 57 +-
.../conf/ContextHighAvailableConf.java | 15 +-
.../cs/highavailable/exception/CSErrorCode.java | 8 +-
.../highavailable/ha/BackupInstanceGenerator.java | 7 +-
.../cs/highavailable/ha/ContextHAChecker.java | 6 +-
.../cs/highavailable/ha/ContextHAIDGenerator.java | 7 +-
.../ha/impl/BackupInstanceGeneratorImpl.java | 31 +-
.../ha/impl/ContextHACheckerImpl.java | 49 +-
.../ha/impl/ContextHAIDGeneratorImpl.java | 35 +-
.../pluggable/HAContextPersistenceManagerImpl.java | 47 +-
.../highavailable/proxy/MethodInterceptorImpl.java | 111 +-
.../highavailable/test/TestContextHAManager.java | 144 ++-
.../cs/highavailable/test/haid/TestHAID.java | 6 +-
.../test/persist/TestPersistence.java | 17 +-
.../apache/linkis/cs/listener/CSIDListener.java | 10 +-
.../apache/linkis/cs/listener/CSKeyListener.java | 10 +-
.../cs/listener/ContextAsyncEventListener.java | 6 +-
.../ListenerBus/ContextAsyncListenerBus.java | 18 +-
.../listener/callback/AbstractCallbackEngine.java | 10 +-
.../cs/listener/callback/CallbackEngine.java | 9 +-
.../listener/callback/ContextIDCallbackEngine.java | 10 +-
.../callback/ContextKeyCallbackEngine.java | 7 +-
.../cs/listener/callback/imp/ClientSource.java | 13 +-
.../listener/callback/imp/ContextKeyValueBean.java | 10 +-
.../imp/DefaultContextIDCallbackEngine.java | 80 +-
.../imp/DefaultContextKeyCallbackEngine.java | 89 +-
.../cs/listener/conf/ContextListenerConf.java | 21 +-
.../linkis/cs/listener/event/ContextIDEvent.java | 7 +-
.../linkis/cs/listener/event/ContextKeyEvent.java | 10 +-
.../cs/listener/event/enumeration/OperateType.java | 19 +-
.../listener/event/impl/DefaultContextIDEvent.java | 9 +-
.../event/impl/DefaultContextKeyEvent.java | 9 +-
.../cs/listener/manager/ListenerManager.java | 15 +-
.../manager/imp/DefaultContextListenerManager.java | 16 +-
.../linkis/cs/listener/test/TestContextID.java | 7 +-
.../linkis/cs/listener/test/TestContextKey.java | 26 +-
.../cs/listener/test/TestContextKeyValue.java | 7 +-
.../linkis/cs/listener/test/TestContextValue.java | 18 +-
.../cs/persistence/ContextPersistenceBeans.java | 11 +-
.../cs/persistence/ContextPersistenceManager.java | 8 +-
.../persistence/ContextPersistenceManagerImpl.java | 16 +-
.../linkis/cs/persistence/annotation/Ignore.java | 10 +-
.../linkis/cs/persistence/annotation/Tuning.java | 10 +-
.../persistence/aop/PersistenceTuningAspect.java | 42 +-
.../cs/persistence/conf/PersistenceConf.java | 18 +-
.../cs/persistence/dao/ContextHistoryMapper.java | 26 +-
.../persistence/dao/ContextIDListenerMapper.java | 10 +-
.../linkis/cs/persistence/dao/ContextIDMapper.java | 7 +-
.../persistence/dao/ContextKeyListenerMapper.java | 12 +-
.../cs/persistence/dao/ContextMapMapper.java | 44 +-
.../cs/persistence/entity/ExtraFieldClass.java | 7 +-
.../entity/PersistenceContextHistory.java | 7 +-
.../persistence/entity/PersistenceContextID.java | 7 +-
.../entity/PersistenceContextIDListener.java | 7 +-
.../persistence/entity/PersistenceContextKey.java | 11 +-
.../entity/PersistenceContextKeyListener.java | 7 +-
.../entity/PersistenceContextKeyValue.java | 6 +-
.../entity/PersistenceContextValue.java | 11 +-
.../cs/persistence/exception/ThrowingFunction.java | 7 +-
.../persistence/ContextHistoryPersistence.java | 8 +-
.../persistence/ContextIDListenerPersistence.java | 14 +-
.../persistence/ContextIDPersistence.java | 8 +-
.../persistence/ContextKeyListenerPersistence.java | 18 +-
.../persistence/ContextMapPersistence.java | 16 +-
.../persistence/ContextMetricsPersistence.java | 10 +-
.../KeywordContextHistoryPersistence.java | 10 +-
.../persistence/TransactionManager.java | 8 +-
.../impl/ContextHistoryPersistenceImpl.java | 41 +-
.../impl/ContextIDListenerPersistenceImpl.java | 30 +-
.../persistence/impl/ContextIDPersistenceImpl.java | 36 +-
.../impl/ContextKeyListenerPersistenceImpl.java | 65 +-
.../impl/ContextMapPersistenceImpl.java | 68 +-
.../impl/ContextMetricsPersistenceImpl.java | 11 +-
.../impl/KeywordContextHistoryPersistenceImpl.java | 38 +-
.../persistence/impl/TransactionManagerImpl.java | 13 +-
.../cs/persistence/util/PersistenceUtils.java | 49 +-
.../linkis/cs/persistence/AContextHistory.java | 7 +-
.../apache/linkis/cs/persistence/AContextID.java | 11 +-
.../linkis/cs/persistence/AContextIDListener.java | 7 +-
.../apache/linkis/cs/persistence/AContextKey.java | 12 +-
.../linkis/cs/persistence/AContextKeyListener.java | 7 +-
.../linkis/cs/persistence/AContextKeyValue.java | 7 +-
.../linkis/cs/persistence/AContextValue.java | 11 +-
.../linkis/cs/persistence/ContextHistoryTest.java | 27 +-
.../cs/persistence/ContextIDListenerTest.java | 18 +-
.../linkis/cs/persistence/ContextIDTest.java | 15 +-
.../cs/persistence/ContextKeyListenerTest.java | 20 +-
.../linkis/cs/persistence/ContextMapTest.java | 45 +-
.../linkis/cs/persistence/ExtraFieldClassTest.java | 33 +-
.../linkis/cs/persistence/MapTypeAdapter.java | 14 +-
.../apache/linkis/cs/persistence/ProxyMethodA.java | 6 +-
.../apache/linkis/cs/persistence/ProxyTest.java | 6 +-
.../org/apache/linkis/cs/persistence/Scan.java | 18 +-
.../java/org/apache/linkis/cs/ContextSearch.java | 17 +-
.../org/apache/linkis/cs/DefaultContextSearch.java | 66 +-
.../cs/condition/AbstractCommonCondition.java | 9 +-
.../linkis/cs/condition/AtomicCondition.java | 9 +-
.../linkis/cs/condition/BinaryLogicCondition.java | 10 +-
.../org/apache/linkis/cs/condition/Condition.java | 10 +-
.../apache/linkis/cs/condition/ConditionType.java | 6 +-
.../linkis/cs/condition/UnaryLogicCondition.java | 8 +-
.../condition/construction/AndConditionParser.java | 13 +-
.../condition/construction/ConditionBuilder.java | 12 +-
.../construction/ConditionBuilderImpl.java | 25 +-
.../cs/condition/construction/ConditionParser.java | 47 +-
.../construction/ContainsConditionParser.java | 8 +-
.../construction/ContextScopeConditionParser.java | 11 +-
.../construction/ContextTypeConditionParser.java | 11 +-
.../ContextValueTypeConditionParser.java | 13 +-
.../construction/NearestConditionParser.java | 17 +-
.../condition/construction/NotConditionParser.java | 12 +-
.../condition/construction/OrConditionParser.java | 13 +-
.../construction/RegexConditionParser.java | 8 +-
.../linkis/cs/condition/impl/AndCondition.java | 6 +-
.../cs/condition/impl/ContainsCondition.java | 8 +-
.../cs/condition/impl/ContextScopeCondition.java | 6 +-
.../cs/condition/impl/ContextTypeCondition.java | 6 +-
.../condition/impl/ContextValueTypeCondition.java | 6 +-
.../linkis/cs/condition/impl/NearestCondition.java | 9 +-
.../linkis/cs/condition/impl/NotCondition.java | 6 +-
.../linkis/cs/condition/impl/OrCondition.java | 8 +-
.../linkis/cs/condition/impl/RegexCondition.java | 6 +-
.../cs/exception/ContextSearchFailedException.java | 6 +-
.../cs/execution/AbstractConditionExecution.java | 21 +-
.../linkis/cs/execution/ConditionExecution.java | 13 +-
.../fetcher/AbstractContextCacheFetcher.java | 8 +-
.../cs/execution/fetcher/ContextCacheFetcher.java | 7 +-
.../fetcher/ContextTypeContextSearchFetcher.java | 15 +-
.../fetcher/IterateContextCacheFetcher.java | 14 +-
.../cs/execution/impl/AndConditionExecution.java | 12 +-
.../impl/BinaryLogicConditionExecution.java | 27 +-
.../execution/impl/ContainsConditionExecution.java | 14 +-
.../impl/ContextScopeConditionExecution.java | 14 +-
.../impl/ContextTypeConditionExecution.java | 15 +-
.../impl/ContextValueTypeConditionExecution.java | 14 +-
.../execution/impl/NearestConditionExecution.java | 18 +-
.../cs/execution/impl/NotConditionExecution.java | 12 +-
.../cs/execution/impl/OrConditionExecution.java | 12 +-
.../cs/execution/impl/RegexConditionExecution.java | 14 +-
.../impl/UnaryLogicConditionExecution.java | 11 +-
.../matcher/AbstractContextSearchMatcher.java | 8 +-
.../matcher/AndLogicContextSearchMatcher.java | 11 +-
.../matcher/BinaryLogicContextSearchMatcher.java | 9 +-
.../matcher/ConditionMatcherResolver.java | 26 +-
.../matcher/ContainsContextSearchMatcher.java | 9 +-
.../matcher/ContextScopeContextSearchMatcher.java | 6 +-
.../cs/execution/matcher/ContextSearchMatcher.java | 7 +-
.../matcher/ContextTypeContextSearchMatcher.java | 8 +-
.../ContextValueTypeContextSearchMatcher.java | 8 +-
.../matcher/NearestLogicContextSearchMatcher.java | 8 +-
.../matcher/NotLogicContextSearchMatcher.java | 8 +-
.../matcher/OrLogicContextSearchMatcher.java | 11 +-
.../matcher/RegexContextSearchMatcher.java | 13 +-
.../execution/matcher/SkipContextSearchMather.java | 8 +-
.../matcher/UnaryLogicContextSearchMatcher.java | 8 +-
.../ruler/AbstractContextSearchRuler.java | 8 +-
.../ruler/CommonListContextSearchRuler.java | 18 +-
.../cs/execution/ruler/ContextSearchRuler.java | 7 +-
.../execution/ruler/NearestContextSearchRuler.java | 162 +--
.../linkis/cs/optimize/ConditionOptimizer.java | 7 +-
.../linkis/cs/optimize/OptimizedCondition.java | 30 +-
.../cs/optimize/cost/ConditionCostCalculator.java | 16 +-
.../apache/linkis/cs/optimize/dfs/BinaryTree.java | 9 +-
.../linkis/cs/optimize/dfs/MinCostBinaryTree.java | 24 +-
.../org/apache/linkis/cs/optimize/dfs/Node.java | 12 +-
.../optimize/impl/CostBasedConditionOptimizer.java | 7 +-
.../test/java/org/apache/linkis/cs/AndTest.java | 9 +-
.../java/org/apache/linkis/cs/ContainsTest.java | 21 +-
.../org/apache/linkis/cs/ContextScopeTest.java | 27 +-
.../org/apache/linkis/cs/ContextSearchTest.java | 19 +-
.../java/org/apache/linkis/cs/ContextTypeTest.java | 19 +-
.../test/java/org/apache/linkis/cs/RegexTest.java | 21 +-
.../org/apache/linkis/cs/csid/TestContextID.java | 7 +-
.../apache/linkis/cs/keyword/TestContextKey.java | 14 +-
.../linkis/cs/keyword/TestContextKeyValue.java | 9 +-
.../apache/linkis/cs/keyword/TestContextValue.java | 11 +-
.../org/apache/linkis/cs/parser/ApiJsonTest.java | 92 +-
.../linkis/cs/server/LinkisCSApplication.java | 7 +-
.../linkis/cs/server/conf/ContextServerConf.java | 18 +-
.../cs/server/enumeration/ServiceMethod.java | 22 +-
.../linkis/cs/server/enumeration/ServiceType.java | 11 +-
.../cs/server/parser/DefaultKeywordParser.java | 43 +-
.../cs/server/parser/KeywordMethodEntity.java | 7 +-
.../linkis/cs/server/parser/KeywordParser.java | 9 +-
.../protocol/AbstractHttpRequestProtocol.java | 7 +-
.../cs/server/protocol/ContextHistoryProtocol.java | 6 +-
.../cs/server/protocol/ContextIDProtocol.java | 7 +-
.../server/protocol/ContextListenerProtocol.java | 7 +-
.../linkis/cs/server/protocol/ContextProtocol.java | 7 +-
.../linkis/cs/server/protocol/HttpProtocol.java | 10 +-
.../cs/server/protocol/HttpRequestProtocol.java | 8 +-
.../cs/server/protocol/HttpResponseProtocol.java | 7 +-
.../cs/server/protocol/RestResponseProtocol.java | 12 +-
.../server/restful/ContextHistoryRestfulApi.java | 59 +-
.../cs/server/restful/ContextIDRestfulApi.java | 51 +-
.../server/restful/ContextListenerRestfulApi.java | 38 +-
.../cs/server/restful/ContextRestfulApi.java | 100 +-
.../linkis/cs/server/restful/CsRestfulParent.java | 39 +-
.../linkis/cs/server/scheduler/CsScheduler.java | 7 +-
.../cs/server/scheduler/DefaultCsScheduler.java | 38 +-
.../linkis/cs/server/scheduler/HttpAnswerJob.java | 8 +-
.../cs/server/scheduler/HttpAnswerJobBuilder.java | 7 +-
.../apache/linkis/cs/server/scheduler/HttpJob.java | 8 +-
.../linkis/cs/server/scheduler/HttpJobBuilder.java | 7 +-
.../cs/server/scheduler/HttpPriorityJob.java | 8 +-
.../linkis/cs/server/scheduler/RestJobBuilder.java | 8 +-
.../cs/server/scheduler/impl/CsExecuteRequest.java | 8 +-
.../scheduler/impl/CsExecutorExecutionManager.java | 20 +-
.../cs/server/scheduler/impl/CsJobListener.java | 18 +-
.../cs/server/scheduler/impl/CsSchedulerBean.java | 20 +-
.../cs/server/scheduler/impl/CsSchedulerJob.java | 11 +-
.../impl/JobToExecuteRequestConsumer.java | 6 +-
.../linkis/cs/server/service/AbstractService.java | 40 +-
.../cs/server/service/ContextHistoryService.java | 20 +-
.../linkis/cs/server/service/ContextIDService.java | 7 +-
.../cs/server/service/ContextListenerService.java | 14 +-
.../linkis/cs/server/service/ContextService.java | 36 +-
.../apache/linkis/cs/server/service/Service.java | 6 +-
.../service/impl/ContextHistoryServiceImpl.java | 53 +-
.../server/service/impl/ContextIDServiceImpl.java | 16 +-
.../service/impl/ContextListenerServiceImpl.java | 35 +-
.../cs/server/service/impl/ContextServiceImpl.java | 157 ++-
.../org/apache/linkis/cs/server/util/CsUtils.java | 11 +-
.../linkis/cs/server/ContextHistoryRestfulApi.java | 52 +-
.../linkis/cs/server/ContextIDRestfulApi.java | 44 +-
.../cs/server/ContextListenerRestfulApi.java | 30 +-
.../apache/linkis/cs/server/ContextRestfulApi.java | 101 +-
.../apache/linkis/cs/server/CsRestfulParent.java | 15 +-
.../java/org/apache/linkis/cs/server/Scan.java | 18 +-
.../org/apache/linkis/cs/server/SchedulerTest.java | 9 +-
.../datasourcemanager/common/ServiceErrorCode.java | 8 +-
.../datasourcemanager/common/auth/AuthContext.java | 28 +-
.../common/domain/DataSource.java | 100 +-
.../common/domain/DataSourceEnv.java | 79 +-
.../domain/DataSourceParamKeyDefinition.java | 128 +-
.../common/domain/DataSourceParameter.java | 20 +-
.../common/domain/DataSourceType.java | 39 +-
.../common/domain/DatasourceVersion.java | 55 +-
.../common/exception/JsonErrorException.java | 4 +-
.../datasourcemanager/common/util/CryptoUtils.java | 29 +-
.../common/util/PatternInjectUtils.java | 169 +--
.../datasourcemanager/common/util/json/Json.java | 95 +-
.../core/LinkisDataSourceManagerApplication.java | 4 +-
.../datasourcemanager/core/dao/DataSourceDao.java | 32 +-
.../core/dao/DataSourceEnvDao.java | 18 +-
.../core/dao/DataSourceParamKeyDao.java | 16 +-
.../core/dao/DataSourceTypeDao.java | 8 +-
.../core/dao/DataSourceTypeEnvDao.java | 13 +-
.../core/dao/DataSourceVersionDao.java | 16 +-
.../CustomMultiPartFormDataTransformer.java | 160 +--
.../core/formdata/FormDataTransformerFactory.java | 19 +-
.../core/formdata/FormStreamContent.java | 10 +-
.../formdata/MultiPartFormDataTransformer.java | 15 +-
.../core/restful/DataSourceAdminRestfulApi.java | 246 ++--
.../core/restful/DataSourceCoreRestfulApi.java | 668 ++++++-----
.../core/restful/DataSourceOperateRestfulApi.java | 86 +-
.../core/restful/RestfulApiHelper.java | 88 +-
.../exception/BeanValidationExceptionMapper.java | 17 +-
.../core/service/BmlAppService.java | 19 +-
.../core/service/DataSourceInfoService.java | 52 +-
.../core/service/DataSourceOpService.java | 9 +-
.../core/service/DataSourceRelateService.java | 14 +-
.../core/service/MetadataOperateService.java | 20 +-
.../core/service/impl/BmlAppServiceImpl.java | 107 +-
.../service/impl/DataSourceInfoServiceImpl.java | 337 +++---
.../service/impl/DataSourceRelateServiceImpl.java | 16 +-
.../service/impl/MetadataOperateServiceImpl.java | 132 +-
.../validate/DataSourceParameterValidator.java | 74 +-
.../core/validate/ParameterValidateException.java | 6 +-
.../core/validate/ParameterValidateStrategy.java | 16 +-
.../core/validate/ParameterValidator.java | 14 +-
.../strategy/RegExpParameterValidateStrategy.java | 65 +-
.../strategy/TypeParameterValidateStrategy.java | 55 +-
.../datasourcemanager/core/vo/DataSourceEnvVo.java | 15 +-
.../datasourcemanager/core/vo/DataSourceVo.java | 24 +-
.../datasourcemanager/core/vo/PageViewVo.java | 6 +-
.../metadatamanager/common/MdmConfiguration.java | 4 +-
.../common/cache/CacheConfiguration.java | 14 +-
.../metadatamanager/common/cache/CacheManager.java | 14 +-
.../common/cache/ConnCacheManager.java | 57 +-
.../common/domain/MetaColumnInfo.java | 12 +-
.../common/domain/MetaPartitionInfo.java | 29 +-
.../exception/MetaMethodInvokeException.java | 7 +-
.../common/exception/MetaRuntimeException.java | 8 +-
.../common/service/AbstractMetaService.java | 160 +--
.../common/service/BaseMetadataService.java | 11 +-
.../common/service/MetadataConnection.java | 19 +-
.../common/service/MetadataDbService.java | 21 +-
.../common/service/MetadataService.java | 9 +-
.../server/LinkisMetadataManagerApplication.java | 4 +-
.../server/loader/MetaClassLoaderManager.java | 228 ++--
.../server/restful/MetadataCoreRestful.java | 239 ++--
.../server/service/MetadataAppService.java | 32 +-
.../service/impl/MetadataAppServiceImpl.java | 164 ++-
.../server/utils/MetadataUtils.java | 121 +-
.../metadatamanager/service/ElasticConnection.java | 85 +-
.../service/ElasticParamsMapper.java | 10 +-
.../metadatamanager/service/EsMetaService.java | 73 +-
.../metadatamanager/service/HiveConnection.java | 106 +-
.../metadatamanager/service/HiveMetaService.java | 162 ++-
.../metadatamanager/service/HiveParamsMapper.java | 6 +-
.../metadatamanager/service/KafkaConnection.java | 4 +-
.../metadatamanager/service/KafkaMetaService.java | 83 +-
.../metadatamanager/service/MysqlMetaService.java | 50 +-
.../metadatamanager/service/SqlConnection.java | 91 +-
.../metadatamanager/service/SqlParamsMapper.java | 6 +-
.../metadata/LinkisDataSourceApplication.java | 7 +-
.../org/apache/linkis/metadata/dao/MdqDao.java | 19 +-
.../linkis/metadata/domain/AbstractAuditable.java | 6 +-
.../org/apache/linkis/metadata/domain/Column.java | 8 +-
.../metadata/domain/mdq/DomainCoversionUtils.java | 84 +-
.../apache/linkis/metadata/domain/mdq/Tunple.java | 8 +-
.../metadata/domain/mdq/bo/ApplicationBO.java | 7 +-
.../linkis/metadata/domain/mdq/bo/BaseBO.java | 7 +-
.../linkis/metadata/domain/mdq/bo/MdqTableBO.java | 7 +-
.../metadata/domain/mdq/bo/MdqTableBaseInfoBO.java | 7 +-
.../domain/mdq/bo/MdqTableFieldsInfoBO.java | 7 +-
.../domain/mdq/bo/MdqTableImportInfoBO.java | 9 +-
.../linkis/metadata/domain/mdq/bo/ModelBO.java | 7 +-
.../linkis/metadata/domain/mdq/po/MdqAccess.java | 7 +-
.../linkis/metadata/domain/mdq/po/MdqField.java | 7 +-
.../linkis/metadata/domain/mdq/po/MdqImport.java | 7 +-
.../linkis/metadata/domain/mdq/po/MdqLineage.java | 7 +-
.../linkis/metadata/domain/mdq/po/MdqTable.java | 70 +-
.../metadata/domain/mdq/po/MdqTableInfo.java | 7 +-
.../metadata/domain/mdq/vo/ApplicationVO.java | 7 +-
.../linkis/metadata/domain/mdq/vo/BaseVO.java | 7 +-
.../metadata/domain/mdq/vo/MdqImportInfoVO.java | 31 +-
.../metadata/domain/mdq/vo/MdqTableBaseInfoVO.java | 9 +-
.../domain/mdq/vo/MdqTableFieldsInfoVO.java | 8 +-
.../mdq/vo/MdqTablePartitionStatisticInfoVO.java | 11 +-
.../domain/mdq/vo/MdqTableStatisticInfoVO.java | 9 +-
.../linkis/metadata/domain/mdq/vo/MdqTableVO.java | 7 +-
.../linkis/metadata/domain/mdq/vo/ModelVO.java | 7 +-
.../apache/linkis/metadata/hive/config/DSEnum.java | 7 +-
.../linkis/metadata/hive/config/DataSource.java | 7 +-
.../hive/config/DataSourceContextHolder.java | 7 +-
.../metadata/hive/config/DynamicDataSource.java | 7 +-
.../metadata/hive/config/LinkisMybatisConfig.java | 43 +-
.../metadata/hive/config/MultiSourceExAop.java | 21 +-
.../linkis/metadata/hive/dao/HiveMetaDao.java | 8 +-
.../metadata/restful/api/DataSourceRestfulApi.java | 54 +-
.../metadata/restful/api/MdqTableRestfulApi.java | 115 +-
.../restful/remote/DataSourceRestfulRemote.java | 26 +-
.../linkis/metadata/service/DataSourceService.java | 11 +-
.../service/HiveMetaWithPermissionService.java | 1 -
.../apache/linkis/metadata/service/MdqService.java | 30 +-
.../service/impl/DataSourceServiceImpl.java | 43 +-
.../impl/HiveMetaWithPermissionServiceImpl.java | 21 +-
.../metadata/service/impl/MdqServiceImpl.java | 191 +--
.../org/apache/linkis/metadata/type/Lifecycle.java | 13 +-
.../apache/linkis/metadata/type/MdqImportType.java | 11 +-
.../apache/linkis/metadata/type/ModelLevel.java | 15 +-
.../apache/linkis/metadata/type/UseWayType.java | 10 +-
.../org/apache/linkis/metadata/util/Constants.java | 8 +-
.../org/apache/linkis/metadata/util/DWSConfig.java | 109 +-
.../org/apache/linkis/metadata/util/HiveUtils.java | 11 +-
.../linkis/configuration/dao/ConfigMapper.java | 15 +-
.../linkis/configuration/dao/LabelMapper.java | 12 +-
.../linkis/configuration/entity/CategoryLabel.java | 7 +-
.../configuration/entity/CategoryLabelVo.java | 6 +-
.../linkis/configuration/entity/ConfigKey.java | 7 +-
.../configuration/entity/ConfigKeyValue.java | 9 +-
.../linkis/configuration/entity/ConfigLabel.java | 10 +-
.../linkis/configuration/entity/ConfigTree.java | 6 +-
.../linkis/configuration/entity/ConfigValue.java | 8 +-
.../exception/ConfigurationException.java | 8 +-
.../restful/api/ConfigurationRestfulApi.java | 258 ++--
.../util/ConfigurationConfiguration.java | 13 +-
.../configuration/util/LabelEntityParser.java | 40 +-
.../errorcode/client/ClientConfiguration.java | 33 +-
.../errorcode/client/ErrorCodeClientBuilder.java | 36 +-
.../errorcode/client/LinkisErrorCodeClient.java | 37 +-
.../errorcode/client/handler/ErrorCodeHandler.java | 7 +-
.../client/handler/ExceptionErrorCodeHandler.java | 9 +-
.../client/handler/LinkisErrorCodeFactory.java | 14 +-
.../client/handler/LinkisErrorCodeHandler.java | 185 +--
.../client/handler/LogErrorCodeHandler.java | 11 +-
.../client/handler/LogFileErrorCodeHandler.java | 17 +-
.../client/manager/LinkisErrorCodeManager.java | 29 +-
.../synchronizer/LinkisErrorCodeSynchronizer.java | 71 +-
.../apache/linkis/errorcode/client/utils/Test.java | 15 +-
.../apache/linkis/errorcode/common/CommonConf.java | 7 +-
.../linkis/errorcode/server/ErrorCodeServer.java | 10 +-
.../errorcode/server/dao/ErrorCodeMapper.java | 18 +-
.../server/restful/LinkisErrorCodeRestful.java | 16 +-
.../server/service/LinkisErrorCodeService.java | 8 +-
.../service/impl/LinkisErrorCodeServiceImpl.java | 18 +-
.../instance/label/InsLabelAutoConfiguration.java | 50 +-
.../instance/label/async/AsyncConsumerQueue.java | 12 +-
.../label/async/GenericAsyncConsumerQueue.java | 107 +-
.../label/cache/InsLabelCacheConfiguration.java | 39 +-
.../linkis/instance/label/conf/InsLabelConf.java | 50 +-
.../instance/label/dao/InsLabelRelationDao.java | 32 +-
.../linkis/instance/label/dao/InstanceInfoDao.java | 8 +-
.../instance/label/dao/InstanceLabelDao.java | 28 +-
.../instance/label/entity/InsPersistenceLabel.java | 22 +-
.../label/entity/InsPersistenceLabelValue.java | 13 +-
.../linkis/instance/label/entity/InstanceInfo.java | 23 +-
.../instance/label/restful/InstanceRestful.java | 71 +-
.../label/service/InsLabelAccessService.java | 19 +-
.../instance/label/service/InsLabelService.java | 35 +-
.../label/service/InsLabelServiceAdapter.java | 8 +-
.../label/service/annotation/AdapterMode.java | 7 +-
.../label/service/impl/DefaultInsLabelService.java | 355 +++---
.../impl/DefaultInsLabelServiceAdapter.java | 174 ++-
.../label/service/impl/EurekaInsLabelService.java | 46 +-
.../linkis/instance/label/utils/EntityParser.java | 27 +-
.../label/vo/InsPersistenceLabelSearchVo.java | 12 +-
.../linkis/instance/label/vo/InstanceInfoVo.java | 8 +-
.../linkis/jobhistory/LinkisPublicServiceApp.java | 6 +-
.../linkis/jobhistory/cache/QueryCacheManager.java | 6 +-
.../linkis/jobhistory/cache/QueryCacheService.java | 8 +-
.../linkis/jobhistory/cache/domain/TaskResult.java | 13 +-
.../cache/impl/DefaultQueryCacheManager.java | 65 +-
.../cache/impl/QueryCacheServiceImpl.java | 110 +-
.../jobhistory/cache/impl/ScheduledCleanJob.java | 20 +-
.../jobhistory/cache/impl/ScheduledRefreshJob.java | 20 +-
.../jobhistory/cache/impl/UserTaskResultCache.java | 26 +-
.../linkis/jobhistory/cache/utils/MD5Util.java | 22 +-
.../linkis/jobhistory/dao/JobDetailMapper.java | 29 +-
.../linkis/jobhistory/dao/JobHistoryMapper.java | 26 +-
.../apache/linkis/jobhistory/entity/JobDetail.java | 63 +-
.../linkis/jobhistory/entity/JobHistory.java | 13 +-
.../apache/linkis/jobhistory/entity/QueryTask.java | 7 +-
.../linkis/jobhistory/entity/QueryTaskVO.java | 11 +-
.../jobhistory/restful/api/QueryRestfulApi.java | 88 +-
.../linkis/jobhistory/transitional/TaskStatus.java | 25 +-
.../apache/linkis/jobhistory/util/Constants.java | 7 +-
.../filesystem/conf/WorkSpaceConfiguration.java | 52 +-
.../filesystem/constant/WorkSpaceConstants.java | 9 +-
.../linkis/filesystem/entity/DirFileTree.java | 8 +-
.../apache/linkis/filesystem/entity/LogLevel.java | 11 +-
.../filesystem/exception/WorkSpaceException.java | 6 +-
.../exception/WorkspaceExceptionManager.java | 89 +-
.../filesystem/restful/api/BMLFsRestfulApi.java | 96 +-
.../filesystem/restful/api/FsRestfulApi.java | 318 +++--
.../linkis/filesystem/util/WorkspaceUtil.java | 46 +-
.../java/org/apache/linkis/udf/entity/UDFInfo.java | 28 +-
.../org/apache/linkis/udf/entity/UDFManager.java | 8 +-
.../java/org/apache/linkis/udf/entity/UDFTree.java | 22 +-
.../apache/linkis/udf/excepiton/UDFException.java | 14 +-
.../org/apache/linkis/udf/utils/ConstantVar.java | 34 +-
.../java/org/apache/linkis/udf/api/UDFApi.java | 280 +++--
.../java/org/apache/linkis/udf/dao/UDFDao.java | 35 +-
.../java/org/apache/linkis/udf/dao/UDFTreeDao.java | 9 +-
.../org/apache/linkis/udf/service/UDFService.java | 27 +-
.../apache/linkis/udf/service/UDFTreeService.java | 9 +-
.../linkis/udf/service/impl/UDFServiceImpl.java | 250 ++--
.../udf/service/impl/UDFTreeServiceImpl.java | 115 +-
.../java/org/apache/linkis/udf/TestUDFTree.java | 18 +-
.../org/apache/linkis/variable/dao/VarMapper.java | 19 +-
.../org/apache/linkis/variable/entity/VarKey.java | 7 +-
.../linkis/variable/entity/VarKeyAndValue.java | 7 +-
.../apache/linkis/variable/entity/VarKeyUser.java | 8 +-
.../linkis/variable/entity/VarKeyValueVO.java | 25 +-
.../org/apache/linkis/variable/entity/VarTree.java | 7 +-
.../variable/exception/VariableException.java | 8 +-
.../variable/restful/api/VariableRestfulApi.java | 28 +-
.../linkis/variable/service/VariableService.java | 9 +-
.../org/apache/linkis/variable/util/Constants.java | 6 +-
.../eureka/SpringCloudEurekaApplication.java | 7 +-
.../linkis/eureka/conf/EurekaSecurityConfig.java | 14 +-
.../dws/annotation/DWSHttpMessageResult.java | 12 +-
.../springcloud/LinkisGatewayApplication.java | 10 +-
.../http/GatewayAuthorizationFilter.java | 230 ++--
.../springcloud/http/SpringCloudHttpUtils.java | 39 +-
.../SpringCloudGatewayWebsocketFilter.java | 334 ++++--
.../websocket/WebSocketServiceConfiguration.java | 11 +-
pom.xml | 30 +
1380 files changed, 29051 insertions(+), 23324 deletions(-)
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/ErrorCodeUtils.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/ErrorCodeUtils.java
index 83e86c2..ce81278 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/ErrorCodeUtils.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/ErrorCodeUtils.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.errorcode;
import org.slf4j.Logger;
@@ -22,7 +22,6 @@ import org.slf4j.LoggerFactory;
import static org.apache.linkis.common.errorcode.LinkisFrameErrorCodeSummary.VALIDATE_ERROR_CODE_FAILED;
-
public class ErrorCodeUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(ErrorCodeUtils.class);
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisCommonsErrorCodeSummary.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisCommonsErrorCodeSummary.java
index 6b635bf..c15173e 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisCommonsErrorCodeSummary.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisCommonsErrorCodeSummary.java
@@ -5,39 +5,28 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.errorcode;
+package org.apache.linkis.common.errorcode;
public enum LinkisCommonsErrorCodeSummary {
+ ENGINE_FAILED_STARTED(11000, "引擎启动失败", "引擎启动失败", "hiveEngineConn");
- ENGINE_FAILED_STARTED(11000, "引擎启动失败", "引擎启动失败", "hiveEngineConn")
-
- ;
- /**
- * 错误码
- */
+ /** 错误码 */
private int errorCode;
- /**
- * 错误描述
- */
+ /** 错误描述 */
private String errorDesc;
- /**
- * 错误可能出现的原因
- */
+ /** 错误可能出现的原因 */
private String comment;
- /**
- * 所属的linkis的模块
- */
+ /** 所属的linkis的模块 */
private String module;
LinkisCommonsErrorCodeSummary(int errorCode, String errorDesc, String comment, String module) {
@@ -71,7 +60,6 @@ public enum LinkisCommonsErrorCodeSummary {
this.comment = comment;
}
-
public String getModule() {
return module;
}
@@ -80,7 +68,6 @@ public enum LinkisCommonsErrorCodeSummary {
this.module = module;
}
-
@Override
public String toString() {
return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisComputationGovernanceErrorCodeSummary.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisComputationGovernanceErrorCodeSummary.java
index 17e9dfe..b23e567 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisComputationGovernanceErrorCodeSummary.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisComputationGovernanceErrorCodeSummary.java
@@ -5,53 +5,38 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.errorcode;
+package org.apache.linkis.common.errorcode;
public enum LinkisComputationGovernanceErrorCodeSummary {
-
- ENGINE_LAUNCH_REQUEST_USER_BLANK(20000,
- "请求引擎的参数中user为空",
- "请求引擎的参数中user为空",
- "EngineConnManger"),
- ENGINE_LAUNCH_REQUEST_CREATOR_BLANK(20001,
- "请求启动引擎的参数中creator为空",
- "请求启动引擎的参数中creator为空",
- "EngineConnManager"),
+ ENGINE_LAUNCH_REQUEST_USER_BLANK(20000, "请求引擎的参数中user为空", "请求引擎的参数中user为空", "EngineConnManger"),
+ ENGINE_LAUNCH_REQUEST_CREATOR_BLANK(
+ 20001, "请求启动引擎的参数中creator为空", "请求启动引擎的参数中creator为空", "EngineConnManager"),
ENGINE_INIT_FAILED(20002, "引擎初始化失败", "引擎初始化失败", "EngineConnManager"),
ENGINE_REQUEST_USER_BLANK(20000, "请求引擎的参数中user为空", "请求引擎的参数中user为空", "EngineConnManger"),
-
AM_EM_NOT_FOUND(20100, "请求引擎的参数中user为空", "请求引擎的参数中user为空", "EngineConnManger");
- /**
- * 错误码
- */
+ /** 错误码 */
private int errorCode;
- /**
- * 错误描述
- */
+ /** 错误描述 */
private String errorDesc;
- /**
- * 错误可能出现的原因
- */
+ /** 错误可能出现的原因 */
private String comment;
- /**
- * 所属的linkis的模块
- */
+ /** 所属的linkis的模块 */
private String module;
- LinkisComputationGovernanceErrorCodeSummary(int errorCode, String errorDesc, String comment, String module) {
+ LinkisComputationGovernanceErrorCodeSummary(
+ int errorCode, String errorDesc, String comment, String module) {
ErrorCodeUtils.validateErrorCode(errorCode, 20000, 24999);
this.errorCode = errorCode;
this.errorDesc = errorDesc;
@@ -83,7 +68,6 @@ public enum LinkisComputationGovernanceErrorCodeSummary {
this.comment = comment;
}
-
public String getModule() {
return module;
}
@@ -92,7 +76,6 @@ public enum LinkisComputationGovernanceErrorCodeSummary {
this.module = module;
}
-
@Override
public String toString() {
return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisEngineConnErrorCodeSummary.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisEngineConnErrorCodeSummary.java
index 8f0e5d6..4fba224 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisEngineConnErrorCodeSummary.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisEngineConnErrorCodeSummary.java
@@ -5,41 +5,31 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.errorcode;
+package org.apache.linkis.common.errorcode;
public enum LinkisEngineConnErrorCodeSummary {
-
-
;
- /**
- * 错误码
- */
+ /** 错误码 */
private int errorCode;
- /**
- * 错误描述
- */
+ /** 错误描述 */
private String errorDesc;
- /**
- * 错误可能出现的原因
- */
+ /** 错误可能出现的原因 */
private String comment;
- /**
- * 所属的linkis的模块
- */
+ /** 所属的linkis的模块 */
private String module;
- LinkisEngineConnErrorCodeSummary(int errorCode, String errorDesc, String comment, String module) {
+ LinkisEngineConnErrorCodeSummary(
+ int errorCode, String errorDesc, String comment, String module) {
ErrorCodeUtils.validateErrorCode(errorCode, 26000, 29999);
this.errorCode = errorCode;
this.errorDesc = errorDesc;
@@ -71,7 +61,6 @@ public enum LinkisEngineConnErrorCodeSummary {
this.comment = comment;
}
-
public String getModule() {
return module;
}
@@ -80,7 +69,6 @@ public enum LinkisEngineConnErrorCodeSummary {
this.module = module;
}
-
@Override
public String toString() {
return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisErrorCodeSummary.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisErrorCodeSummary.java
index 32b42b92..527b482 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisErrorCodeSummary.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisErrorCodeSummary.java
@@ -5,56 +5,40 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.errorcode;
+package org.apache.linkis.common.errorcode;
public enum LinkisErrorCodeSummary {
/**
- * 10000-10999 linkis-frame
- * 11000-12999 linkis-commons
- * 13000-14999 linkis-spring-cloud-services
- * 15000-19999 linkis-public-enhancements
- * 20000-24999 linkis-computation-governance
- * 25000-25999 linkis-extensions
- * 26000-29999 linkis-engineconn-plugins
- */
- EngineManagerErrorException
- (321, "引擎启动失败", "在某种情况下启动失败", "hadoop", "EngineConnManager")
- ;
- /**
- * 错误码
+ * 10000-10999 linkis-frame 11000-12999 linkis-commons 13000-14999 linkis-spring-cloud-services
+ * 15000-19999 linkis-public-enhancements 20000-24999 linkis-computation-governance 25000-25999
+ * linkis-extensions 26000-29999 linkis-engineconn-plugins
*/
+ EngineManagerErrorException(321, "引擎启动失败", "在某种情况下启动失败", "hadoop", "EngineConnManager");
+ /** 错误码 */
private int errorCode;
- /**
- * 错误描述
- */
+ /** 错误描述 */
private String errorDesc;
- /**
- * 评论
- */
+ /** 评论 */
private String comment;
- /**
- * errorCode的创建人
- */
+ /** errorCode的创建人 */
private String creator;
- /**
- * 所属的linkis的模块
- */
+ /** 所属的linkis的模块 */
private String module;
- LinkisErrorCodeSummary(int errorCode, String errorDesc, String comment, String creator, String module) {
+ LinkisErrorCodeSummary(
+ int errorCode, String errorDesc, String comment, String creator, String module) {
this.errorCode = errorCode;
this.errorDesc = errorDesc;
this.comment = comment;
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisExtensionErrorCodeSummary.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisExtensionErrorCodeSummary.java
index 78ea299..baeae16 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisExtensionErrorCodeSummary.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisExtensionErrorCodeSummary.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.errorcode;
+package org.apache.linkis.common.errorcode;
public enum LinkisExtensionErrorCodeSummary {
;
@@ -28,7 +27,8 @@ public enum LinkisExtensionErrorCodeSummary {
private String module;
- LinkisExtensionErrorCodeSummary(int errorCode, String errorDesc, String comment, String module) {
+ LinkisExtensionErrorCodeSummary(
+ int errorCode, String errorDesc, String comment, String module) {
ErrorCodeUtils.validateErrorCode(errorCode, 26000, 26999);
this.errorCode = errorCode;
this.errorDesc = errorDesc;
@@ -60,7 +60,6 @@ public enum LinkisExtensionErrorCodeSummary {
this.comment = comment;
}
-
public String getModule() {
return module;
}
@@ -69,7 +68,6 @@ public enum LinkisExtensionErrorCodeSummary {
this.module = module;
}
-
@Override
public String toString() {
return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisFrameErrorCodeSummary.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisFrameErrorCodeSummary.java
index dea1046..6404a4a 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisFrameErrorCodeSummary.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisFrameErrorCodeSummary.java
@@ -5,25 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.errorcode;
+package org.apache.linkis.common.errorcode;
public enum LinkisFrameErrorCodeSummary {
-
- VALIDATE_ERROR_CODE_FAILED
- (10000, "错误码定义有误", "错误码定义超过最大值或者小于最小值", "linkis-frame")
-
- ;
+ VALIDATE_ERROR_CODE_FAILED(10000, "错误码定义有误", "错误码定义超过最大值或者小于最小值", "linkis-frame");
private int errorCode;
@@ -65,7 +60,6 @@ public enum LinkisFrameErrorCodeSummary {
this.comment = comment;
}
-
public String getModule() {
return module;
}
@@ -74,7 +68,6 @@ public enum LinkisFrameErrorCodeSummary {
this.module = module;
}
-
@Override
public String toString() {
return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisPublicEnhancementErrorCodeSummary.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisPublicEnhancementErrorCodeSummary.java
index 6bfac6a..9b7f09f 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisPublicEnhancementErrorCodeSummary.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisPublicEnhancementErrorCodeSummary.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.errorcode;
+package org.apache.linkis.common.errorcode;
public enum LinkisPublicEnhancementErrorCodeSummary {
;
@@ -25,7 +24,8 @@ public enum LinkisPublicEnhancementErrorCodeSummary {
private String comment;
private String module;
- LinkisPublicEnhancementErrorCodeSummary(int errorCode, String errorDesc, String comment, String module) {
+ LinkisPublicEnhancementErrorCodeSummary(
+ int errorCode, String errorDesc, String comment, String module) {
ErrorCodeUtils.validateErrorCode(errorCode, 15000, 19999);
this.errorCode = errorCode;
this.errorDesc = errorDesc;
@@ -57,7 +57,6 @@ public enum LinkisPublicEnhancementErrorCodeSummary {
this.comment = comment;
}
-
public String getModule() {
return module;
}
@@ -66,7 +65,6 @@ public enum LinkisPublicEnhancementErrorCodeSummary {
this.module = module;
}
-
@Override
public String toString() {
return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisSpringCloudServiceErrorCodeSummary.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisSpringCloudServiceErrorCodeSummary.java
index 1f2aa30..a7546d2 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisSpringCloudServiceErrorCodeSummary.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/errorcode/LinkisSpringCloudServiceErrorCodeSummary.java
@@ -5,28 +5,27 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.errorcode;
+package org.apache.linkis.common.errorcode;
-public class LinkisSpringCloudServiceErrorCodeSummary {
- ;
+public class LinkisSpringCloudServiceErrorCodeSummary {;
private int errorCode;
private String errorDesc;
private String comment;
private String module;
- LinkisSpringCloudServiceErrorCodeSummary(int errorCode, String errorDesc, String comment, String module) {
+ LinkisSpringCloudServiceErrorCodeSummary(
+ int errorCode, String errorDesc, String comment, String module) {
ErrorCodeUtils.validateErrorCode(errorCode, 13000, 14999);
this.errorCode = errorCode;
this.errorDesc = errorDesc;
@@ -58,7 +57,6 @@ public class LinkisSpringCloudServiceErrorCodeSummary {
this.comment = comment;
}
-
public String getModule() {
return module;
}
@@ -67,7 +65,6 @@ public class LinkisSpringCloudServiceErrorCodeSummary {
this.module = module;
}
-
@Override
public String toString() {
return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ErrorException.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ErrorException.java
index 4c0c6ed..e4a8a79 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ErrorException.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ErrorException.java
@@ -5,29 +5,31 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.exception;
public class ErrorException extends LinkisException {
private ExceptionLevel level = ExceptionLevel.ERROR;
- public ErrorException(int errCode, String desc){
+
+ public ErrorException(int errCode, String desc) {
super(errCode, desc);
}
- public ErrorException(int errCode, String desc, String ip, int port, String serviceKind){
+
+ public ErrorException(int errCode, String desc, String ip, int port, String serviceKind) {
super(errCode, desc, ip, port, serviceKind);
}
@Override
- public ExceptionLevel getLevel(){
+ public ExceptionLevel getLevel() {
return this.level;
}
}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ExceptionLevel.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ExceptionLevel.java
index 3bd4b9d..213c485 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ExceptionLevel.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ExceptionLevel.java
@@ -5,31 +5,28 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.exception;
public enum ExceptionLevel {
- /**
- * warn 1
- * error 2
- * fatal 3
- */
+ /** warn 1 error 2 fatal 3 */
WARN(1, "warn"),
ERROR(2, "error"),
FATAL(3, "fatal"),
RETRY(4, "retry");
private int level;
private String name;
- private ExceptionLevel(int level, String name){
+
+ private ExceptionLevel(int level, String name) {
this.name = name;
this.level = level;
}
@@ -52,9 +49,6 @@ public enum ExceptionLevel {
@Override
public String toString() {
- return "ExceptionLevel{" +
- "level=" + level +
- ", name='" + name + '\'' +
- '}';
+ return "ExceptionLevel{" + "level=" + level + ", name='" + name + '\'' + '}';
}
}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ExceptionManager.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ExceptionManager.java
index fad561f..7c994e8 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ExceptionManager.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/ExceptionManager.java
@@ -5,19 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.exception;
import org.apache.linkis.common.errorcode.CommonErrorConstants;
+
import java.util.HashMap;
import java.util.Map;
@@ -31,28 +32,35 @@ public final class ExceptionManager {
private static final String PORT = "port";
private static final String SERVICEKIND = "serviceKind";
- public static Exception generateException(Map<String, Object> map){
+ public static Exception generateException(Map<String, Object> map) {
Exception retException = null;
- if (null == map || map.get(LEVEL) == null){
- return new ErrorException(CommonErrorConstants.COMMON_ERROR(), "The map cannot be parsed normally, "
- + "the map is empty or the LEVEL value is missing:(map不能被正常的解析,map为空或者缺少LEVEL值: )" + map);
+ if (null == map || map.get(LEVEL) == null) {
+ return new ErrorException(
+ CommonErrorConstants.COMMON_ERROR(),
+ "The map cannot be parsed normally, "
+ + "the map is empty or the LEVEL value is missing:(map不能被正常的解析,map为空或者缺少LEVEL值: )"
+ + map);
}
int level = Integer.parseInt(map.get(LEVEL).toString());
int errCode = Integer.parseInt(map.get(ERRCODE).toString());
- String desc = (String)map.get(DESC);
- String ip = (String)map.get(IP);
+ String desc = (String) map.get(DESC);
+ String ip = (String) map.get(IP);
int port = Integer.parseInt(map.get(PORT).toString());
- String serviceKind = (String)map.get(SERVICEKIND);
- if(WARN.getLevel() == level) {
+ String serviceKind = (String) map.get(SERVICEKIND);
+ if (WARN.getLevel() == level) {
retException = new WarnException(errCode, desc, ip, port, serviceKind);
- } else if(ERROR.getLevel() == level) {
+ } else if (ERROR.getLevel() == level) {
retException = new ErrorException(errCode, desc, ip, port, serviceKind);
- } else if(FATAL.getLevel() == level) {
+ } else if (FATAL.getLevel() == level) {
retException = new FatalException(errCode, desc, ip, port, serviceKind);
- } else if(RETRY.getLevel() == level) {
+ } else if (RETRY.getLevel() == level) {
retException = new LinkisRetryException(errCode, desc, ip, port, serviceKind);
}
- return retException != null ? retException : new ErrorException(CommonErrorConstants.COMMON_ERROR(), "Exception Map that cannot be parsed:(不能解析的异常Map:)" + map);
+ return retException != null
+ ? retException
+ : new ErrorException(
+ CommonErrorConstants.COMMON_ERROR(),
+ "Exception Map that cannot be parsed:(不能解析的异常Map:)" + map);
}
public static Map<String, Object> unknownException(String errorMsg) {
@@ -65,4 +73,4 @@ public final class ExceptionManager {
retMap.put("serviceKind", LinkisException.applicationName);
return retMap;
}
-}
\ No newline at end of file
+}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/FatalException.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/FatalException.java
index e2c12c9..f79e2db 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/FatalException.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/FatalException.java
@@ -5,29 +5,31 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.exception;
public class FatalException extends LinkisException {
private ExceptionLevel level = ExceptionLevel.FATAL;
- public FatalException(int errCode, String desc){
+
+ public FatalException(int errCode, String desc) {
super(errCode, desc);
}
- public FatalException(int errCode, String desc, String ip, int port, String serviceKind){
+
+ public FatalException(int errCode, String desc, String ip, int port, String serviceKind) {
super(errCode, desc, ip, port, serviceKind);
}
@Override
- public ExceptionLevel getLevel(){
+ public ExceptionLevel getLevel() {
return this.level;
}
}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisCommonErrorException.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisCommonErrorException.java
index ba229a3..e8f385a 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisCommonErrorException.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisCommonErrorException.java
@@ -5,25 +5,25 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.exception;
+package org.apache.linkis.common.exception;
-public class LinkisCommonErrorException extends ErrorException{
+public class LinkisCommonErrorException extends ErrorException {
public LinkisCommonErrorException(int errCode, String desc) {
super(errCode, desc);
}
- public LinkisCommonErrorException(int errCode, String desc, String ip, int port, String serviceKind) {
+ public LinkisCommonErrorException(
+ int errCode, String desc, String ip, int port, String serviceKind) {
super(errCode, desc, ip, port, serviceKind);
}
}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisException.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisException.java
index eda5113..002ce1d 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisException.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisException.java
@@ -5,34 +5,43 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.exception;
import java.util.HashMap;
import java.util.Map;
-public abstract class LinkisException extends Exception{
+public abstract class LinkisException extends Exception {
static String applicationName;
static String hostname;
static int hostPort;
- public LinkisException(int errCode, String desc){
+ public LinkisException(int errCode, String desc) {
this(errCode, desc, hostname, hostPort, applicationName);
}
- public LinkisException(int errCode, String desc, String ip, int port, String serviceKind){
- super("errCode: " + errCode + " ,desc: " + desc + " ,ip: " + ip +
- " ,port: " + port + " ,serviceKind: " + serviceKind);
+ public LinkisException(int errCode, String desc, String ip, int port, String serviceKind) {
+ super(
+ "errCode: "
+ + errCode
+ + " ,desc: "
+ + desc
+ + " ,ip: "
+ + ip
+ + " ,port: "
+ + port
+ + " ,serviceKind: "
+ + serviceKind);
this.errCode = errCode;
this.desc = desc;
this.ip = ip;
@@ -45,13 +54,12 @@ public abstract class LinkisException extends Exception{
}
/**
- * Errcode error code(errcode 错误码)
- * Desc error description(desc 错误描述)
- * Ip abnormal server ip(ip 发生异常的服务器ip)
- * Port An abnormal process port(port 发生异常的进程端口)
- * serviceKind microservice type with exception(serviceKind 发生异常的微服务类型)
+ * Errcode error code(errcode 错误码) Desc error description(desc 错误描述) Ip abnormal server ip(ip
+ * 发生异常的服务器ip) Port An abnormal process port(port 发生异常的进程端口) serviceKind microservice type with
+ * exception(serviceKind 发生异常的微服务类型)
*/
private int errCode;
+
private String desc;
private String ip;
private int port;
@@ -105,7 +113,7 @@ public abstract class LinkisException extends Exception{
this.serviceKind = serviceKind;
}
- public Map<String, Object> toMap(){
+ public Map<String, Object> toMap() {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("level", getLevel().getLevel());
retMap.put("errCode", getErrCode());
@@ -116,18 +124,24 @@ public abstract class LinkisException extends Exception{
return retMap;
}
-
-
abstract ExceptionLevel getLevel();
@Override
public String toString() {
- return "LinkisException{" +
- "errCode=" + errCode +
- ", desc='" + desc + '\'' +
- ", ip='" + ip + '\'' +
- ", port=" + port +
- ", serviceKind='" + serviceKind + '\'' +
- '}';
+ return "LinkisException{"
+ + "errCode="
+ + errCode
+ + ", desc='"
+ + desc
+ + '\''
+ + ", ip='"
+ + ip
+ + '\''
+ + ", port="
+ + port
+ + ", serviceKind='"
+ + serviceKind
+ + '\''
+ + '}';
}
}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisRetryException.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisRetryException.java
index 563f190..09d0858 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisRetryException.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisRetryException.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.common.exception;
+package org.apache.linkis.common.exception;
public class LinkisRetryException extends LinkisException {
LinkisRetryException(int errCode, String desc, String ip, int port, String serviceKind) {
@@ -31,4 +30,4 @@ public class LinkisRetryException extends LinkisException {
ExceptionLevel getLevel() {
return ExceptionLevel.RETRY;
}
-}
\ No newline at end of file
+}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisRuntimeException.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisRuntimeException.java
index 9057b44..5f922c7 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisRuntimeException.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/LinkisRuntimeException.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.exception;
import java.util.HashMap;
@@ -22,7 +22,7 @@ import java.util.Map;
import static org.apache.linkis.common.exception.LinkisException.*;
-public abstract class LinkisRuntimeException extends RuntimeException{
+public abstract class LinkisRuntimeException extends RuntimeException {
private int errCode;
private String desc;
@@ -30,12 +30,23 @@ public abstract class LinkisRuntimeException extends RuntimeException{
private int port;
private String serviceKind;
- public LinkisRuntimeException(int errCode, String desc){
+ public LinkisRuntimeException(int errCode, String desc) {
this(errCode, desc, hostname, hostPort, applicationName);
}
- public LinkisRuntimeException(int errCode, String desc, String ip, int port, String serviceKind){
- super("errCode: " + errCode + " ,desc: " + desc + " ,ip: " + ip +
- " ,port: " + port + " ,serviceKind: " + serviceKind);
+
+ public LinkisRuntimeException(
+ int errCode, String desc, String ip, int port, String serviceKind) {
+ super(
+ "errCode: "
+ + errCode
+ + " ,desc: "
+ + desc
+ + " ,ip: "
+ + ip
+ + " ,port: "
+ + port
+ + " ,serviceKind: "
+ + serviceKind);
this.errCode = errCode;
this.desc = desc;
this.ip = ip;
@@ -83,7 +94,7 @@ public abstract class LinkisRuntimeException extends RuntimeException{
this.serviceKind = serviceKind;
}
- public Map<String, Object> toMap(){
+ public Map<String, Object> toMap() {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("errCode", getErrCode());
retMap.put("desc", getDesc());
@@ -98,12 +109,20 @@ public abstract class LinkisRuntimeException extends RuntimeException{
@Override
public String toString() {
- return "LinkisException{" +
- "errCode=" + errCode +
- ", desc='" + desc + '\'' +
- ", ip='" + ip + '\'' +
- ", port=" + port +
- ", serviceKind='" + serviceKind + '\'' +
- '}';
+ return "LinkisException{"
+ + "errCode="
+ + errCode
+ + ", desc='"
+ + desc
+ + '\''
+ + ", ip='"
+ + ip
+ + '\''
+ + ", port="
+ + port
+ + ", serviceKind='"
+ + serviceKind
+ + '\''
+ + '}';
}
}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/WarnException.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/WarnException.java
index 48ea329..0eeff76 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/WarnException.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/exception/WarnException.java
@@ -5,29 +5,31 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.exception;
public class WarnException extends LinkisRuntimeException {
private ExceptionLevel level = ExceptionLevel.WARN;
- public WarnException(int errCode, String desc){
+
+ public WarnException(int errCode, String desc) {
super(errCode, desc);
}
- public WarnException(int errCode, String desc, String ip, int port, String serviceKind){
+
+ public WarnException(int errCode, String desc, String ip, int port, String serviceKind) {
super(errCode, desc, ip, port, serviceKind);
}
@Override
- public ExceptionLevel getLevel(){
+ public ExceptionLevel getLevel() {
return this.level;
}
}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/io/Fs.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/io/Fs.java
index d779375..f1c1bc4 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/io/Fs.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/io/Fs.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.io;
import java.io.Closeable;
@@ -24,7 +24,6 @@ import java.io.OutputStream;
import java.util.List;
import java.util.Map;
-
public interface Fs extends Closeable {
public abstract void init(Map<String, String> properties) throws IOException;
@@ -56,5 +55,4 @@ public interface Fs extends Closeable {
public abstract boolean mkdir(FsPath dest) throws IOException;
public abstract boolean mkdirs(FsPath dest) throws IOException;
-
}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/io/FsPath.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/io/FsPath.java
index e238aaf..48bf8a6 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/io/FsPath.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/io/FsPath.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.io;
import org.apache.commons.lang.StringUtils;
@@ -31,13 +31,10 @@ import java.nio.file.attribute.PosixFilePermissions;
import java.util.Set;
import java.util.regex.Pattern;
-
public class FsPath {
-
public static final String CUR_DIR = ".";
- public static final boolean WINDOWS
- = System.getProperty("os.name").startsWith("Windows");
+ public static final boolean WINDOWS = System.getProperty("os.name").startsWith("Windows");
public static final char SEPARATOR_CHAR = '/';
public static final String SEPARATOR = "/";
private static final Pattern hasDriveLetterSpecifier = Pattern.compile("^/?[a-zA-Z]:");
@@ -69,17 +66,16 @@ public class FsPath {
// parse uri scheme, if any
int colon = pathString.indexOf(':');
int slash = pathString.indexOf('/');
- if ((colon != -1) &&
- ((slash == -1) || (colon < slash))) { // has a scheme
+ if ((colon != -1) && ((slash == -1) || (colon < slash))) { // has a scheme
scheme = pathString.substring(0, colon);
- start = colon+1;
+ start = colon + 1;
}
// parse uri authority, if any
- if (pathString.startsWith("//", start) &&
- (pathString.length()-start > 2)) { // has authority
- int nextSlash = pathString.indexOf('/', start+2);
+ if (pathString.startsWith("//", start)
+ && (pathString.length() - start > 2)) { // has authority
+ int nextSlash = pathString.indexOf('/', start + 2);
int authEnd = nextSlash > 0 ? nextSlash : pathString.length();
- authority = pathString.substring(start+2, authEnd);
+ authority = pathString.substring(start + 2, authEnd);
start = authEnd;
}
@@ -102,23 +98,21 @@ public class FsPath {
initialize(scheme, authority, path, null);
}
- private void checkPathArg( String path ) throws IllegalArgumentException {
+ private void checkPathArg(String path) throws IllegalArgumentException {
// disallow construction of a Path from an empty string
- if ( path == null ) {
- throw new IllegalArgumentException(
- "Can not create a Path from a null string");
+ if (path == null) {
+ throw new IllegalArgumentException("Can not create a Path from a null string");
}
- if( path.length() == 0 ) {
- throw new IllegalArgumentException(
- "Can not create a Path from an empty string");
+ if (path.length() == 0) {
+ throw new IllegalArgumentException("Can not create a Path from an empty string");
}
}
- private void initialize(String scheme, String authority, String path,
- String fragment) {
+ private void initialize(String scheme, String authority, String path, String fragment) {
try {
- this.uri = new URI(scheme, authority, normalizePath(scheme, path), null, fragment)
- .normalize();
+ this.uri =
+ new URI(scheme, authority, normalizePath(scheme, path), null, fragment)
+ .normalize();
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
@@ -130,18 +124,18 @@ public class FsPath {
// Remove backslashes if this looks like a Windows path. Avoid
// the substitution if it looks like a non-local URI.
- if (WINDOWS &&
- (hasWindowsDrive(path) ||
- (scheme == null) ||
- (scheme.isEmpty()) ||
- (scheme.equals("file")))) {
+ if (WINDOWS
+ && (hasWindowsDrive(path)
+ || (scheme == null)
+ || (scheme.isEmpty())
+ || (scheme.equals("file")))) {
path = StringUtils.replace(path, "\\", "/");
}
// trim trailing slash from non-root path (ignoring windows drive)
int minLength = startPositionWithoutWindowsDrive(path) + 1;
if (path.length() > minLength && path.endsWith(SEPARATOR)) {
- path = path.substring(0, path.length()-1);
+ path = path.substring(0, path.length() - 1);
}
return path;
@@ -153,23 +147,20 @@ public class FsPath {
private static int startPositionWithoutWindowsDrive(String path) {
if (hasWindowsDrive(path)) {
- return path.charAt(0) == SEPARATOR_CHAR ? 3 : 2;
+ return path.charAt(0) == SEPARATOR_CHAR ? 3 : 2;
} else {
return 0;
}
}
- /**
- *
- * @return if no storage type pointed, hdfs type will returned
- */
+ /** @return if no storage type pointed, hdfs type will returned */
public String getFsType() {
return getFsType("file");
}
public String getFsType(String defaultType) {
String scheme = uri.getScheme();
- if(StringUtils.isEmpty(scheme)) {
+ if (StringUtils.isEmpty(scheme)) {
return defaultType;
} else {
return scheme;
@@ -192,7 +183,8 @@ public class FsPath {
String path = uri.getPath();
int lastSlash = path.lastIndexOf('/');
int start = startPositionWithoutWindowsDrive(path);
- if ((path.length() == start) || // empty path
+ if ((path.length() == start)
+ || // empty path
(lastSlash == start && path.length() == start + 1)) { // at root
return null;
}
@@ -258,29 +250,32 @@ public class FsPath {
}
public void setPermissions(Set<PosixFilePermission> permissions) throws IOException {
-// this.permissions = FileSystem.permissionFormatted(permissions);
+ // this.permissions = FileSystem.permissionFormatted(permissions);
this.permissions = permissions.toArray(new PosixFilePermission[] {});
this.permissionString = PosixFilePermissions.toString(permissions);
}
public void setPermissionString(String permissionString) throws IOException {
this.permissionString = permissionFormatted(permissionString);
- this.permissions = PosixFilePermissions.fromString(this.permissionString).toArray(new PosixFilePermission[] {});
+ this.permissions =
+ PosixFilePermissions.fromString(this.permissionString)
+ .toArray(new PosixFilePermission[] {});
}
public String getPath() {
- if(WINDOWS && ! "hdfs".equals(getFsType())){
+ if (WINDOWS && !"hdfs".equals(getFsType())) {
return uri.getAuthority() + uri.getPath();
}
return uri.getPath();
}
- public String getSchemaPath(){
- if(WINDOWS && ! "hdfs".equals(getFsType())){
+ public String getSchemaPath() {
+ if (WINDOWS && !"hdfs".equals(getFsType())) {
return getFsType() + "://" + uri.getAuthority() + uri.getPath();
}
return getFsType() + "://" + uri.getPath();
}
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -288,7 +283,7 @@ public class FsPath {
sb.append("{");
sb.append("path=").append(uri.getPath());
sb.append("; isDirectory=").append(isdir);
- if(!isdir){
+ if (!isdir) {
sb.append("; length=").append(length);
}
sb.append("; modification_time=").append(modification_time);
@@ -301,7 +296,7 @@ public class FsPath {
}
public static String permissionFormatted(String permission) throws IOException {
- if(!StringUtils.isNumeric(permission)) {
+ if (!StringUtils.isNumeric(permission)) {
return permission;
}
char[] ps = permission.toCharArray();
@@ -311,15 +306,24 @@ public class FsPath {
public static String permissionFormatted(char i) throws IOException {
int in = Integer.parseInt(String.valueOf(i));
switch (in) {
- case 0: return "---";
- case 1: return "--x";
- case 2: return "-w-";
- case 3: return "-wx";
- case 4: return "r--";
- case 5: return "r-x";
- case 6: return "rw-";
- case 7: return "rwx";
- default: throw new IOException("Incorrent permission number " + in);
+ case 0:
+ return "---";
+ case 1:
+ return "--x";
+ case 2:
+ return "-w-";
+ case 3:
+ return "-wx";
+ case 4:
+ return "r--";
+ case 5:
+ return "r-x";
+ case 6:
+ return "rw-";
+ case 7:
+ return "rwx";
+ default:
+ throw new IOException("Incorrent permission number " + in);
}
}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/ByteTimeUtils.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/ByteTimeUtils.java
index 3eb5c64..79a09e7 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/ByteTimeUtils.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/ByteTimeUtils.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.utils;
import com.google.common.collect.ImmutableMap;
@@ -29,142 +29,147 @@ import java.util.regex.Pattern;
public class ByteTimeUtils {
- /** Returns a hash consistent with Spark's Utils.nonNegativeHash(). */
- public static int nonNegativeHash(Object obj) {
- if (obj == null) { return 0; }
- int hash = obj.hashCode();
- return hash != Integer.MIN_VALUE ? Math.abs(hash) : 0;
- }
-
- /*
- * Delete a file or directory and its contents recursively.
- * Don't follow directories if they are symlinks.
- * Throws an exception if deletion is unsuccessful.
- */
- public static void deleteRecursively(File file) throws IOException {
- if (file == null) { return; }
-
- if (file.isDirectory() && !isSymlink(file)) {
- IOException savedIOException = null;
- for (File child : listFilesSafely(file)) {
- try {
- deleteRecursively(child);
- } catch (IOException e) {
- // In case of multiple exceptions, only last one will be thrown
- savedIOException = e;
+ /** Returns a hash consistent with Spark's Utils.nonNegativeHash(). */
+ public static int nonNegativeHash(Object obj) {
+ if (obj == null) {
+ return 0;
}
- }
- if (savedIOException != null) {
- throw savedIOException;
- }
+ int hash = obj.hashCode();
+ return hash != Integer.MIN_VALUE ? Math.abs(hash) : 0;
}
- boolean deleted = file.delete();
- // Delete can also fail if the file simply did not exist.
- if (!deleted && file.exists()) {
- throw new IOException("Failed to delete: " + file.getAbsolutePath());
+ /*
+ * Delete a file or directory and its contents recursively.
+ * Don't follow directories if they are symlinks.
+ * Throws an exception if deletion is unsuccessful.
+ */
+ public static void deleteRecursively(File file) throws IOException {
+ if (file == null) {
+ return;
+ }
+
+ if (file.isDirectory() && !isSymlink(file)) {
+ IOException savedIOException = null;
+ for (File child : listFilesSafely(file)) {
+ try {
+ deleteRecursively(child);
+ } catch (IOException e) {
+ // In case of multiple exceptions, only last one will be thrown
+ savedIOException = e;
+ }
+ }
+ if (savedIOException != null) {
+ throw savedIOException;
+ }
+ }
+
+ boolean deleted = file.delete();
+ // Delete can also fail if the file simply did not exist.
+ if (!deleted && file.exists()) {
+ throw new IOException("Failed to delete: " + file.getAbsolutePath());
+ }
}
- }
-
- private static File[] listFilesSafely(File file) throws IOException {
- if (file.exists()) {
- File[] files = file.listFiles();
- if (files == null) {
- throw new IOException("Failed to list files for dir: " + file);
- }
- return files;
- } else {
- return new File[0];
+
+ private static File[] listFilesSafely(File file) throws IOException {
+ if (file.exists()) {
+ File[] files = file.listFiles();
+ if (files == null) {
+ throw new IOException("Failed to list files for dir: " + file);
+ }
+ return files;
+ } else {
+ return new File[0];
+ }
+ }
+
+ private static boolean isSymlink(File file) throws IOException {
+ File fileInCanonicalDir = null;
+ if (file.getParent() == null) {
+ fileInCanonicalDir = file;
+ } else {
+ fileInCanonicalDir = new File(file.getParentFile().getCanonicalFile(), file.getName());
+ }
+ return !fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile());
}
- }
-
- private static boolean isSymlink(File file) throws IOException {
- File fileInCanonicalDir = null;
- if (file.getParent() == null) {
- fileInCanonicalDir = file;
- } else {
- fileInCanonicalDir = new File(file.getParentFile().getCanonicalFile(), file.getName());
+
+ private static final ImmutableMap<String, TimeUnit> timeSuffixes =
+ ImmutableMap.<String, TimeUnit>builder()
+ .put("us", TimeUnit.MICROSECONDS)
+ .put("ms", TimeUnit.MILLISECONDS)
+ .put("s", TimeUnit.SECONDS)
+ .put("m", TimeUnit.MINUTES)
+ .put("min", TimeUnit.MINUTES)
+ .put("h", TimeUnit.HOURS)
+ .put("d", TimeUnit.DAYS)
+ .build();
+
+ private static final ImmutableMap<String, ByteUnit> byteSuffixes =
+ ImmutableMap.<String, ByteUnit>builder()
+ .put("b", ByteUnit.BYTE)
+ .put("k", ByteUnit.KiB)
+ .put("kb", ByteUnit.KiB)
+ .put("m", ByteUnit.MiB)
+ .put("mb", ByteUnit.MiB)
+ .put("g", ByteUnit.GiB)
+ .put("gb", ByteUnit.GiB)
+ .put("t", ByteUnit.TiB)
+ .put("tb", ByteUnit.TiB)
+ .put("p", ByteUnit.PiB)
+ .put("pb", ByteUnit.PiB)
+ .build();
+
+ /**
+ * Convert a passed time string (e.g. 50s, 100ms, or 250us) to a time count for internal use. If
+ * no suffix is provided a direct conversion is attempted.
+ */
+ private static long parseTimeString(String str, TimeUnit unit) {
+ String lower = str.toLowerCase().trim();
+
+ try {
+ Matcher m = Pattern.compile("(-?[0-9]+)([a-z]+)?").matcher(lower);
+ if (!m.matches()) {
+ throw new NumberFormatException("Failed to parse time string: " + str);
+ }
+
+ long val = Long.parseLong(m.group(1));
+ String suffix = m.group(2);
+
+ // Check for invalid suffixes
+ if (suffix != null && !timeSuffixes.containsKey(suffix)) {
+ throw new NumberFormatException("Invalid suffix: \"" + suffix + "\"");
+ }
+
+ // If suffix is valid use that, otherwise none was provided and use the default passed
+ return unit.convert(val, suffix != null ? timeSuffixes.get(suffix) : unit);
+ } catch (NumberFormatException e) {
+ String timeError =
+ "Time "
+ + str
+ + " must be specified as seconds (s), "
+ + "milliseconds (ms), microseconds (us), minutes (m or min), hour (h), or day (d). "
+ + "E.g. 50s, 100ms, or 250us.";
+
+ throw new NumberFormatException(timeError + "\n" + e.getMessage());
+ }
}
- return !fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile());
- }
-
- private static final ImmutableMap<String, TimeUnit> timeSuffixes =
- ImmutableMap.<String, TimeUnit>builder()
- .put("us", TimeUnit.MICROSECONDS)
- .put("ms", TimeUnit.MILLISECONDS)
- .put("s", TimeUnit.SECONDS)
- .put("m", TimeUnit.MINUTES)
- .put("min", TimeUnit.MINUTES)
- .put("h", TimeUnit.HOURS)
- .put("d", TimeUnit.DAYS)
- .build();
-
- private static final ImmutableMap<String, ByteUnit> byteSuffixes =
- ImmutableMap.<String, ByteUnit>builder()
- .put("b", ByteUnit.BYTE)
- .put("k", ByteUnit.KiB)
- .put("kb", ByteUnit.KiB)
- .put("m", ByteUnit.MiB)
- .put("mb", ByteUnit.MiB)
- .put("g", ByteUnit.GiB)
- .put("gb", ByteUnit.GiB)
- .put("t", ByteUnit.TiB)
- .put("tb", ByteUnit.TiB)
- .put("p", ByteUnit.PiB)
- .put("pb", ByteUnit.PiB)
- .build();
-
- /**
- * Convert a passed time string (e.g. 50s, 100ms, or 250us) to a time count for
- * internal use. If no suffix is provided a direct conversion is attempted.
- */
- private static long parseTimeString(String str, TimeUnit unit) {
- String lower = str.toLowerCase().trim();
-
- try {
- Matcher m = Pattern.compile("(-?[0-9]+)([a-z]+)?").matcher(lower);
- if (!m.matches()) {
- throw new NumberFormatException("Failed to parse time string: " + str);
- }
-
- long val = Long.parseLong(m.group(1));
- String suffix = m.group(2);
-
- // Check for invalid suffixes
- if (suffix != null && !timeSuffixes.containsKey(suffix)) {
- throw new NumberFormatException("Invalid suffix: \"" + suffix + "\"");
- }
-
- // If suffix is valid use that, otherwise none was provided and use the default passed
- return unit.convert(val, suffix != null ? timeSuffixes.get(suffix) : unit);
- } catch (NumberFormatException e) {
- String timeError = "Time " + str +" must be specified as seconds (s), " +
- "milliseconds (ms), microseconds (us), minutes (m or min), hour (h), or day (d). " +
- "E.g. 50s, 100ms, or 250us.";
-
- throw new NumberFormatException(timeError + "\n" + e.getMessage());
+
+ /**
+ * Convert a time parameter such as (50s, 100ms, or 250us) to milliseconds for internal use. If
+ * no suffix is provided, the passed number is assumed to be in ms.
+ */
+ public static long timeStringAsMs(String str) {
+ return parseTimeString(str, TimeUnit.MILLISECONDS);
}
- }
-
- /**
- * Convert a time parameter such as (50s, 100ms, or 250us) to milliseconds for internal use. If
- * no suffix is provided, the passed number is assumed to be in ms.
- */
- public static long timeStringAsMs(String str) {
- return parseTimeString(str, TimeUnit.MILLISECONDS);
- }
-
- /**
- * Convert a time parameter such as (50s, 100ms, or 250us) to seconds for internal use. If
- * no suffix is provided, the passed number is assumed to be in seconds.
- */
- public static long timeStringAsSec(String str) {
- return parseTimeString(str, TimeUnit.SECONDS);
- }
/**
- * Returns a human-readable string representing a duration such as "35ms"
+ * Convert a time parameter such as (50s, 100ms, or 250us) to seconds for internal use. If no
+ * suffix is provided, the passed number is assumed to be in seconds.
*/
+ public static long timeStringAsSec(String str) {
+ return parseTimeString(str, TimeUnit.SECONDS);
+ }
+
+ /** Returns a human-readable string representing a duration such as "35ms" */
public static String msDurationToString(long ms) {
int second = 1000;
int minute = 60 * second;
@@ -172,62 +177,64 @@ public class ByteTimeUtils {
Locale locale = Locale.US;
if (ms < second) {
return String.format(locale, "%d ms", ms);
- } else if(ms < minute) {
+ } else if (ms < minute) {
return String.format(locale, "%.1f s", ms * 1f / second);
- } else if(ms < hour) {
+ } else if (ms < hour) {
return String.format(locale, "%.1f m", ms * 1f / minute);
} else {
return String.format(locale, "%.2f h", ms * 1f / hour);
}
}
- /**
- * Convert a passed byte string (e.g. 50b, 100kb, or 250mb) to a ByteUnit for
- * internal use. If no suffix is provided a direct conversion of the provided default is
- * attempted.
- */
- private static long parseByteString(String str, ByteUnit unit) {
- String lower = str.toLowerCase().trim();
-
- try {
- Matcher m = Pattern.compile("([0-9]+)\\s?([a-zA-Z]+)?").matcher(lower);
-// Matcher fractionMatcher = Pattern.compile("([0-9]+\\.[0-9]+)\\s?([a-z]+)?").matcher(lower);
- Matcher fractionMatcher = Pattern.compile("([0-9]+\\.[0-9]+)\\s?([a-zA-Z]{1,2})?").matcher(lower);
-
- long size = 0;
- int sub = 1;
- String suffix;
- if (fractionMatcher.matches()) {
- double val = Double.parseDouble(fractionMatcher.group(1));
- size = (long) (val * 100);
- suffix = fractionMatcher.group(2);
- sub = 100;
- } else if (m.matches()) {
- size = Long.parseLong(m.group(1));
- suffix = m.group(2);
- } else {
- throw new NumberFormatException("Failed to parse byte string: " + str);
- }
- suffix = suffix.toLowerCase();
- // Check for invalid suffixes
- if (suffix != null && !byteSuffixes.containsKey(suffix)) {
- throw new NumberFormatException("Invalid suffix: \"" + suffix + "\"");
- }
- // If suffix is valid use that, otherwise none was provided and use the default passed
- return unit.convertFrom(size, suffix != null ? byteSuffixes.get(suffix) : unit)/sub;
-
- } catch (NumberFormatException e) {
- String timeError = "Error size string " + str +". Size must be specified as bytes (b), " +
- "kibibytes (k), mebibytes (m), gibibytes (g), tebibytes (t), or pebibytes(p). " +
- "E.g. 50b, 100k, or 250m.";
-
- throw new IllegalArgumentException(timeError, e);
- }
- }
-
/**
- * Convert a quantity in bytes to a human-readable string such as "4.0 MB".
+ * Convert a passed byte string (e.g. 50b, 100kb, or 250mb) to a ByteUnit for internal use. If
+ * no suffix is provided a direct conversion of the provided default is attempted.
*/
+ private static long parseByteString(String str, ByteUnit unit) {
+ String lower = str.toLowerCase().trim();
+
+ try {
+ Matcher m = Pattern.compile("([0-9]+)\\s?([a-zA-Z]+)?").matcher(lower);
+ // Matcher fractionMatcher =
+ // Pattern.compile("([0-9]+\\.[0-9]+)\\s?([a-z]+)?").matcher(lower);
+ Matcher fractionMatcher =
+ Pattern.compile("([0-9]+\\.[0-9]+)\\s?([a-zA-Z]{1,2})?").matcher(lower);
+
+ long size = 0;
+ int sub = 1;
+ String suffix;
+ if (fractionMatcher.matches()) {
+ double val = Double.parseDouble(fractionMatcher.group(1));
+ size = (long) (val * 100);
+ suffix = fractionMatcher.group(2);
+ sub = 100;
+ } else if (m.matches()) {
+ size = Long.parseLong(m.group(1));
+ suffix = m.group(2);
+ } else {
+ throw new NumberFormatException("Failed to parse byte string: " + str);
+ }
+ suffix = suffix.toLowerCase();
+ // Check for invalid suffixes
+ if (suffix != null && !byteSuffixes.containsKey(suffix)) {
+ throw new NumberFormatException("Invalid suffix: \"" + suffix + "\"");
+ }
+ // If suffix is valid use that, otherwise none was provided and use the default passed
+ return unit.convertFrom(size, suffix != null ? byteSuffixes.get(suffix) : unit) / sub;
+
+ } catch (NumberFormatException e) {
+ String timeError =
+ "Error size string "
+ + str
+ + ". Size must be specified as bytes (b), "
+ + "kibibytes (k), mebibytes (m), gibibytes (g), tebibytes (t), or pebibytes(p). "
+ + "E.g. 50b, 100k, or 250m.";
+
+ throw new IllegalArgumentException(timeError, e);
+ }
+ }
+
+ /** Convert a quantity in bytes to a human-readable string such as "4.0 MB". */
public static String bytesToString(long size) {
long TB = 1L << 40;
long GB = 1L << 30;
@@ -236,16 +243,16 @@ public class ByteTimeUtils {
double value;
String unit;
- if (size >= 2*TB || -2*TB >= size) {
+ if (size >= 2 * TB || -2 * TB >= size) {
value = size * 1f / TB;
unit = "TB";
- } else if (size >= 2*GB || -2*GB >= size) {
+ } else if (size >= 2 * GB || -2 * GB >= size) {
value = size * 1f / GB;
unit = "GB";
- } else if (size >= 2*MB || -2*MB >= size) {
+ } else if (size >= 2 * MB || -2 * MB >= size) {
value = size * 1f / MB;
unit = "MB";
- } else if (size >= 2*KB || -2*KB >= size) {
+ } else if (size >= 2 * KB || -2 * KB >= size) {
value = size * 1f / KB;
unit = "KB";
} else {
@@ -255,109 +262,124 @@ public class ByteTimeUtils {
return String.format(Locale.US, "%.1f %s", value, unit);
}
- /**
- * Convert a passed byte string (e.g. 50b, 100k, or 250m) to bytes for
- * internal use.
- *
- * If no suffix is provided, the passed number is assumed to be in bytes.
- */
- public static long byteStringAsBytes(String str) {
- return parseByteString(str, ByteUnit.BYTE);
- }
-
- /**
- * Convert a passed byte string (e.g. 50b, 100k, or 250m) to kibibytes for
- * internal use.
- *
- * If no suffix is provided, the passed number is assumed to be in kibibytes.
- */
- public static long byteStringAsKb(String str) {
- return parseByteString(str, ByteUnit.KiB);
- }
-
- /**
- * Convert a passed byte string (e.g. 50b, 100k, or 250m) to mebibytes for
- * internal use.
- *
- * If no suffix is provided, the passed number is assumed to be in mebibytes.
- */
- public static long byteStringAsMb(String str) {
- return parseByteString(str, ByteUnit.MiB);
- }
-
- /**
- * Convert a passed byte string (e.g. 50b, 100k, or 250m) to gibibytes for
- * internal use.
- *
- * If no suffix is provided, the passed number is assumed to be in gibibytes.
- */
- public static long byteStringAsGb(String str) {
- return parseByteString(str, ByteUnit.GiB);
- }
-
- /**
- * Returns a byte array with the buffer's contents, trying to avoid copying the data if
- * possible.
- */
- public static byte[] bufferToArray(ByteBuffer buffer) {
- if (buffer.hasArray() && buffer.arrayOffset() == 0 &&
- buffer.array().length == buffer.remaining()) {
- return buffer.array();
- } else {
- byte[] bytes = new byte[buffer.remaining()];
- buffer.get(bytes);
- return bytes;
+ /**
+ * Convert a passed byte string (e.g. 50b, 100k, or 250m) to bytes for internal use.
+ *
+ * <p>If no suffix is provided, the passed number is assumed to be in bytes.
+ */
+ public static long byteStringAsBytes(String str) {
+ return parseByteString(str, ByteUnit.BYTE);
+ }
+
+ /**
+ * Convert a passed byte string (e.g. 50b, 100k, or 250m) to kibibytes for internal use.
+ *
+ * <p>If no suffix is provided, the passed number is assumed to be in kibibytes.
+ */
+ public static long byteStringAsKb(String str) {
+ return parseByteString(str, ByteUnit.KiB);
+ }
+
+ /**
+ * Convert a passed byte string (e.g. 50b, 100k, or 250m) to mebibytes for internal use.
+ *
+ * <p>If no suffix is provided, the passed number is assumed to be in mebibytes.
+ */
+ public static long byteStringAsMb(String str) {
+ return parseByteString(str, ByteUnit.MiB);
+ }
+
+ /**
+ * Convert a passed byte string (e.g. 50b, 100k, or 250m) to gibibytes for internal use.
+ *
+ * <p>If no suffix is provided, the passed number is assumed to be in gibibytes.
+ */
+ public static long byteStringAsGb(String str) {
+ return parseByteString(str, ByteUnit.GiB);
+ }
+
+ /**
+ * Returns a byte array with the buffer's contents, trying to avoid copying the data if
+ * possible.
+ */
+ public static byte[] bufferToArray(ByteBuffer buffer) {
+ if (buffer.hasArray()
+ && buffer.arrayOffset() == 0
+ && buffer.array().length == buffer.remaining()) {
+ return buffer.array();
+ } else {
+ byte[] bytes = new byte[buffer.remaining()];
+ buffer.get(bytes);
+ return bytes;
+ }
+ }
+
+ enum ByteUnit {
+ BYTE(1),
+ KiB(1024L),
+ MiB((long) Math.pow(1024L, 2L)),
+ GiB((long) Math.pow(1024L, 3L)),
+ TiB((long) Math.pow(1024L, 4L)),
+ PiB((long) Math.pow(1024L, 5L));
+
+ private ByteUnit(long multiplier) {
+ this.multiplier = multiplier;
+ }
+
+ // Interpret the provided number (d) with suffix (u) as this unit type.
+ // E.g. KiB.interpret(1, MiB) interprets 1MiB as its KiB representation = 1024k
+ public long convertFrom(long d, ByteUnit u) {
+ return u.convertTo(d, this);
+ }
+
+ // Convert the provided number (d) interpreted as this unit type to unit type (u).
+ public long convertTo(long d, ByteUnit u) {
+ if (multiplier > u.multiplier) {
+ long ratio = multiplier / u.multiplier;
+ if (Long.MAX_VALUE / ratio < d) {
+ throw new IllegalArgumentException(
+ "Conversion of "
+ + d
+ + " exceeds Long.MAX_VALUE in "
+ + name()
+ + ". Try a larger unit (e.g. MiB instead of KiB)");
+ }
+ return d * ratio;
+ } else {
+ // Perform operations in this order to avoid potential overflow
+ // when computing d * multiplier
+ return d / (u.multiplier / multiplier);
+ }
+ }
+
+ public double toBytes(long d) {
+ if (d < 0) {
+ throw new IllegalArgumentException(
+ "Negative size value. Size must be positive: " + d);
+ }
+ return d * multiplier;
+ }
+
+ public long toKiB(long d) {
+ return convertTo(d, KiB);
+ }
+
+ public long toMiB(long d) {
+ return convertTo(d, MiB);
+ }
+
+ public long toGiB(long d) {
+ return convertTo(d, GiB);
+ }
+
+ public long toTiB(long d) {
+ return convertTo(d, TiB);
+ }
+
+ public long toPiB(long d) {
+ return convertTo(d, PiB);
+ }
+
+ private final long multiplier;
}
- }
-
- enum ByteUnit {
- BYTE (1),
- KiB (1024L),
- MiB ((long) Math.pow(1024L, 2L)),
- GiB ((long) Math.pow(1024L, 3L)),
- TiB ((long) Math.pow(1024L, 4L)),
- PiB ((long) Math.pow(1024L, 5L));
-
- private ByteUnit(long multiplier) {
- this.multiplier = multiplier;
- }
-
- // Interpret the provided number (d) with suffix (u) as this unit type.
- // E.g. KiB.interpret(1, MiB) interprets 1MiB as its KiB representation = 1024k
- public long convertFrom(long d, ByteUnit u) {
- return u.convertTo(d, this);
- }
-
- // Convert the provided number (d) interpreted as this unit type to unit type (u).
- public long convertTo(long d, ByteUnit u) {
- if (multiplier > u.multiplier) {
- long ratio = multiplier / u.multiplier;
- if (Long.MAX_VALUE / ratio < d) {
- throw new IllegalArgumentException("Conversion of " + d + " exceeds Long.MAX_VALUE in "
- + name() + ". Try a larger unit (e.g. MiB instead of KiB)");
- }
- return d * ratio;
- } else {
- // Perform operations in this order to avoid potential overflow
- // when computing d * multiplier
- return d / (u.multiplier / multiplier);
- }
- }
-
- public double toBytes(long d) {
- if (d < 0) {
- throw new IllegalArgumentException("Negative size value. Size must be positive: " + d);
- }
- return d * multiplier;
- }
-
- public long toKiB(long d) { return convertTo(d, KiB); }
- public long toMiB(long d) { return convertTo(d, MiB); }
- public long toGiB(long d) { return convertTo(d, GiB); }
- public long toTiB(long d) { return convertTo(d, TiB); }
- public long toPiB(long d) { return convertTo(d, PiB); }
-
- private final long multiplier;
- }
-
-}
\ No newline at end of file
+}
diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/DESUtil.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/DESUtil.java
index b161d1e..e10c10b 100644
--- a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/DESUtil.java
+++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/DESUtil.java
@@ -5,43 +5,46 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.common.utils;
import org.apache.commons.lang.StringUtils;
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
+
import java.security.SecureRandom;
+import sun.misc.BASE64Decoder;
+import sun.misc.BASE64Encoder;
+
public class DESUtil {
- private final static String DES = "DES";
- private final static String XBYTE = "X";
+ private static final String DES = "DES";
+ private static final String XBYTE = "X";
/**
* Description Encryption based on key values(Description 根据键值进行加密)
+ *
* @param data
* @param key Encryption key byte array(加密键byte数组)
* @return Ciphertext(密文)
* @throws Exception
*/
public static String encrypt(String data, String key) throws Exception {
- if(StringUtils.isNotBlank(key) && key.length() < 8){
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
int i = key.length();
- while((8-i) > 0){
+ while ((8 - i) > 0) {
key += XBYTE;
i++;
}
@@ -53,18 +56,19 @@ public class DESUtil {
/**
* Description Encryption based on key values(Description 根据键值进行加密)
+ *
* @param data
* @param key Encryption key byte array(加密键byte数组)
* @return Ciphertext(密文)
* @throws Exception
*/
public static String decrypt(String data, String key) throws Exception {
- if (StringUtils.isBlank(data)){
+ if (StringUtils.isBlank(data)) {
return null;
}
- if(StringUtils.isNotBlank(key) && key.length() < 8){
+ if (StringUtils.isNotBlank(key) && key.length() < 8) {
int i = key.length();
- while((8-i) > 0){
+ while ((8 - i) > 0) {
key += XBYTE;
i++;
}
@@ -77,6 +81,7 @@ public class DESUtil {
/**
* Description Encryption based on key values(Description 根据键值进行加密)
+ *
* @param data
* @param key Encryption key byte array(加密键byte数组)
* @return Ciphertext(密文)
@@ -89,7 +94,8 @@ public class DESUtil {
// Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
DESKeySpec dks = new DESKeySpec(key);
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
+ // Create a key factory and use it to convert the DESKeySpec to a SecretKey
+ // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
SecretKey securekey = keyFactory.generateSecret(dks);
@@ -104,6 +110,7 @@ public class DESUtil {
/**
* Description Encryption based on key values(Description 根据键值进行加密)
+ *
* @param data
* @param key Encryption key byte array(加密键byte数组)
* @return Ciphertext(密文)
@@ -116,7 +123,8 @@ public class DESUtil {
// Create a DESKeySpec object from the original key data(从原始密钥数据创建DESKeySpec对象)
DESKeySpec dks = new DESKeySpec(key);
- // Create a key factory and use it to convert the DESKeySpec to a SecretKey object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
+ // Create a key factory and use it to convert the DESKeySpec to a SecretKey
+ // object(创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象)
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
SecretKey securekey = keyFactory.generateSecret(dks);
@@ -128,6 +136,6 @@ public class DESUtil {
return cipher.doFinal(data);
}
- public static void main(String[] args) throws Exception {
- }
+
+ public static void main(String[] args) throws Exception {}
}
diff --git a/linkis-commons/linkis-hadoop-common/src/main/java/org/apache/linkis/hadoop/common/utils/KerberosUtils.java b/linkis-commons/linkis-hadoop-common/src/main/java/org/apache/linkis/hadoop/common/utils/KerberosUtils.java
index 566dd9e..7d20cc1 100644
--- a/linkis-commons/linkis-hadoop-common/src/main/java/org/apache/linkis/hadoop/common/utils/KerberosUtils.java
+++ b/linkis-commons/linkis-hadoop-common/src/main/java/org/apache/linkis/hadoop/common/utils/KerberosUtils.java
@@ -18,8 +18,10 @@
package org.apache.linkis.hadoop.common.utils;
import org.apache.linkis.hadoop.common.conf.HadoopConf;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,13 +30,10 @@ import java.io.IOException;
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION;
import static org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS;
-
public class KerberosUtils {
private static final Logger LOG = LoggerFactory.getLogger(KerberosUtils.class);
-
- private KerberosUtils() {
- }
+ private KerberosUtils() {}
private static Configuration createKerberosSecurityConfiguration() {
Configuration conf = HDFSUtils.getConfiguration(HadoopConf.HADOOP_ROOT_USER().getValue());
@@ -52,10 +51,13 @@ public class KerberosUtils {
UserGroupInformation.loginUserFromKeytab(principal, keytab);
LOG.info("Login successfully with keytab: {} and principal: {}", keytab, principal);
} else {
- LOG.info("The user has already logged in using keytab and principal, no action required");
+ LOG.info(
+ "The user has already logged in using keytab and principal, no action required");
}
} catch (IOException e) {
- LOG.error("Failed to get either keytab location or principal name in the jdbc executor", e);
+ LOG.error(
+ "Failed to get either keytab location or principal name in the jdbc executor",
+ e);
}
}
@@ -75,7 +77,8 @@ public class KerberosUtils {
} catch (Exception e) {
LOG.error("Unable to run kinit for linkis jdbc executor", e);
}
- LOG.debug("Neither Keytab nor ticket based login. runRefreshKerberosLoginWork() returning false");
+ LOG.debug(
+ "Neither Keytab nor ticket based login. runRefreshKerberosLoginWork() returning false");
return false;
}
@@ -89,23 +92,30 @@ public class KerberosUtils {
try {
refreshInterval = Long.parseLong(refreshIntervalString);
} catch (NumberFormatException e) {
- LOG.error("Cannot get time in MS for the given string, " + refreshIntervalString
- + " defaulting to 86400000 ", e);
+ LOG.error(
+ "Cannot get time in MS for the given string, "
+ + refreshIntervalString
+ + " defaulting to 86400000 ",
+ e);
refreshInterval = 86400000L;
-
}
return refreshInterval;
}
public static Integer kinitFailTimesThreshold() {
Integer kinitFailThreshold = 5;
- //defined in linkis-env.sh, if not initialized then the default value is 5.
+ // defined in linkis-env.sh, if not initialized then the default value is 5.
if (System.getenv("LINKIS_JDBC_KERBEROS_KINIT_FAIL_THRESHOLD") != null) {
try {
- kinitFailThreshold = new Integer(System.getenv("LINKIS_JDBC_KERBEROS_KINIT_FAIL_THRESHOLD"));
+ kinitFailThreshold =
+ new Integer(System.getenv("LINKIS_JDBC_KERBEROS_KINIT_FAIL_THRESHOLD"));
} catch (Exception e) {
- LOG.error("Cannot get integer value from the given string, " + System
- .getenv("LINKIS_JDBC_KERBEROS_KINIT_FAIL_THRESHOLD") + " defaulting to " + kinitFailThreshold, e);
+ LOG.error(
+ "Cannot get integer value from the given string, "
+ + System.getenv("LINKIS_JDBC_KERBEROS_KINIT_FAIL_THRESHOLD")
+ + " defaulting to "
+ + kinitFailThreshold,
+ e);
}
}
return kinitFailThreshold;
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Chain.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Chain.java
index e1aa413..2498bb4 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Chain.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Chain.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.annotation;
import java.lang.annotation.ElementType;
@@ -22,7 +22,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Chain {
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Implicit.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Implicit.java
index 2ac1e2e..3dc0f86 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Implicit.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Implicit.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.annotation;
import java.lang.annotation.ElementType;
@@ -22,8 +22,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface Implicit {
-}
+public @interface Implicit {}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Method.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Method.java
index a0df3e8..b5bb1ab 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Method.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Method.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.annotation;
import java.lang.annotation.ElementType;
@@ -22,7 +22,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Method {
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/NotImplicit.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/NotImplicit.java
index a80b0ce..e0c9380 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/NotImplicit.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/NotImplicit.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.annotation;
import java.lang.annotation.ElementType;
@@ -22,8 +22,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
-public @interface NotImplicit {
-}
+public @interface NotImplicit {}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Order.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Order.java
index 9ebdded..cb06efb 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Order.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Order.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.annotation;
import java.lang.annotation.ElementType;
@@ -22,7 +22,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Order {
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Receiver.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Receiver.java
index 2791a6c..1a4fea0 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Receiver.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/annotation/Receiver.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.annotation;
import java.lang.annotation.ElementType;
@@ -22,8 +22,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface Receiver {
-}
+public @interface Receiver {}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultMessageJob.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultMessageJob.java
index 3069382..5b9f1f2 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultMessageJob.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultMessageJob.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.builder;
import org.apache.linkis.message.context.AbstractMessageSchedulerContext;
@@ -33,7 +33,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.LockSupport;
-
public class DefaultMessageJob extends Job implements MessageJob {
private RequestProtocol requestProtocol;
@@ -44,7 +43,7 @@ public class DefaultMessageJob extends Job implements MessageJob {
private AbstractMessageSchedulerContext context;
- //implements of MessageJob
+ // implements of MessageJob
@Override
public RequestProtocol getRequestProtocol() {
@@ -62,7 +61,8 @@ public class DefaultMessageJob extends Job implements MessageJob {
}
@Override
- public void setMethodExecuteWrappers(Map<String, List<MethodExecuteWrapper>> methodExecuteWrappers) {
+ public void setMethodExecuteWrappers(
+ Map<String, List<MethodExecuteWrapper>> methodExecuteWrappers) {
this.methodExecuteWrappers = methodExecuteWrappers;
}
@@ -86,11 +86,10 @@ public class DefaultMessageJob extends Job implements MessageJob {
this.context = context;
}
- //implements of Job
+ // implements of Job
@Override
- public void init() {
- }
+ public void init() {}
@Override
public ExecuteRequest jobToExecuteRequest() {
@@ -108,8 +107,7 @@ public class DefaultMessageJob extends Job implements MessageJob {
}
@Override
- public void close() throws IOException {
- }
+ public void close() throws IOException {}
// implements of Future
@@ -117,7 +115,6 @@ public class DefaultMessageJob extends Job implements MessageJob {
Thread blockThread = null;
-
public Thread getBlockThread() {
return this.blockThread;
}
@@ -152,11 +149,13 @@ public class DefaultMessageJob extends Job implements MessageJob {
}
@Override
- public Object get(long timeout, TimeUnit unit) throws ExecutionException, InterruptedException, TimeoutException {
+ public Object get(long timeout, TimeUnit unit)
+ throws ExecutionException, InterruptedException, TimeoutException {
if (unit == null) unit = TimeUnit.NANOSECONDS;
if (!this.isCompleted()
- && !SchedulerEventState.isCompleted(SchedulerEventState.apply(waitComplete(true, unit.toNanos(timeout))))) {
- String msg = "task: " + this.requestProtocol + "time out " + timeout;
+ && !SchedulerEventState.isCompleted(
+ SchedulerEventState.apply(waitComplete(true, unit.toNanos(timeout))))) {
+ String msg = "task: " + this.requestProtocol + "time out " + timeout;
throw new TimeoutException(msg);
}
return handleResult();
@@ -170,16 +169,14 @@ public class DefaultMessageJob extends Job implements MessageJob {
}
if (this.isCompleted()) {
return this.getState().id();
- } else if (blockThread == null)
- blockThread = Thread.currentThread();
+ } else if (blockThread == null) blockThread = Thread.currentThread();
else if (timed) {
nanos = endTime - System.nanoTime();
if (nanos <= 0) {
return this.getState().id();
}
LockSupport.parkNanos(this, nanos);
- } else
- LockSupport.park(this);
+ } else LockSupport.park(this);
}
}
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultMessageJobBuilder.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultMessageJobBuilder.java
index a4b5c1a..2a2ad04 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultMessageJobBuilder.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultMessageJobBuilder.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.builder;
import org.apache.linkis.message.context.AbstractMessageSchedulerContext;
@@ -24,7 +24,6 @@ import org.apache.linkis.protocol.message.RequestProtocol;
import java.util.List;
import java.util.Map;
-
public class DefaultMessageJobBuilder implements MessageJobBuilder {
private RequestProtocol requestProtocol;
@@ -52,7 +51,6 @@ public class DefaultMessageJobBuilder implements MessageJobBuilder {
return this;
}
-
@Override
public MessageJobBuilder with(ServiceMethodContext smc) {
this.smc = smc;
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultServiceMethodContext.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultServiceMethodContext.java
index 00bd8dd..e72e686 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultServiceMethodContext.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/DefaultServiceMethodContext.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.builder;
import org.apache.linkis.message.context.MessageSchedulerContext;
@@ -23,17 +23,18 @@ import org.apache.linkis.protocol.message.RequestProtocol;
import org.apache.linkis.rpc.Sender;
import org.apache.linkis.scheduler.queue.Job;
import org.apache.linkis.scheduler.queue.SchedulerEventState;
-import scala.concurrent.duration.Duration;
import javax.servlet.http.HttpServletRequest;
+
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import static org.apache.linkis.message.conf.MessageSchedulerConf.*;
+import scala.concurrent.duration.Duration;
+import static org.apache.linkis.message.conf.MessageSchedulerConf.*;
public class DefaultServiceMethodContext implements ServiceMethodContext {
@@ -126,13 +127,13 @@ public class DefaultServiceMethodContext implements ServiceMethodContext {
@Override
public boolean isInterrupted() {
- //linkis-shceduler 没有isInterrupted状态
+ // linkis-shceduler 没有isInterrupted状态
return SchedulerEventState.Cancelled() == this.job.get().getState();
}
@Override
public boolean isCancel() {
- //linkis-shceduler只有cancel
+ // linkis-shceduler只有cancel
return SchedulerEventState.Cancelled() == this.job.get().getState();
}
@@ -162,5 +163,4 @@ public class DefaultServiceMethodContext implements ServiceMethodContext {
public void removeSkips() {
this.skips.remove();
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/Future.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/Future.java
index 9827bc1..9786807 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/Future.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/Future.java
@@ -5,23 +5,22 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.builder;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
public interface Future<V> {
boolean cancel(boolean mayInterruptIfRunning);
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJob.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJob.java
index 0e294c2..3e3cc51 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJob.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJob.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.builder;
import org.apache.linkis.message.context.AbstractMessageSchedulerContext;
@@ -24,8 +24,6 @@ import org.apache.linkis.protocol.message.RequestProtocol;
import java.util.List;
import java.util.Map;
-
-
public interface MessageJob extends Runnable, Future<Object> {
RequestProtocol getRequestProtocol();
@@ -43,5 +41,4 @@ public interface MessageJob extends Runnable, Future<Object> {
AbstractMessageSchedulerContext getContext();
void setContext(AbstractMessageSchedulerContext context);
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobBuilder.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobBuilder.java
index ab23e44..07b8f84 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobBuilder.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobBuilder.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.builder;
import org.apache.linkis.message.context.AbstractMessageSchedulerContext;
@@ -24,7 +24,6 @@ import org.apache.linkis.protocol.message.RequestProtocol;
import java.util.List;
import java.util.Map;
-
public interface MessageJobBuilder {
MessageJobBuilder of();
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobListener.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobListener.java
index 6b61ff2..6a5408a 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobListener.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobListener.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.builder;
import org.apache.linkis.common.utils.JavaLog;
@@ -23,28 +23,19 @@ import org.apache.linkis.scheduler.queue.Job;
import java.util.concurrent.locks.LockSupport;
-
public class MessageJobListener extends JavaLog implements JobListener {
@Override
- public void onJobScheduled(Job job) {
-
- }
+ public void onJobScheduled(Job job) {}
@Override
- public void onJobInited(Job job) {
-
- }
+ public void onJobInited(Job job) {}
@Override
- public void onJobWaitForRetry(Job job) {
-
- }
+ public void onJobWaitForRetry(Job job) {}
@Override
- public void onJobRunning(Job job) {
-
- }
+ public void onJobRunning(Job job) {}
@Override
public void onJobCompleted(Job job) {
@@ -52,5 +43,4 @@ public class MessageJobListener extends JavaLog implements JobListener {
LockSupport.unpark(((DefaultMessageJob) job).getBlockThread());
}
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobTimeoutPolicy.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobTimeoutPolicy.java
index 7b11a43..0282080 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobTimeoutPolicy.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/MessageJobTimeoutPolicy.java
@@ -5,21 +5,19 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message.builder;
+package org.apache.linkis.message.builder;
public enum MessageJobTimeoutPolicy {
-
CANCEL,
INTERRUPT,
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/ServiceMethodContext.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/ServiceMethodContext.java
index 2b292ca..dbccb82 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/ServiceMethodContext.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/builder/ServiceMethodContext.java
@@ -5,25 +5,24 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message.builder;
+package org.apache.linkis.message.builder;
import org.apache.linkis.protocol.message.RequestProtocol;
import org.apache.linkis.rpc.Sender;
-import scala.concurrent.duration.Duration;
import javax.servlet.http.HttpServletRequest;
+import scala.concurrent.duration.Duration;
public interface ServiceMethodContext {
@@ -62,5 +61,4 @@ public interface ServiceMethodContext {
boolean isCancel();
boolean isSuccess();
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/conf/MessageSchedulerConf.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/conf/MessageSchedulerConf.java
index 22d80e5..e84cfd9 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/conf/MessageSchedulerConf.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/conf/MessageSchedulerConf.java
@@ -5,42 +5,50 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message.conf;
+package org.apache.linkis.message.conf;
import org.apache.linkis.common.conf.CommonVars;
+
import org.reflections.Reflections;
import org.reflections.scanners.MethodAnnotationsScanner;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.scanners.TypeAnnotationsScanner;
-
public class MessageSchedulerConf {
- public static final String SERVICE_SCAN_PACKAGE = CommonVars.apply("wds.linkis.ms.service.scan.package", "org.apache.linkis").getValue();
- public static final Integer MAX_PARALLELISM_CONSUMERS = CommonVars.apply("wds.linkis.ms.parallelism.consumer.max", 200).getValue();
- public static final Integer MAX_PARALLELISM_USER = CommonVars.apply("wds.linkis.ms.parallelism.user.count", 10).getValue();
- public static final Integer MAX_RUNNING_JOB = CommonVars.apply("wds.linkis.ms.running.jobs.max", 5 * MAX_PARALLELISM_USER).getValue();
- public static final Integer MAX_QUEUE_CAPACITY = CommonVars.apply("wds.linkis.ms.queue.capacity.max", MAX_RUNNING_JOB * 100).getValue();
-
- public final static Reflections REFLECTIONS = new Reflections(SERVICE_SCAN_PACKAGE, new MethodAnnotationsScanner(), new TypeAnnotationsScanner(), new SubTypesScanner());
-
- public final static String USER_KEY = "_username_";
- public final static String REQUEST_KEY = "_req_";
- public final static String RESULT_KEY = "_result_";
- public final static String CONTEXT_KEY = "_context_";
- public final static String SENDER_KEY = "_sender_";
- public final static String TIMEOUT_POLICY = "_timeout_policy_";
- public final static String DURATION_KEY = "_duration_";
-
+ public static final String SERVICE_SCAN_PACKAGE =
+ CommonVars.apply("wds.linkis.ms.service.scan.package", "org.apache.linkis").getValue();
+ public static final Integer MAX_PARALLELISM_CONSUMERS =
+ CommonVars.apply("wds.linkis.ms.parallelism.consumer.max", 200).getValue();
+ public static final Integer MAX_PARALLELISM_USER =
+ CommonVars.apply("wds.linkis.ms.parallelism.user.count", 10).getValue();
+ public static final Integer MAX_RUNNING_JOB =
+ CommonVars.apply("wds.linkis.ms.running.jobs.max", 5 * MAX_PARALLELISM_USER).getValue();
+ public static final Integer MAX_QUEUE_CAPACITY =
+ CommonVars.apply("wds.linkis.ms.queue.capacity.max", MAX_RUNNING_JOB * 100).getValue();
+
+ public static final Reflections REFLECTIONS =
+ new Reflections(
+ SERVICE_SCAN_PACKAGE,
+ new MethodAnnotationsScanner(),
+ new TypeAnnotationsScanner(),
+ new SubTypesScanner());
+
+ public static final String USER_KEY = "_username_";
+ public static final String REQUEST_KEY = "_req_";
+ public static final String RESULT_KEY = "_result_";
+ public static final String CONTEXT_KEY = "_context_";
+ public static final String SENDER_KEY = "_sender_";
+ public static final String TIMEOUT_POLICY = "_timeout_policy_";
+ public static final String DURATION_KEY = "_duration_";
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/AbstractMessageSchedulerContext.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/AbstractMessageSchedulerContext.java
index 11078eb..6fef508 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/AbstractMessageSchedulerContext.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/AbstractMessageSchedulerContext.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.context;
import org.apache.linkis.message.builder.MessageJobBuilder;
@@ -26,7 +26,6 @@ import org.apache.linkis.message.registry.AbstractServiceRegistry;
import org.apache.linkis.message.scheduler.MessageScheduler;
import org.apache.linkis.message.tx.TransactionManager;
-
public abstract class AbstractMessageSchedulerContext implements MessageSchedulerContext {
private AbstractServiceRegistry serviceRegistry;
@@ -110,5 +109,4 @@ public abstract class AbstractMessageSchedulerContext implements MessageSchedule
public void setTxManager(TransactionManager txManager) {
this.txManager = txManager;
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/DefaultMessageSchedulerContext.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/DefaultMessageSchedulerContext.java
index 2861f91..feccb3e 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/DefaultMessageSchedulerContext.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/DefaultMessageSchedulerContext.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.context;
import org.apache.linkis.message.builder.DefaultMessageJobBuilder;
@@ -26,20 +26,16 @@ import org.apache.linkis.message.registry.AbstractServiceRegistry;
import org.apache.linkis.message.scheduler.DefaultMessageScheduler;
import org.apache.linkis.message.tx.TransactionManager;
-
public class DefaultMessageSchedulerContext extends AbstractMessageSchedulerContext {
{
setImplicitParser(new DefaultImplicitParser());
- setImplicitRegistry(new AbstractImplicitRegistry(this){});
+ setImplicitRegistry(new AbstractImplicitRegistry(this) {});
setserviceParser(new DefaultServiceParser());
setPublisher(new DefaultMessagePublisher(this));
- setServiceRegistry(new AbstractServiceRegistry(this) {
- });
+ setServiceRegistry(new AbstractServiceRegistry(this) {});
setScheduler(new DefaultMessageScheduler());
setJobBuilder(new DefaultMessageJobBuilder());
- setTxManager(new TransactionManager() {
- });
+ setTxManager(new TransactionManager() {});
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/MSContextInstance.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/MSContextInstance.java
index 3b93db2..353deec 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/MSContextInstance.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/MSContextInstance.java
@@ -5,23 +5,23 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.context;
import org.apache.linkis.message.utils.MessageUtils;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
public class MSContextInstance {
private static final Logger LOGGER = LoggerFactory.getLogger(MSContextInstance.class);
@@ -33,17 +33,15 @@ public class MSContextInstance {
synchronized (MSContextInstance.class) {
if (context != null) {
try {
- MessageSchedulerContext bean = MessageUtils.getBean(MessageSchedulerContext.class);
- if (bean != null)
- context = bean;
- else
- context = new DefaultMessageSchedulerContext();
+ MessageSchedulerContext bean =
+ MessageUtils.getBean(MessageSchedulerContext.class);
+ if (bean != null) context = bean;
+ else context = new DefaultMessageSchedulerContext();
} catch (Throwable e) {
LOGGER.warn("can not load message context from ioc container");
context = new DefaultMessageSchedulerContext();
}
}
-
}
}
return context;
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/MessageSchedulerContext.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/MessageSchedulerContext.java
index 0e5e085..ddc6362 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/MessageSchedulerContext.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/MessageSchedulerContext.java
@@ -5,23 +5,22 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.context;
import org.apache.linkis.message.publisher.MessagePublisher;
import org.apache.linkis.message.registry.ImplicitRegistry;
import org.apache.linkis.message.registry.ServiceRegistry;
-
public interface MessageSchedulerContext {
MessagePublisher getPublisher();
@@ -29,5 +28,4 @@ public interface MessageSchedulerContext {
ServiceRegistry getServiceRegistry();
ImplicitRegistry getImplicitRegistry();
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/SpringMessageSchedulerContext.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/SpringMessageSchedulerContext.java
index c9661bb..0673b37 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/SpringMessageSchedulerContext.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/context/SpringMessageSchedulerContext.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.context;
import org.apache.linkis.message.builder.DefaultMessageJobBuilder;
@@ -26,10 +26,9 @@ import org.apache.linkis.message.registry.SpringServiceRegistry;
import org.apache.linkis.message.scheduler.DefaultMessageScheduler;
import org.apache.linkis.message.tx.SpringTransactionManager;
-
public class SpringMessageSchedulerContext extends AbstractMessageSchedulerContext {
- public SpringMessageSchedulerContext(){
+ public SpringMessageSchedulerContext() {
setImplicitParser(new DefaultImplicitParser());
setImplicitRegistry(new SpringImplicitRegistry(this));
setserviceParser(new DefaultServiceParser());
@@ -39,5 +38,4 @@ public class SpringMessageSchedulerContext extends AbstractMessageSchedulerConte
setJobBuilder(new DefaultMessageJobBuilder());
setTxManager(new SpringTransactionManager());
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/exception/MessageErrorException.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/exception/MessageErrorException.java
index 4162601..073ed73 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/exception/MessageErrorException.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/exception/MessageErrorException.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.exception;
import org.apache.linkis.common.exception.ErrorException;
-
public class MessageErrorException extends ErrorException {
public MessageErrorException(int errCode, String desc) {
@@ -30,5 +29,4 @@ public class MessageErrorException extends ErrorException {
super(errCode, desc);
initCause(t);
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/exception/MessageWarnException.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/exception/MessageWarnException.java
index 5a38fcd..ca33bef 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/exception/MessageWarnException.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/exception/MessageWarnException.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.exception;
import org.apache.linkis.common.exception.WarnException;
-
public class MessageWarnException extends WarnException {
public MessageWarnException(int errCode, String desc) {
@@ -30,5 +29,4 @@ public class MessageWarnException extends WarnException {
super(errCode, desc);
initCause(t);
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/DefaultImplicitParser.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/DefaultImplicitParser.java
index 484f639..4cd8e48 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/DefaultImplicitParser.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/DefaultImplicitParser.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.parser;
import org.apache.linkis.message.annotation.Implicit;
@@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+
public class DefaultImplicitParser implements ImplicitParser {
@Override
public Map<String, List<ImplicitMethod>> parse(Object implicitObject) {
@@ -45,10 +46,7 @@ public class DefaultImplicitParser implements ImplicitParser {
}
/**
- * 标注了@implicit注解
- * 入参数量只有一个,返回值不为void
- * 入参需要是RequestProtocol 的子类
- * 排除出参是入参的父类的情况
+ * 标注了@implicit注解 入参数量只有一个,返回值不为void 入参需要是RequestProtocol 的子类 排除出参是入参的父类的情况
*
* @param method
* @return
@@ -59,7 +57,8 @@ public class DefaultImplicitParser implements ImplicitParser {
&& !void.class.equals(method.getReturnType())) {
// TODO: 2020/8/4 返回值支持集合 ,参数也可以不用是RequestProtocol的子类
Class<?> input = method.getParameterTypes()[0];
- return RequestProtocol.class.isAssignableFrom(input) && !method.getReturnType().isAssignableFrom(input);
+ return RequestProtocol.class.isAssignableFrom(input)
+ && !method.getReturnType().isAssignableFrom(input);
}
return false;
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/DefaultServiceParser.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/DefaultServiceParser.java
index 22fb6e4..d3e044d 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/DefaultServiceParser.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/DefaultServiceParser.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.parser;
import org.apache.linkis.message.annotation.Chain;
@@ -22,6 +22,7 @@ import org.apache.linkis.message.annotation.NotImplicit;
import org.apache.linkis.message.annotation.Order;
import org.apache.linkis.message.annotation.Receiver;
import org.apache.linkis.message.builder.ServiceMethodContext;
+
import org.springframework.aop.support.AopUtils;
import java.lang.reflect.Method;
@@ -31,13 +32,12 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-
public class DefaultServiceParser implements ServiceParser {
@Override
public Map<String, List<ServiceMethod>> parse(Object service) {
// TODO: 2020/7/15 more analysis
-// Method[] methods = service.getClass().getMethods();
+ // Method[] methods = service.getClass().getMethods();
Method[] methods = AopUtils.getTargetClass(service).getMethods();
return Arrays.stream(methods)
.filter(this::methodFilterPredicate)
@@ -49,7 +49,8 @@ public class DefaultServiceParser implements ServiceParser {
ServiceMethod serviceMethod = new ServiceMethod();
serviceMethod.setMethod(method);
serviceMethod.setService(service);
- serviceMethod.setAlias(String.format("%s.%s", service.getClass().getName(), method.getName()));
+ serviceMethod.setAlias(
+ String.format("%s.%s", service.getClass().getName(), method.getName()));
Order order = method.getAnnotation(Order.class);
if (order != null) {
serviceMethod.setOrder(order.value());
@@ -63,8 +64,11 @@ public class DefaultServiceParser implements ServiceParser {
serviceMethod.setMethodContextOnLeft(true);
}
@SuppressWarnings("all")
- Parameter parameter = Arrays.stream(parameters)
- .filter(p -> !ServiceMethodContext.class.isAssignableFrom(p.getType())).findFirst().get();
+ Parameter parameter =
+ Arrays.stream(parameters)
+ .filter(p -> !ServiceMethodContext.class.isAssignableFrom(p.getType()))
+ .findFirst()
+ .get();
NotImplicit annotation = parameter.getAnnotation(NotImplicit.class);
if (annotation != null) serviceMethod.setAllowImplicit(false);
serviceMethod.setProtocolName(parameter.getType().getName());
@@ -72,9 +76,8 @@ public class DefaultServiceParser implements ServiceParser {
}
/**
- * 标注了@Receiver注解,方法至少一个参数
- * 1个参数:非ServiceMethodContext 子类即可
- * 2个参数 其中一个需要是ServiceMethodContext 的子类 && 2个参数都非ServiceMethodContext 子类即可
+ * 标注了@Receiver注解,方法至少一个参数 1个参数:非ServiceMethodContext 子类即可 2个参数 其中一个需要是ServiceMethodContext 的子类
+ * && 2个参数都非ServiceMethodContext 子类即可
*
* @param method
* @return
@@ -85,12 +88,15 @@ public class DefaultServiceParser implements ServiceParser {
if (method.getParameterCount() == 1) {
return !ServiceMethodContext.class.isAssignableFrom(parameterTypes[0]);
} else if (method.getParameterCount() == 2) {
- boolean hasContext = Arrays.stream(parameterTypes).anyMatch(ServiceMethodContext.class::isAssignableFrom);
- boolean allContext = Arrays.stream(parameterTypes).allMatch(ServiceMethodContext.class::isAssignableFrom);
+ boolean hasContext =
+ Arrays.stream(parameterTypes)
+ .anyMatch(ServiceMethodContext.class::isAssignableFrom);
+ boolean allContext =
+ Arrays.stream(parameterTypes)
+ .allMatch(ServiceMethodContext.class::isAssignableFrom);
return hasContext && !allContext;
}
}
return false;
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ImplicitMethod.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ImplicitMethod.java
index c42f565..7cb8d9c 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ImplicitMethod.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ImplicitMethod.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.parser;
import java.lang.reflect.Method;
-
public class ImplicitMethod {
private Object implicitObject;
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ImplicitParser.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ImplicitParser.java
index 55b04c1..321b775 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ImplicitParser.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ImplicitParser.java
@@ -5,24 +5,22 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.parser;
import java.util.List;
import java.util.Map;
-
public interface ImplicitParser {
Map<String, List<ImplicitMethod>> parse(Object implicitObject);
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ServiceMethod.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ServiceMethod.java
index 4dbbe98..cf35a09 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ServiceMethod.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ServiceMethod.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.parser;
import java.lang.reflect.Method;
-
public class ServiceMethod {
private Object service;
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ServiceParser.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ServiceParser.java
index 47bff66..b17996d 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ServiceParser.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/parser/ServiceParser.java
@@ -5,24 +5,22 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.parser;
import java.util.List;
import java.util.Map;
-
public interface ServiceParser {
Map<String, List<ServiceMethod>> parse(Object service);
-
-}
\ No newline at end of file
+}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/AbstractMessagePublisher.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/AbstractMessagePublisher.java
index c450fd1..93fb289 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/AbstractMessagePublisher.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/AbstractMessagePublisher.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.publisher;
import org.apache.linkis.common.utils.JavaLog;
@@ -28,15 +28,14 @@ import org.apache.linkis.message.parser.ServiceMethod;
import org.apache.linkis.message.scheduler.MethodExecuteWrapper;
import org.apache.linkis.message.utils.MessageUtils;
import org.apache.linkis.protocol.message.RequestProtocol;
-
import org.apache.linkis.rpc.MessageErrorConstants;
+
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import static org.apache.linkis.message.conf.MessageSchedulerConf.CONTEXT_KEY;
-
public abstract class AbstractMessagePublisher extends JavaLog implements MessagePublisher {
private AbstractMessageSchedulerContext context;
@@ -49,11 +48,9 @@ public abstract class AbstractMessagePublisher extends JavaLog implements Messag
this.context = context;
}
- /**
- * key是requestProtocol的全类名,Map中,key是groupName
- */
- private final Map<String, Map<String, List<ServiceMethod>>> protocolServiceMethodCache = new ConcurrentHashMap<>();
-
+ /** key是requestProtocol的全类名,Map中,key是groupName */
+ private final Map<String, Map<String, List<ServiceMethod>>> protocolServiceMethodCache =
+ new ConcurrentHashMap<>();
@Override
public MessageJob publish(RequestProtocol requestProtocol) {
@@ -61,96 +58,137 @@ public abstract class AbstractMessagePublisher extends JavaLog implements Messag
}
@Override
- public MessageJob publish(RequestProtocol requestProtocol, ServiceMethodContext serviceMethodContext) {
+ public MessageJob publish(
+ RequestProtocol requestProtocol, ServiceMethodContext serviceMethodContext) {
logger().debug(String.format("receive request:%s", requestProtocol.getClass().getName()));
serviceMethodContext.putIfAbsent(CONTEXT_KEY, this.context);
- Map<String, List<MethodExecuteWrapper>> methodExecuteWrappers = getMethodExecuteWrappers(requestProtocol);
- MessageJob messageJob = this.context.getJobBuilder().of()
- .with(serviceMethodContext).with(requestProtocol).with(this.context)
- .with(methodExecuteWrappers).build();
+ Map<String, List<MethodExecuteWrapper>> methodExecuteWrappers =
+ getMethodExecuteWrappers(requestProtocol);
+ MessageJob messageJob =
+ this.context
+ .getJobBuilder()
+ .of()
+ .with(serviceMethodContext)
+ .with(requestProtocol)
+ .with(this.context)
+ .with(methodExecuteWrappers)
+ .build();
this.context.getScheduler().submit(messageJob);
return messageJob;
}
- private Map<String, List<MethodExecuteWrapper>> getMethodExecuteWrappers(RequestProtocol requestProtocol) {
+ private Map<String, List<MethodExecuteWrapper>> getMethodExecuteWrappers(
+ RequestProtocol requestProtocol) {
String protocolName = requestProtocol.getClass().getName();
- Map<String, List<ServiceMethod>> protocolServiceMethods = this.protocolServiceMethodCache.get(protocolName);
- //静态信息,无需加锁
+ Map<String, List<ServiceMethod>> protocolServiceMethods =
+ this.protocolServiceMethodCache.get(protocolName);
+ // 静态信息,无需加锁
if (protocolServiceMethods == null) {
- Map<String, List<ServiceMethod>> serviceMethodCache = this.context.getServiceRegistry().getServiceMethodCache();
- Map<String, List<ImplicitMethod>> implicitMethodCache = this.context.getImplicitRegistry().getImplicitMethodCache();
- //找出注册方法中,参数是当前请求的父类的
- Map<String, List<ServiceMethod>> serviceMatchs = serviceMethodCache.entrySet().stream()
- .filter(e -> MessageUtils.isAssignableFrom(e.getKey(), protocolName))
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
- //找出implicit方法中,参数是当前请求父类的,根据注册规则,implicit的出参必然和上面的servicematchKeys 不会重复
+ Map<String, List<ServiceMethod>> serviceMethodCache =
+ this.context.getServiceRegistry().getServiceMethodCache();
+ Map<String, List<ImplicitMethod>> implicitMethodCache =
+ this.context.getImplicitRegistry().getImplicitMethodCache();
+ // 找出注册方法中,参数是当前请求的父类的
+ Map<String, List<ServiceMethod>> serviceMatchs =
+ serviceMethodCache.entrySet().stream()
+ .filter(e -> MessageUtils.isAssignableFrom(e.getKey(), protocolName))
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ // 找出implicit方法中,参数是当前请求父类的,根据注册规则,implicit的出参必然和上面的servicematchKeys 不会重复
Map<String, List<ServiceMethod>> implicitMatchs = new HashMap<>();
- for (Map.Entry<String, List<ImplicitMethod>> implicitEntry : implicitMethodCache.entrySet()) {
- //当前implicitMehtod中,input需要是protocolName 的父类or同类
+ for (Map.Entry<String, List<ImplicitMethod>> implicitEntry :
+ implicitMethodCache.entrySet()) {
+ // 当前implicitMehtod中,input需要是protocolName 的父类or同类
String implicitEntryKey = implicitEntry.getKey();
List<ImplicitMethod> implicitEntryValue = implicitEntry.getValue();
// 支持隐式 返回值 和service之间的接口继承关系
- Map<String, List<ServiceMethod>> implicitServiceMethods = serviceMethodCache.entrySet().stream()
- .filter(e -> MessageUtils.isAssignableFrom(e.getKey(), implicitEntryKey))
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
- //排除implicit返回值是protocolName的父类,可能存在另外一个不相干protocol的转换方法的返回值是当前protocol的父类
- if (!MessageUtils.isAssignableFrom(implicitEntryKey, protocolName) && !implicitServiceMethods.isEmpty()) {
- for (Map.Entry<String, List<ServiceMethod>> implicitServiceMethodEntry : implicitServiceMethods.entrySet()) {
+ Map<String, List<ServiceMethod>> implicitServiceMethods =
+ serviceMethodCache.entrySet().stream()
+ .filter(
+ e ->
+ MessageUtils.isAssignableFrom(
+ e.getKey(), implicitEntryKey))
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ // 排除implicit返回值是protocolName的父类,可能存在另外一个不相干protocol的转换方法的返回值是当前protocol的父类
+ if (!MessageUtils.isAssignableFrom(implicitEntryKey, protocolName)
+ && !implicitServiceMethods.isEmpty()) {
+ for (Map.Entry<String, List<ServiceMethod>> implicitServiceMethodEntry :
+ implicitServiceMethods.entrySet()) {
String implicitServiceMethodEntryKey = implicitServiceMethodEntry.getKey();
- List<ServiceMethod> implicitServiceMethodEntryValue = implicitServiceMethodEntry.getValue();
- //参数中要支持implicit的
- List<ServiceMethod> filteredServiceMethods = implicitServiceMethodEntryValue.stream()
- .filter(ServiceMethod::isAllowImplicit)
- .collect(Collectors.toList());
- //隐式方法中参数需要是当前请求protocol的本类或子类
- List<ImplicitMethod> filteredImplicitMethods = implicitEntryValue.stream()
- .filter(v -> MessageUtils.isAssignableFrom(v.getInput(), protocolName))
- .collect(Collectors.toList());
- if (!filteredServiceMethods.isEmpty() && !filteredImplicitMethods.isEmpty()) {
- //针对每个ServiceMethod 选择,因为可能他们处于不同的service之间
+ List<ServiceMethod> implicitServiceMethodEntryValue =
+ implicitServiceMethodEntry.getValue();
+ // 参数中要支持implicit的
+ List<ServiceMethod> filteredServiceMethods =
+ implicitServiceMethodEntryValue.stream()
+ .filter(ServiceMethod::isAllowImplicit)
+ .collect(Collectors.toList());
+ // 隐式方法中参数需要是当前请求protocol的本类或子类
+ List<ImplicitMethod> filteredImplicitMethods =
+ implicitEntryValue.stream()
+ .filter(
+ v ->
+ MessageUtils.isAssignableFrom(
+ v.getInput(), protocolName))
+ .collect(Collectors.toList());
+ if (!filteredServiceMethods.isEmpty()
+ && !filteredImplicitMethods.isEmpty()) {
+ // 针对每个ServiceMethod 选择,因为可能他们处于不同的service之间
for (ServiceMethod filteredServiceMethod : filteredServiceMethods) {
Object service = filteredServiceMethod.getService();
- //同service优先
- Optional<ImplicitMethod> first = filteredImplicitMethods.stream()
- .filter(m -> m.getImplicitObject() == service).findFirst();
+ // 同service优先
+ Optional<ImplicitMethod> first =
+ filteredImplicitMethods.stream()
+ .filter(m -> m.getImplicitObject() == service)
+ .findFirst();
if (first.isPresent()) {
filteredServiceMethod.setImplicitMethod(first.get());
} else {
// TODO: 2020/7/30 入参父子类的判断优先级,和scala一致
- //简单的只取第一个
- filteredServiceMethod.setImplicitMethod(filteredImplicitMethods.get(0));
+ // 简单的只取第一个
+ filteredServiceMethod.setImplicitMethod(
+ filteredImplicitMethods.get(0));
}
}
- //添加到缓存中
- implicitMatchs.put(implicitServiceMethodEntryKey, filteredServiceMethods);
+ // 添加到缓存中
+ implicitMatchs.put(
+ implicitServiceMethodEntryKey, filteredServiceMethods);
}
}
}
}
- //merge
+ // merge
serviceMatchs.putAll(implicitMatchs);
- //group by chain name 扁平化后再group,这时protocol的父类可能和转换的处于同一个chain中
- serviceMatchs = serviceMatchs.values().stream().flatMap(Collection::stream).collect(Collectors.groupingBy(ServiceMethod::getChainName));
- //order判断
+ // group by chain name 扁平化后再group,这时protocol的父类可能和转换的处于同一个chain中
+ serviceMatchs =
+ serviceMatchs.values().stream()
+ .flatMap(Collection::stream)
+ .collect(Collectors.groupingBy(ServiceMethod::getChainName));
+ // order判断
for (List<ServiceMethod> value : serviceMatchs.values()) {
Integer repeatOrder = MessageUtils.repeatOrder(value);
if (repeatOrder != null && !MessageUtils.orderIsLast(repeatOrder, value)) {
- throw new MessageWarnException(MessageErrorConstants.MESSAGE_ERROR(),
- String.format("repeat "
- + "order : %s for request %s", repeatOrder, protocolName));
+ throw new MessageWarnException(
+ MessageErrorConstants.MESSAGE_ERROR(),
+ String.format(
+ "repeat " + "order : %s for request %s",
+ repeatOrder, protocolName));
}
}
this.protocolServiceMethodCache.put(protocolName, serviceMatchs);
}
- //clone 对象并返回
+ // clone 对象并返回
return serviceMethod2Wrapper(this.protocolServiceMethodCache.get(protocolName));
}
- private Map<String, List<MethodExecuteWrapper>> serviceMethod2Wrapper(Map<String, List<ServiceMethod>> source) {
+ private Map<String, List<MethodExecuteWrapper>> serviceMethod2Wrapper(
+ Map<String, List<ServiceMethod>> source) {
HashMap<String, List<MethodExecuteWrapper>> target = new HashMap<>();
- source.forEach((k, v) -> target.put(k, v.stream().map(MethodExecuteWrapper::new).collect(Collectors.toList())));
+ source.forEach(
+ (k, v) ->
+ target.put(
+ k,
+ v.stream()
+ .map(MethodExecuteWrapper::new)
+ .collect(Collectors.toList())));
return target;
}
-
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/DefaultMessagePublisher.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/DefaultMessagePublisher.java
index dc157ba..8b6f993 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/DefaultMessagePublisher.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/DefaultMessagePublisher.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.publisher;
import org.apache.linkis.message.context.AbstractMessageSchedulerContext;
-
public class DefaultMessagePublisher extends AbstractMessagePublisher {
public DefaultMessagePublisher(AbstractMessageSchedulerContext context) {
@@ -29,5 +28,4 @@ public class DefaultMessagePublisher extends AbstractMessagePublisher {
public DefaultMessagePublisher() {
this(null);
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/MessagePublisher.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/MessagePublisher.java
index 57c75f7..a61b70a 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/MessagePublisher.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/publisher/MessagePublisher.java
@@ -5,28 +5,25 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.publisher;
import org.apache.linkis.message.builder.MessageJob;
import org.apache.linkis.message.builder.ServiceMethodContext;
import org.apache.linkis.protocol.message.RequestProtocol;
-
-
public interface MessagePublisher {
MessageJob publish(RequestProtocol requestProtocol);
MessageJob publish(RequestProtocol requestProtocol, ServiceMethodContext serviceMethodContext);
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/AbstractImplicitRegistry.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/AbstractImplicitRegistry.java
index 457d181..a0fce6c 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/AbstractImplicitRegistry.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/AbstractImplicitRegistry.java
@@ -5,36 +5,34 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.registry;
-import com.google.common.collect.Interner;
-import com.google.common.collect.Interners;
import org.apache.linkis.common.utils.JavaLog;
import org.apache.linkis.message.context.AbstractMessageSchedulerContext;
import org.apache.linkis.message.parser.ImplicitMethod;
+import com.google.common.collect.Interner;
+import com.google.common.collect.Interners;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-
public abstract class AbstractImplicitRegistry extends JavaLog implements ImplicitRegistry {
private final AbstractMessageSchedulerContext context;
- /**
- * key: output
- */
+ /** key: output */
private final Map<String, List<ImplicitMethod>> implicitMethodCache = new ConcurrentHashMap<>();
public AbstractImplicitRegistry(AbstractMessageSchedulerContext context) {
@@ -46,16 +44,16 @@ public abstract class AbstractImplicitRegistry extends JavaLog implements Implic
private final Map<String, Object> registedImplicitObjectMap = new ConcurrentHashMap<>();
-
@Override
@SuppressWarnings("all")
public void register(Object implicitObject) {
String implicitObjectName = implicitObject.getClass().getName();
synchronized (this.lock.intern(implicitObjectName)) {
- //1.是否解析过
+ // 1.是否解析过
Object o = this.registedImplicitObjectMap.get(implicitObjectName);
if (o != null) return;
- Map<String, List<ImplicitMethod>> implicitMethods = this.context.getImplicitParser().parse(implicitObject);
+ Map<String, List<ImplicitMethod>> implicitMethods =
+ this.context.getImplicitParser().parse(implicitObject);
implicitMethods.forEach(this::refreshImplicitMethodCache);
this.registedImplicitObjectMap.put(implicitObjectName, implicitObject);
}
@@ -64,8 +62,9 @@ public abstract class AbstractImplicitRegistry extends JavaLog implements Implic
@SuppressWarnings("all")
private void refreshImplicitMethodCache(String key, List<ImplicitMethod> implicitMethods) {
synchronized (this.lock.intern(key)) {
- //同一个implicitObject 下的入参,出参相同的implit,会被过滤掉
- List<ImplicitMethod> implicitMethodsOld = this.implicitMethodCache.computeIfAbsent(key, k -> new ArrayList<>());
+ // 同一个implicitObject 下的入参,出参相同的implit,会被过滤掉
+ List<ImplicitMethod> implicitMethodsOld =
+ this.implicitMethodCache.computeIfAbsent(key, k -> new ArrayList<>());
for (ImplicitMethod implicitMethod : implicitMethods) {
if (isImplicitRepeat(new ArrayList<>(implicitMethodsOld), implicitMethod)) {
// TODO: 2020/7/29 logging
@@ -76,9 +75,13 @@ public abstract class AbstractImplicitRegistry extends JavaLog implements Implic
}
}
- private boolean isImplicitRepeat(List<ImplicitMethod> implicitMethodsOld, ImplicitMethod implicitMethod) {
- return implicitMethodsOld.stream().
- anyMatch(im -> im.getImplicitObject() == implicitMethod.getImplicitObject() && im.getInput().equals(implicitMethod.getInput()));
+ private boolean isImplicitRepeat(
+ List<ImplicitMethod> implicitMethodsOld, ImplicitMethod implicitMethod) {
+ return implicitMethodsOld.stream()
+ .anyMatch(
+ im ->
+ im.getImplicitObject() == implicitMethod.getImplicitObject()
+ && im.getInput().equals(implicitMethod.getInput()));
}
public Map<String, List<ImplicitMethod>> getImplicitMethodCache() {
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/AbstractServiceRegistry.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/AbstractServiceRegistry.java
index 9290823..f364cc2 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/AbstractServiceRegistry.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/AbstractServiceRegistry.java
@@ -5,40 +5,39 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.registry;
-import com.google.common.collect.Interner;
-import com.google.common.collect.Interners;
import org.apache.linkis.common.utils.JavaLog;
import org.apache.linkis.message.context.AbstractMessageSchedulerContext;
import org.apache.linkis.message.exception.MessageWarnException;
import org.apache.linkis.message.parser.ServiceMethod;
import org.apache.linkis.message.parser.ServiceParser;
+
import org.springframework.aop.support.AopUtils;
+import com.google.common.collect.Interner;
+import com.google.common.collect.Interners;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-
public abstract class AbstractServiceRegistry extends JavaLog implements ServiceRegistry {
@SuppressWarnings("all")
public final Interner<String> lock = Interners.<String>newWeakInterner();
- /**
- * key:requestprotocol or custom implicit object class name
- */
+ /** key:requestprotocol or custom implicit object class name */
private final Map<String, List<ServiceMethod>> serviceMethodCache = new ConcurrentHashMap<>();
private final Map<String, Object> registedServieMap = new ConcurrentHashMap<>();
@@ -54,13 +53,13 @@ public abstract class AbstractServiceRegistry extends JavaLog implements Service
public void register(Object service) {
String serviceName = AopUtils.getTargetClass(service).getName();
synchronized (this.lock.intern(serviceName)) {
- //1.是否注册过
+ // 1.是否注册过
Object o = this.registedServieMap.get(serviceName);
if (o != null) return;
- //2..解析
+ // 2..解析
ServiceParser serviceParser = this.context.getservieParser();
Map<String, List<ServiceMethod>> serviceMethods = serviceParser.parse(service);
- //3.注册
+ // 3.注册
serviceMethods.forEach(this::register);
this.registedServieMap.put(serviceName, service);
}
@@ -73,9 +72,9 @@ public abstract class AbstractServiceRegistry extends JavaLog implements Service
*/
@SuppressWarnings("all")
private void register(String key, List<ServiceMethod> serviceMethods) {
- //防止相同key在不同service的并发注册
+ // 防止相同key在不同service的并发注册
synchronized (this.lock.intern(key)) {
- //1.添加cache
+ // 1.添加cache
refreshServiceMethodCache(key, serviceMethods);
}
}
@@ -87,5 +86,4 @@ public abstract class AbstractServiceRegistry extends JavaLog implements Service
public Map<String, List<ServiceMethod>> getServiceMethodCache() {
return this.serviceMethodCache;
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/ImplicitRegistry.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/ImplicitRegistry.java
index e017ba0..bfee15b 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/ImplicitRegistry.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/ImplicitRegistry.java
@@ -5,21 +5,19 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message.registry;
+package org.apache.linkis.message.registry;
public interface ImplicitRegistry {
void register(Object implicitObject);
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/ServiceRegistry.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/ServiceRegistry.java
index d31069d..f5d2d68 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/ServiceRegistry.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/ServiceRegistry.java
@@ -5,21 +5,19 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message.registry;
+package org.apache.linkis.message.registry;
public interface ServiceRegistry {
void register(Object service);
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/SpringImplicitRegistry.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/SpringImplicitRegistry.java
index af9e102..644fb54 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/SpringImplicitRegistry.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/SpringImplicitRegistry.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message.registry;
+package org.apache.linkis.message.registry;
import org.apache.linkis.message.annotation.Implicit;
import org.apache.linkis.message.context.AbstractMessageSchedulerContext;
@@ -28,21 +27,24 @@ import java.util.stream.Collectors;
import static org.apache.linkis.message.conf.MessageSchedulerConf.REFLECTIONS;
-
public class SpringImplicitRegistry extends AbstractImplicitRegistry {
public SpringImplicitRegistry(AbstractMessageSchedulerContext context) {
super(context);
Set<Method> implicitMethods = REFLECTIONS.getMethodsAnnotatedWith(Implicit.class);
- Set<? extends Class<?>> implicitClasses = implicitMethods.stream().map(Method::getDeclaringClass).collect(Collectors.toSet());
- //区分出 bean中的方法,和其他,其他使用反射创建方法对象
+ Set<? extends Class<?>> implicitClasses =
+ implicitMethods.stream().map(Method::getDeclaringClass).collect(Collectors.toSet());
+ // 区分出 bean中的方法,和其他,其他使用反射创建方法对象
for (Class<?> implicitClass : implicitClasses) {
Object bean = MessageUtils.getBean(implicitClass);
if (bean == null) {
try {
bean = implicitClass.newInstance();
} catch (Throwable t) {
- logger().warn(String.format("reflection failed to create object %s", implicitClass.getName()));
+ logger().warn(
+ String.format(
+ "reflection failed to create object %s",
+ implicitClass.getName()));
}
}
if (bean != null) this.register(bean);
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/SpringServiceRegistry.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/SpringServiceRegistry.java
index 4ed12cd..fbf72f1 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/SpringServiceRegistry.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/registry/SpringServiceRegistry.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.registry;
import org.apache.linkis.message.annotation.Receiver;
@@ -28,14 +28,17 @@ import java.util.stream.Collectors;
import static org.apache.linkis.message.conf.MessageSchedulerConf.REFLECTIONS;
-
public class SpringServiceRegistry extends AbstractServiceRegistry {
public SpringServiceRegistry(AbstractMessageSchedulerContext context) {
super(context);
- Set<? extends Class<?>> services = REFLECTIONS.getMethodsAnnotatedWith(Receiver.class).stream()
- .map(Method::getDeclaringClass).collect(Collectors.toSet());
- services.stream().map(MessageUtils::getBean).filter(Objects::nonNull).forEach(this::register);
+ Set<? extends Class<?>> services =
+ REFLECTIONS.getMethodsAnnotatedWith(Receiver.class).stream()
+ .map(Method::getDeclaringClass)
+ .collect(Collectors.toSet());
+ services.stream()
+ .map(MessageUtils::getBean)
+ .filter(Objects::nonNull)
+ .forEach(this::register);
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/AbstractMessageExecutor.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/AbstractMessageExecutor.java
index 6b1454e..29e3758 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/AbstractMessageExecutor.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/AbstractMessageExecutor.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.scheduler;
import org.apache.linkis.common.utils.JavaLog;
@@ -35,7 +35,6 @@ import java.util.Map;
import java.util.concurrent.*;
import java.util.stream.Collectors;
-
public abstract class AbstractMessageExecutor extends JavaLog implements MessageExecutor {
private Throwable t;
@@ -49,18 +48,25 @@ public abstract class AbstractMessageExecutor extends JavaLog implements Message
}
}
- private List<MethodExecuteWrapper> getMinOrderMethodWrapper(Map<String, List<MethodExecuteWrapper>> methodWrappers) {
- //获取所有key中order最小的
+ private List<MethodExecuteWrapper> getMinOrderMethodWrapper(
+ Map<String, List<MethodExecuteWrapper>> methodWrappers) {
+ // 获取所有key中order最小的
List<MethodExecuteWrapper> minOrderMethodWrapper = new ArrayList<>();
- methodWrappers.forEach((k, v) -> v.forEach(m -> {
- if (MessageUtils.orderIsMin(m, v)) minOrderMethodWrapper.add(m);
- }));
+ methodWrappers.forEach(
+ (k, v) ->
+ v.forEach(
+ m -> {
+ if (MessageUtils.orderIsMin(m, v)) minOrderMethodWrapper.add(m);
+ }));
return minOrderMethodWrapper;
}
- private List<MethodExecuteWrapper> getMinOrderMethodWrapper(List<MethodExecuteWrapper> methodWrappers) {
- //获取单个key中order最小的,一般是一个,尾链可能有多个
- return methodWrappers.stream().filter(m -> MessageUtils.orderIsMin(m, methodWrappers)).collect(Collectors.toList());
+ private List<MethodExecuteWrapper> getMinOrderMethodWrapper(
+ List<MethodExecuteWrapper> methodWrappers) {
+ // 获取单个key中order最小的,一般是一个,尾链可能有多个
+ return methodWrappers.stream()
+ .filter(m -> MessageUtils.orderIsMin(m, methodWrappers))
+ .collect(Collectors.toList());
}
private boolean shouldBreak(Map<String, List<MethodExecuteWrapper>> methodWrappers) {
@@ -91,7 +97,7 @@ public abstract class AbstractMessageExecutor extends JavaLog implements Message
}
}
- private void runMultipleJob(MessageJob job) throws InterruptedException {
+ private void runMultipleJob(MessageJob job) throws InterruptedException {
RequestProtocol requestProtocol = job.getRequestProtocol();
ServiceMethodContext methodContext = job.getMethodContext();
// TODO: 2020/7/22 data structure optimization of variable methodWrappers
@@ -109,50 +115,85 @@ public abstract class AbstractMessageExecutor extends JavaLog implements Message
MethodExecuteWrapper methodWrapper = queue.poll(10, TimeUnit.MILLISECONDS);
if (methodWrapper == null) continue;
methodWrappers.get(methodWrapper.getChainName()).remove(methodWrapper);
- Future<?> methodFuture = getExecutorService().submit(() -> {
- Object result = null;
- try {
- // TODO: 2020/7/31 判断逻辑挪走
- if (!methodWrapper.shouldSkip) {
- //放置job状态
- setMethodContextThreadLocal(methodContext, job);
- Method method = methodWrapper.getMethod();
- Object service = methodWrapper.getService();
- info(String.format("message scheduler executor ===> service: %s,method: %s", service.getClass().getName(), method.getName()));
- Object implicit;
- // TODO: 2020/8/4 implicit 的结果应该复用下
- ImplicitMethod implicitMethod = methodWrapper.getImplicitMethod();
- if (implicitMethod != null) {
- implicit = implicitMethod.getMethod().invoke(implicitMethod.getImplicitObject(), requestProtocol);
- } else {
- implicit = requestProtocol;
- }
- if (methodWrapper.isHasMethodContext()) {
- if (methodWrapper.isMethodContextOnLeft()) {
- result = method.invoke(service, methodContext, implicit);
- } else {
- result = method.invoke(service, implicit, methodContext);
- }
- } else {
- result = method.invoke(service, implicit);
- }
- // TODO: 2020/8/5 执行完成后判断service是否有主动skip的逻辑
- }
- } catch (Throwable t) {
- logger().error(String.format("method %s call failed", methodWrapper.getAlias()), t);
- methodWrappers.forEach((k, v) -> v.forEach(m -> m.setShouldSkip(true)));
- methodErrorHandle(t);
- } finally {
- if (result != null) {
- methodContext.setResult(result);
- }
- //末链并发的时候,小概率可能会有重复的method被offer到queue中,但是在poll前循环就break了,无影响
- getMinOrderMethodWrapper(methodWrappers.get(methodWrapper.getChainName())).forEach(queue::offer);
- //移除state和skips的状态
- cleanMethodContextThreadLocal(methodContext);
- countDownLatch.countDown();
- }
- });
+ Future<?> methodFuture =
+ getExecutorService()
+ .submit(
+ () -> {
+ Object result = null;
+ try {
+ // TODO: 2020/7/31 判断逻辑挪走
+ if (!methodWrapper.shouldSkip) {
+ // 放置job状态
+ setMethodContextThreadLocal(methodContext, job);
+ Method method = methodWrapper.getMethod();
+ Object service = methodWrapper.getService();
+ info(
+ String.format(
+ "message scheduler executor ===> service: %s,method: %s",
+ service.getClass().getName(),
+ method.getName()));
+ Object implicit;
+ // TODO: 2020/8/4 implicit 的结果应该复用下
+ ImplicitMethod implicitMethod =
+ methodWrapper.getImplicitMethod();
+ if (implicitMethod != null) {
+ implicit =
+ implicitMethod
+ .getMethod()
+ .invoke(
+ implicitMethod
+ .getImplicitObject(),
+ requestProtocol);
+ } else {
+ implicit = requestProtocol;
+ }
+ if (methodWrapper.isHasMethodContext()) {
+ if (methodWrapper.isMethodContextOnLeft()) {
+ result =
+ method.invoke(
+ service,
+ methodContext,
+ implicit);
+ } else {
+ result =
+ method.invoke(
+ service,
+ implicit,
+ methodContext);
+ }
+ } else {
+ result = method.invoke(service, implicit);
+ }
+ // TODO: 2020/8/5 执行完成后判断service是否有主动skip的逻辑
+ }
+ } catch (Throwable t) {
+ logger().error(
+ String.format(
+ "method %s call failed",
+ methodWrapper.getAlias()),
+ t);
+ methodWrappers.forEach(
+ (k, v) ->
+ v.forEach(
+ m ->
+ m.setShouldSkip(
+ true)));
+ methodErrorHandle(t);
+ } finally {
+ if (result != null) {
+ methodContext.setResult(result);
+ }
+ // 末链并发的时候,小概率可能会有重复的method被offer到queue中,但是在poll前循环就break了,无影响
+ getMinOrderMethodWrapper(
+ methodWrappers.get(
+ methodWrapper
+ .getChainName()))
+ .forEach(queue::offer);
+ // 移除state和skips的状态
+ cleanMethodContextThreadLocal(methodContext);
+ countDownLatch.countDown();
+ }
+ });
methodFutures.add(methodFuture);
}
countDownLatch.await();
@@ -161,7 +202,8 @@ public abstract class AbstractMessageExecutor extends JavaLog implements Message
throw ie;
}
if (this.t != null) {
- throw new MessageWarnException(MessageErrorConstants.MESSAGE_ERROR(), "method call failed", t);
+ throw new MessageWarnException(
+ MessageErrorConstants.MESSAGE_ERROR(), "method call failed", t);
}
}
@@ -175,15 +217,23 @@ public abstract class AbstractMessageExecutor extends JavaLog implements Message
Object result = null;
try {
if (!methodWrapper.shouldSkip) {
- //放置job状态
+ // 放置job状态
setMethodContextThreadLocal(methodContext, job);
Method method = methodWrapper.getMethod();
Object service = methodWrapper.getService();
- logger().info(String.format("message scheduler executor ===> service: %s,method: %s", service.getClass().getName(), method.getName()));
+ logger().info(
+ String.format(
+ "message scheduler executor ===> service: %s,method: %s",
+ service.getClass().getName(), method.getName()));
Object implicit;
ImplicitMethod implicitMethod = methodWrapper.getImplicitMethod();
if (implicitMethod != null) {
- implicit = implicitMethod.getMethod().invoke(implicitMethod.getImplicitObject(), requestProtocol);
+ implicit =
+ implicitMethod
+ .getMethod()
+ .invoke(
+ implicitMethod.getImplicitObject(),
+ requestProtocol);
} else {
implicit = requestProtocol;
}
@@ -211,5 +261,4 @@ public abstract class AbstractMessageExecutor extends JavaLog implements Message
throw new MessageWarnException(10000, "method call failed", t);
}
}
-
-}
\ No newline at end of file
+}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/DefaultMessageExecutor.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/DefaultMessageExecutor.java
index 14dd03d..929a0fc8 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/DefaultMessageExecutor.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/DefaultMessageExecutor.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.scheduler;
import org.apache.linkis.message.builder.MessageJob;
import org.apache.linkis.message.exception.MessageWarnException;
-import org.apache.linkis.message.tx.TransactionManager;
import org.apache.linkis.protocol.engine.EngineState;
import org.apache.linkis.rpc.MessageErrorConstants;
import org.apache.linkis.scheduler.executer.*;
@@ -28,7 +27,6 @@ import org.apache.linkis.scheduler.queue.SchedulerEvent;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
-
public class DefaultMessageExecutor extends AbstractMessageExecutor implements Executor {
private final ExecutorService executorService;
@@ -57,33 +55,34 @@ public class DefaultMessageExecutor extends AbstractMessageExecutor implements E
@Override
public ExecuteResponse execute(ExecuteRequest executeRequest) {
if (event instanceof MessageJob) {
-// TransactionManager txManager = ((MessageJob) event).getContext().getTxManager();
-// Object o = txManager.begin();
+ // TransactionManager txManager = ((MessageJob)
+ // event).getContext().getTxManager();
+ // Object o = txManager.begin();
try {
run((MessageJob) event);
- //txManager.commit(o);
+ // txManager.commit(o);
return new SuccessExecuteResponse();
} catch (InterruptedException ie) {
- //handle InterruptedException
+ // handle InterruptedException
logger().error("message job execution interrupted", ie);
- // txManager.rollback(o);
+ // txManager.rollback(o);
return new ErrorExecuteResponse("message job execution interrupted", ie);
} catch (MessageWarnException mwe) {
- //handle method call failed
+ // handle method call failed
logger().error("method call normal error return");
- // txManager.rollback(o);
+ // txManager.rollback(o);
return new ErrorExecuteResponse("method call failed", mwe);
} catch (Throwable t) {
logger().debug("unexpected error occur", t);
- //txManager.rollback(o);
+ // txManager.rollback(o);
return new ErrorExecuteResponse("unexpected error", t);
}
}
- MessageWarnException eventNotMatchError = new MessageWarnException(MessageErrorConstants.MESSAGE_ERROR()
- , "event is "
- + "not instance of MessageJob");
+ MessageWarnException eventNotMatchError =
+ new MessageWarnException(
+ MessageErrorConstants.MESSAGE_ERROR(),
+ "event is " + "not instance of MessageJob");
return new ErrorExecuteResponse("event is not instance of MessageJob", eventNotMatchError);
-
}
@Override
@@ -96,11 +95,6 @@ public class DefaultMessageExecutor extends AbstractMessageExecutor implements E
return new ExecutorInfo(0, null);
}
-
-
-
@Override
- public void close() throws IOException {
-
- }
+ public void close() throws IOException {}
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/DefaultMessageScheduler.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/DefaultMessageScheduler.java
index b32db03..56c74ea 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/DefaultMessageScheduler.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/DefaultMessageScheduler.java
@@ -5,22 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message.scheduler;
-import static org.apache.linkis.message.conf.MessageSchedulerConf.MAX_PARALLELISM_CONSUMERS;
-import static org.apache.linkis.message.conf.MessageSchedulerConf.MAX_PARALLELISM_USER;
-import static org.apache.linkis.message.conf.MessageSchedulerConf.MAX_QUEUE_CAPACITY;
-import static org.apache.linkis.message.conf.MessageSchedulerConf.MAX_RUNNING_JOB;
+package org.apache.linkis.message.scheduler;
import org.apache.linkis.message.builder.MessageJob;
import org.apache.linkis.message.builder.MessageJobListener;
@@ -32,6 +27,10 @@ import org.apache.linkis.scheduler.queue.parallelqueue.ParallelConsumerManager;
import org.apache.linkis.scheduler.queue.parallelqueue.ParallelScheduler;
import org.apache.linkis.scheduler.queue.parallelqueue.ParallelSchedulerContextImpl;
+import static org.apache.linkis.message.conf.MessageSchedulerConf.MAX_PARALLELISM_CONSUMERS;
+import static org.apache.linkis.message.conf.MessageSchedulerConf.MAX_PARALLELISM_USER;
+import static org.apache.linkis.message.conf.MessageSchedulerConf.MAX_QUEUE_CAPACITY;
+import static org.apache.linkis.message.conf.MessageSchedulerConf.MAX_RUNNING_JOB;
public class DefaultMessageScheduler implements MessageScheduler {
@@ -49,17 +48,21 @@ public class DefaultMessageScheduler implements MessageScheduler {
this(null);
}
- public DefaultMessageScheduler(GroupFactory groupFactory){
- ParallelSchedulerContextImpl schedulerContext = new ParallelSchedulerContextImpl(MAX_PARALLELISM_USER);
- ParallelConsumerManager parallelConsumerManager = new ParallelConsumerManager(MAX_PARALLELISM_CONSUMERS, "RpcMessageScheduler");
+ public DefaultMessageScheduler(GroupFactory groupFactory) {
+ ParallelSchedulerContextImpl schedulerContext =
+ new ParallelSchedulerContextImpl(MAX_PARALLELISM_USER);
+ ParallelConsumerManager parallelConsumerManager =
+ new ParallelConsumerManager(MAX_PARALLELISM_CONSUMERS, "RpcMessageScheduler");
schedulerContext.setConsumerManager(parallelConsumerManager);
- MessageExecutorExecutionManager messageExecutorExecutionManager = new MessageExecutorExecutionManager(parallelConsumerManager.getOrCreateExecutorService());
+ MessageExecutorExecutionManager messageExecutorExecutionManager =
+ new MessageExecutorExecutionManager(
+ parallelConsumerManager.getOrCreateExecutorService());
schedulerContext.setExecutorManager(messageExecutorExecutionManager);
- if(groupFactory != null) {
+ if (groupFactory != null) {
schedulerContext.setGroupFactory(groupFactory);
} else {
groupFactory = schedulerContext.getOrCreateGroupFactory();
- if(groupFactory instanceof FIFOGroupFactory) {
+ if (groupFactory instanceof FIFOGroupFactory) {
FIFOGroupFactory fifoGroupFactory = (FIFOGroupFactory) groupFactory;
fifoGroupFactory.setDefaultMaxRunningJobs(MAX_RUNNING_JOB);
fifoGroupFactory.setDefaultMaxAskExecutorTimes(MAX_ASK_EXECUTOR_TIMES);
@@ -83,6 +86,4 @@ public class DefaultMessageScheduler implements MessageScheduler {
linkisScheduler.submit((Job) messageJob);
}
}
-
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageExecutor.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageExecutor.java
index e87dd91..7131466 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageExecutor.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageExecutor.java
@@ -5,28 +5,25 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.scheduler;
import org.apache.linkis.message.builder.MessageJob;
import java.util.concurrent.ExecutorService;
-
public interface MessageExecutor {
void run(MessageJob job) throws InterruptedException;
ExecutorService getExecutorService();
-
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageExecutorExecutionManager.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageExecutorExecutionManager.java
index f771d6c..5cc3ffc 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageExecutorExecutionManager.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageExecutorExecutionManager.java
@@ -5,46 +5,41 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.scheduler;
-import org.apache.linkis.common.utils.Utils;
import org.apache.linkis.scheduler.executer.Executor;
import org.apache.linkis.scheduler.executer.ExecutorManager;
import org.apache.linkis.scheduler.listener.ExecutorListener;
import org.apache.linkis.scheduler.queue.SchedulerEvent;
-import scala.Option;
-import scala.Some;
-import scala.concurrent.duration.Duration;
import java.util.concurrent.ExecutorService;
+import scala.Option;
+import scala.Some;
+import scala.concurrent.duration.Duration;
public class MessageExecutorExecutionManager extends ExecutorManager {
- private ExecutorService executorService = null;
+ private ExecutorService executorService = null;
- public MessageExecutorExecutionManager(){
-
- }
+ public MessageExecutorExecutionManager() {}
public MessageExecutorExecutionManager(ExecutorService executorService) {
this.executorService = executorService;
}
@Override
- public void setExecutorListener(ExecutorListener executorListener) {
-
- }
+ public void setExecutorListener(ExecutorListener executorListener) {}
@Override
public Executor createExecutor(SchedulerEvent event) {
@@ -72,12 +67,8 @@ public class MessageExecutorExecutionManager extends ExecutorManager {
}
@Override
- public void delete(Executor executor) {
-
- }
+ public void delete(Executor executor) {}
@Override
- public void shutdown() {
-
- }
+ public void shutdown() {}
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageScheduler.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageScheduler.java
index 8386408..bf074f8 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageScheduler.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MessageScheduler.java
@@ -5,23 +5,21 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.scheduler;
import org.apache.linkis.message.builder.MessageJob;
-
public interface MessageScheduler {
void submit(MessageJob messageJob);
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MethodExecuteWrapper.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MethodExecuteWrapper.java
index 9b11595..1c7ebee 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MethodExecuteWrapper.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/scheduler/MethodExecuteWrapper.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.scheduler;
import org.apache.linkis.message.parser.ImplicitMethod;
@@ -22,7 +22,6 @@ import org.apache.linkis.message.parser.ServiceMethod;
import java.lang.reflect.Method;
-
public class MethodExecuteWrapper {
public MethodExecuteWrapper(ServiceMethod serviceMethod) {
@@ -49,7 +48,6 @@ public class MethodExecuteWrapper {
return this.serviceMethod.getService();
}
-
public String getAlias() {
return this.serviceMethod.getAlias();
}
@@ -73,5 +71,4 @@ public class MethodExecuteWrapper {
public boolean isMethodContextOnLeft() {
return this.serviceMethod.isMethodContextOnLeft();
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/tx/SpringTransactionManager.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/tx/SpringTransactionManager.java
index 6a2114d..a4336ce 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/tx/SpringTransactionManager.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/tx/SpringTransactionManager.java
@@ -5,25 +5,25 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.tx;
import org.apache.linkis.common.utils.JavaLog;
import org.apache.linkis.message.utils.MessageUtils;
+
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
-
public class SpringTransactionManager extends JavaLog implements TransactionManager {
private final PlatformTransactionManager platformTransactionManager;
@@ -32,7 +32,6 @@ public class SpringTransactionManager extends JavaLog implements TransactionMana
platformTransactionManager = MessageUtils.getBean(PlatformTransactionManager.class);
}
-
@Override
public Object begin() {
if (platformTransactionManager != null) {
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/tx/TransactionManager.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/tx/TransactionManager.java
index c62fe0d..a90d842 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/tx/TransactionManager.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/tx/TransactionManager.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message.tx;
+package org.apache.linkis.message.tx;
public interface TransactionManager {
@@ -24,10 +23,7 @@ public interface TransactionManager {
return null;
}
- default void commit(Object o) {
- }
-
- default void rollback(Object o) {
- }
+ default void commit(Object o) {}
+ default void rollback(Object o) {}
}
diff --git a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/utils/MessageUtils.java b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/utils/MessageUtils.java
index 0c6e883..62d5590 100644
--- a/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/utils/MessageUtils.java
+++ b/linkis-commons/linkis-message-scheduler/src/main/java/org/apache/linkis/message/utils/MessageUtils.java
@@ -5,31 +5,32 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message.utils;
import org.apache.linkis.DataWorkCloudApplication;
import org.apache.linkis.message.parser.ServiceMethod;
import org.apache.linkis.message.scheduler.MethodExecuteWrapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
public class MessageUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(MessageUtils.class);
@@ -56,7 +57,9 @@ public class MessageUtils {
}
}
- public static boolean orderIsMin(MethodExecuteWrapper methodExecuteWrapper, List<MethodExecuteWrapper> methodExecuteWrappers) {
+ public static boolean orderIsMin(
+ MethodExecuteWrapper methodExecuteWrapper,
+ List<MethodExecuteWrapper> methodExecuteWrappers) {
for (MethodExecuteWrapper tmp : methodExecuteWrappers) {
if (tmp.getOrder() < methodExecuteWrapper.getOrder()) {
return false;
@@ -88,5 +91,4 @@ public class MessageUtils {
}
return null;
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/DefaultRequestProtocol.java b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/DefaultRequestProtocol.java
index 8379784..7086558 100644
--- a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/DefaultRequestProtocol.java
+++ b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/DefaultRequestProtocol.java
@@ -5,23 +5,19 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message;
+package org.apache.linkis.message;
import org.apache.linkis.protocol.message.RequestProtocol;
-/**
- * @date 2020/7/14
- */
-public class DefaultRequestProtocol implements RequestProtocol {
-}
+/** @date 2020/7/14 */
+public class DefaultRequestProtocol implements RequestProtocol {}
diff --git a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitInterface.java b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitInterface.java
index 49fde0b..63efdc7 100644
--- a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitInterface.java
+++ b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitInterface.java
@@ -5,21 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.message;
+package org.apache.linkis.message;
-/**
- * @date 2020/7/22
- */
-public interface ImplicitInterface {
-}
+/** @date 2020/7/22 */
+public interface ImplicitInterface {}
diff --git a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitInterfaceImpl.java b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitInterfaceImpl.java
index dfc1e3c..195cd16 100644
--- a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitInterfaceImpl.java
+++ b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitInterfaceImpl.java
@@ -5,20 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message;
-/**
- * @date 2020/7/30
- */
-public class ImplicitInterfaceImpl implements ImplicitInterface {
-}
+/** @date 2020/7/30 */
+public class ImplicitInterfaceImpl implements ImplicitInterface {}
diff --git a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitObject.java b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitObject.java
index 923afa4..5b052b3 100644
--- a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitObject.java
+++ b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/ImplicitObject.java
@@ -5,23 +5,21 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message;
import org.apache.linkis.message.annotation.Implicit;
-/**
- * @date 2020/7/29
- */
+/** @date 2020/7/29 */
public class ImplicitObject {
@Implicit
diff --git a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/SchedulerMessageTest.java b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/SchedulerMessageTest.java
index b8c32c5..98b9e66 100644
--- a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/SchedulerMessageTest.java
+++ b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/SchedulerMessageTest.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message;
import org.apache.linkis.message.annotation.Receiver;
@@ -27,6 +27,7 @@ import org.apache.linkis.message.parser.ServiceMethod;
import org.apache.linkis.message.registry.AbstractImplicitRegistry;
import org.apache.linkis.message.registry.AbstractServiceRegistry;
import org.apache.linkis.protocol.message.RequestProtocol;
+
import org.junit.Before;
import org.junit.Test;
import org.reflections.Reflections;
@@ -40,14 +41,14 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
-/**
- * @date 2020/7/14
- */
+/** @date 2020/7/14 */
public class SchedulerMessageTest {
private AbstractMessageSchedulerContext context;
- Reflections reflections = new Reflections(MessageSchedulerConf.SERVICE_SCAN_PACKAGE, new MethodAnnotationsScanner());
+ Reflections reflections =
+ new Reflections(
+ MessageSchedulerConf.SERVICE_SCAN_PACKAGE, new MethodAnnotationsScanner());
@Before
public void before() {
@@ -55,7 +56,6 @@ public class SchedulerMessageTest {
context = new DefaultMessageSchedulerContext();
}
-
@Test
public void servieParserTest() throws InterruptedException {
Map<String, List<ServiceMethod>> parse = context.getservieParser().parse(new TestService());
@@ -72,14 +72,18 @@ public class SchedulerMessageTest {
@Test
public void implicitParserTest() throws InterruptedException {
- Map<String, List<ImplicitMethod>> parse = context.getImplicitParser().parse(new TestService());
+ Map<String, List<ImplicitMethod>> parse =
+ context.getImplicitParser().parse(new TestService());
System.out.println(parse.size());
}
@Test
public void springRegisterTest() {
Set<Method> methodsAnnotatedWith = reflections.getMethodsAnnotatedWith(Receiver.class);
- Set<? extends Class<?>> collect = methodsAnnotatedWith.stream().map(Method::getDeclaringClass).collect(Collectors.toSet());
+ Set<? extends Class<?>> collect =
+ methodsAnnotatedWith.stream()
+ .map(Method::getDeclaringClass)
+ .collect(Collectors.toSet());
System.out.println(collect.size());
}
@@ -106,5 +110,4 @@ public class SchedulerMessageTest {
System.out.println(System.currentTimeMillis() - start);
}
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/TestService.java b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/TestService.java
index e499632..5e62327 100644
--- a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/TestService.java
+++ b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/TestService.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message;
import org.apache.linkis.message.annotation.*;
@@ -24,9 +24,7 @@ import org.apache.linkis.protocol.message.RequestProtocol;
import java.util.ArrayList;
import java.util.List;
-/**
- * @date 2020/7/14
- */
+/** @date 2020/7/14 */
public class TestService {
@Receiver
@Order(1)
@@ -36,20 +34,24 @@ public class TestService {
}
@Receiver
- public void method02(ServiceMethodContext smc, ImplicitInterface protocol) throws InterruptedException {
+ public void method02(ServiceMethodContext smc, ImplicitInterface protocol)
+ throws InterruptedException {
Thread.sleep(2000);
System.out.println("TestService1.method02");
}
@Receiver
@Chain("fgf")
- public void method03(ServiceMethodContext smc, ImplicitInterface protocol) throws InterruptedException {
+ public void method03(ServiceMethodContext smc, ImplicitInterface protocol)
+ throws InterruptedException {
Thread.sleep(3000);
- System.out.println("TestService1.method03");
+ System.out.println("TestService1.method03");
}
@Receiver
- public List<Object> method04( ServiceMethodContext smc, @NotImplicit DefaultRequestProtocol protocol) throws InterruptedException {
+ public List<Object> method04(
+ ServiceMethodContext smc, @NotImplicit DefaultRequestProtocol protocol)
+ throws InterruptedException {
Thread.sleep(2000);
System.out.println("TestService1.method04");
return new ArrayList<>();
@@ -70,6 +72,4 @@ public class TestService {
public ImplicitInterfaceImpl implicitMetho01(RequestProtocol protocol) {
return null;
}
-
-
}
diff --git a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/TestService2.java b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/TestService2.java
index ee6ff7d..962b216 100644
--- a/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/TestService2.java
+++ b/linkis-commons/linkis-message-scheduler/src/test/java/org/apache/linkis/message/TestService2.java
@@ -5,27 +5,24 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.message;
-/**
- * @date 2020/7/29
- */
+/** @date 2020/7/29 */
public class TestService2 {
-/* @Receiver
+ /* @Receiver
public void method01(@Implicit SubRequestProtocol protocol) throws InterruptedException {
System.out.println("TestService2.method01");
}*/
-
}
diff --git a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/DataWorkCloudApplication.java b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/DataWorkCloudApplication.java
index 71d39bc..43847cb 100644
--- a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/DataWorkCloudApplication.java
+++ b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/DataWorkCloudApplication.java
@@ -5,22 +5,18 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis;
+package org.apache.linkis;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.apache.linkis.common.ServiceInstance;
import org.apache.linkis.common.conf.BDPConfiguration;
import org.apache.linkis.common.conf.Configuration;
@@ -29,13 +25,11 @@ import org.apache.linkis.common.utils.Utils;
import org.apache.linkis.server.BDPJettyServerHelper;
import org.apache.linkis.server.conf.DataWorkCloudCustomExcludeFilter;
import org.apache.linkis.server.conf.ServerConfiguration;
+
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.webapp.WebAppContext;
+
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -61,14 +55,26 @@ import org.springframework.core.env.StandardEnvironment;
import org.springframework.web.filter.CharacterEncodingFilter;
import javax.servlet.DispatcherType;
-import java.util.EnumSet;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.FilterHolder;
+import org.eclipse.jetty.webapp.WebAppContext;
+
+import java.util.EnumSet;
@SpringBootApplication
@EnableDiscoveryClient
@RefreshScope
-@ComponentScan(basePackages = {"org.apache.linkis","com.webank.wedatasphere"},
- excludeFilters = @ComponentScan.Filter(type = FilterType.CUSTOM, classes = {DataWorkCloudCustomExcludeFilter.class}))
+@ComponentScan(
+ basePackages = {"org.apache.linkis", "com.webank.wedatasphere"},
+ excludeFilters =
+ @ComponentScan.Filter(
+ type = FilterType.CUSTOM,
+ classes = {DataWorkCloudCustomExcludeFilter.class}))
public class DataWorkCloudApplication extends SpringBootServletInitializer {
private static final Log logger = LogFactory.getLog(DataWorkCloudApplication.class);
@@ -82,30 +88,34 @@ public class DataWorkCloudApplication extends SpringBootServletInitializer {
public static void main(String[] args) throws ReflectiveOperationException {
final SpringApplication application = new SpringApplication(DataWorkCloudApplication.class);
- application.addListeners(new ApplicationListener<ApplicationPreparedEvent>(){
- public void onApplicationEvent(ApplicationPreparedEvent applicationPreparedEvent) {
- logger.info("add config from config server...");
- if(applicationContext == null) {
- applicationContext = applicationPreparedEvent.getApplicationContext();
- }
- addRemoteConfig();
- logger.info("initialize DataWorkCloud spring application...");
- initDWCApplication();
- }
- });
- application.addListeners(new ApplicationListener<RefreshScopeRefreshedEvent>() {
- public void onApplicationEvent(RefreshScopeRefreshedEvent applicationEvent) {
- logger.info("refresh config from config server...");
- updateRemoteConfig();
- }
- });
+ application.addListeners(
+ new ApplicationListener<ApplicationPreparedEvent>() {
+ public void onApplicationEvent(
+ ApplicationPreparedEvent applicationPreparedEvent) {
+ logger.info("add config from config server...");
+ if (applicationContext == null) {
+ applicationContext = applicationPreparedEvent.getApplicationContext();
+ }
+ addRemoteConfig();
+ logger.info("initialize DataWorkCloud spring application...");
+ initDWCApplication();
+ }
+ });
+ application.addListeners(
+ new ApplicationListener<RefreshScopeRefreshedEvent>() {
+ public void onApplicationEvent(RefreshScopeRefreshedEvent applicationEvent) {
+ logger.info("refresh config from config server...");
+ updateRemoteConfig();
+ }
+ });
String listeners = ServerConfiguration.BDP_SERVER_SPRING_APPLICATION_LISTENERS().getValue();
- if(StringUtils.isNotBlank(listeners)) {
+ if (StringUtils.isNotBlank(listeners)) {
for (String listener : listeners.split(",")) {
- application.addListeners((ApplicationListener<?>) Class.forName(listener).newInstance());
+ application.addListeners(
+ (ApplicationListener<?>) Class.forName(listener).newInstance());
}
}
- if("true".equals(ServerConfiguration.IS_GATEWAY().getValue())){
+ if ("true".equals(ServerConfiguration.IS_GATEWAY().getValue())) {
application.setWebApplicationType(WebApplicationType.REACTIVE);
}
applicationContext = application.run(args);
@@ -122,16 +132,16 @@ public class DataWorkCloudApplication extends SpringBootServletInitializer {
private static void addOrUpdateRemoteConfig(Environment env, boolean isUpdateOrNot) {
StandardEnvironment environment = (StandardEnvironment) env;
PropertySource propertySource = environment.getPropertySources().get("bootstrapProperties");
- if(propertySource == null) {
+ if (propertySource == null) {
return;
}
CompositePropertySource source = (CompositePropertySource) propertySource;
- for (String key: source.getPropertyNames()) {
+ for (String key : source.getPropertyNames()) {
Object val = source.getProperty(key);
- if(val == null) {
+ if (val == null) {
continue;
}
- if(isUpdateOrNot) {
+ if (isUpdateOrNot) {
logger.info("update remote config => " + key + " = " + source.getProperty(key));
BDPConfiguration.set(key, val.toString());
} else {
@@ -144,16 +154,24 @@ public class DataWorkCloudApplication extends SpringBootServletInitializer {
private static void initDWCApplication() {
String hostName = Utils.getComputerName();
boolean eurekaPreferIp = Configuration.EUREKA_PREFER_IP();
- if(eurekaPreferIp){
- hostName = applicationContext.getEnvironment().getProperty("spring.cloud.client.ip-address");
- logger.info("using ip address replace hostname,beacause eureka.instance.prefer-ip-address:" + eurekaPreferIp);
+ if (eurekaPreferIp) {
+ hostName =
+ applicationContext
+ .getEnvironment()
+ .getProperty("spring.cloud.client.ip-address");
+ logger.info(
+ "using ip address replace hostname,beacause eureka.instance.prefer-ip-address:"
+ + eurekaPreferIp);
}
serviceInstance = new ServiceInstance();
- serviceInstance.setApplicationName(applicationContext.getEnvironment().getProperty("spring.application.name"));
- serviceInstance.setInstance(hostName + ":" + applicationContext.getEnvironment().getProperty("server.port"));
+ serviceInstance.setApplicationName(
+ applicationContext.getEnvironment().getProperty("spring.application.name"));
+ serviceInstance.setInstance(
+ hostName + ":" + applicationContext.getEnvironment().getProperty("server.port"));
LinkisException.setApplicationName(serviceInstance.getApplicationName());
LinkisException.setHostname(hostName);
- LinkisException.setHostPort(Integer.parseInt(applicationContext.getEnvironment().getProperty("server.port")));
+ LinkisException.setHostPort(
+ Integer.parseInt(applicationContext.getEnvironment().getProperty("server.port")));
}
public static ServiceInstance getServiceInstance() {
@@ -161,7 +179,7 @@ public class DataWorkCloudApplication extends SpringBootServletInitializer {
}
public static String getApplicationName() {
- return serviceInstance.getApplicationName();
+ return serviceInstance.getApplicationName();
}
public static String getInstance() {
@@ -181,13 +199,14 @@ public class DataWorkCloudApplication extends SpringBootServletInitializer {
return builder.sources(DataWorkCloudApplication.class);
}
- //todo confirm
+ // todo confirm
@Bean
public ObjectMapper defaultObjectMapper() {
- ObjectMapper objectMapper = new ObjectMapper()
- .registerModule(new JavaTimeModule())
- .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
- return objectMapper;
+ ObjectMapper objectMapper =
+ new ObjectMapper()
+ .registerModule(new JavaTimeModule())
+ .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
+ return objectMapper;
}
@Bean
@@ -195,26 +214,32 @@ public class DataWorkCloudApplication extends SpringBootServletInitializer {
return new WebServerFactoryCustomizer<JettyServletWebServerFactory>() {
@Override
public void customize(JettyServletWebServerFactory jettyServletWebServerFactory) {
- jettyServletWebServerFactory.addServerCustomizers(new JettyServerCustomizer() {
- @Override
- public void customize(Server server) {
- Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
- final WebAppContext webApp = (WebAppContext) childHandlersByClass[0];
- FilterHolder filterHolder = new FilterHolder(CharacterEncodingFilter.class);
- filterHolder.setInitParameter("encoding", Configuration.BDP_ENCODING().getValue());
- filterHolder.setInitParameter("forceEncoding", "true");
- webApp.addFilter(filterHolder, "/*", EnumSet.allOf(DispatcherType.class));
-
- //set servletHolder for spring restful api
- BDPJettyServerHelper.setupSpringRestApiContextHandler(webApp);
- if(ServerConfiguration.BDP_SERVER_SOCKET_MODE().getValue()) {
- BDPJettyServerHelper.setupControllerServer(webApp);
- }
- if(!ServerConfiguration.BDP_SERVER_DISTINCT_MODE().getValue()) {
- BDPJettyServerHelper.setupWebAppContext(webApp);
- }
- }
- });
+ jettyServletWebServerFactory.addServerCustomizers(
+ new JettyServerCustomizer() {
+ @Override
+ public void customize(Server server) {
+ Handler[] childHandlersByClass =
+ server.getChildHandlersByClass(WebAppContext.class);
+ final WebAppContext webApp =
+ (WebAppContext) childHandlersByClass[0];
+ FilterHolder filterHolder =
+ new FilterHolder(CharacterEncodingFilter.class);
+ filterHolder.setInitParameter(
+ "encoding", Configuration.BDP_ENCODING().getValue());
+ filterHolder.setInitParameter("forceEncoding", "true");
+ webApp.addFilter(
+ filterHolder, "/*", EnumSet.allOf(DispatcherType.class));
+
+ // set servletHolder for spring restful api
+ BDPJettyServerHelper.setupSpringRestApiContextHandler(webApp);
+ if (ServerConfiguration.BDP_SERVER_SOCKET_MODE().getValue()) {
+ BDPJettyServerHelper.setupControllerServer(webApp);
+ }
+ if (!ServerConfiguration.BDP_SERVER_DISTINCT_MODE().getValue()) {
+ BDPJettyServerHelper.setupWebAppContext(webApp);
+ }
+ }
+ });
}
};
}
diff --git a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/LinkisBaseServerApp.java b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/LinkisBaseServerApp.java
index ab0cef0..d9cb9c6 100644
--- a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/LinkisBaseServerApp.java
+++ b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/LinkisBaseServerApp.java
@@ -5,20 +5,21 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis;
import org.apache.linkis.common.utils.Utils;
import org.apache.linkis.server.utils.LinkisMainHelper;
+
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -32,19 +33,20 @@ public class LinkisBaseServerApp {
String userName = Utils.getJvmUser();
String hostName = Utils.getComputerName();
- //val allArgs = args ++
+ // val allArgs = args ++
System.setProperty("hostName", hostName);
System.setProperty("userName", userName);
-
-
String serviceName = System.getProperty(LinkisMainHelper.SERVER_NAME_KEY());
System.setProperty("spring.application.name", serviceName);
LinkisMainHelper.formatPropertyFiles(serviceName);
- String[] allArgs = (String[]) ArrayUtils.addAll(args, LinkisMainHelper.getExtraSpringOptions("linkis"));
+ String[] allArgs =
+ (String[])
+ ArrayUtils.addAll(args, LinkisMainHelper.getExtraSpringOptions("linkis"));
String argsString = StringUtils.join(allArgs, "\n");
- String startLog = String.format("Ready to start %s with args: %s.", serviceName, argsString);
+ String startLog =
+ String.format("Ready to start %s with args: %s.", serviceName, argsString);
logger.info(startLog);
DataWorkCloudApplication.main(allArgs);
}
diff --git a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/server/utils/AopTargetUtils.java b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/server/utils/AopTargetUtils.java
index 5bbdd29..e3a8e5c 100644
--- a/linkis-commons/linkis-module/src/main/java/org/apache/linkis/server/utils/AopTargetUtils.java
+++ b/linkis-commons/linkis-module/src/main/java/org/apache/linkis/server/utils/AopTargetUtils.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.server.utils;
import org.springframework.aop.framework.AdvisedSupport;
@@ -27,27 +27,24 @@ public class AopTargetUtils {
/**
* Get target object(获取 目标对象)
+ *
* @param proxy 代理对象
* @return
* @throws Exception
*/
public static Object getTarget(Object proxy) throws Exception {
- if(!AopUtils.isAopProxy(proxy)) {
- return proxy;//Not a proxy object(不是代理对象)
+ if (!AopUtils.isAopProxy(proxy)) {
+ return proxy; // Not a proxy object(不是代理对象)
}
- if(AopUtils.isJdkDynamicProxy(proxy)) {
+ if (AopUtils.isJdkDynamicProxy(proxy)) {
return getJdkDynamicProxyTargetObject(proxy);
- } else { //cglib
+ } else { // cglib
return getCglibProxyTargetObject(proxy);
}
-
-
-
}
-
private static Object getCglibProxyTargetObject(Object proxy) throws Exception {
Field h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
h.setAccessible(true);
@@ -56,12 +53,14 @@ public class AopTargetUtils {
Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
advised.setAccessible(true);
- Object target = ((AdvisedSupport)advised.get(dynamicAdvisedInterceptor)).getTargetSource().getTarget();
+ Object target =
+ ((AdvisedSupport) advised.get(dynamicAdvisedInterceptor))
+ .getTargetSource()
+ .getTarget();
return target;
}
-
private static Object getJdkDynamicProxyTargetObject(Object proxy) throws Exception {
Field h = proxy.getClass().getSuperclass().getDeclaredField("h");
h.setAccessible(true);
@@ -70,7 +69,7 @@ public class AopTargetUtils {
Field advised = aopProxy.getClass().getDeclaredField("advised");
advised.setAccessible(true);
- Object target = ((AdvisedSupport)advised.get(aopProxy)).getTargetSource().getTarget();
+ Object target = ((AdvisedSupport) advised.get(aopProxy)).getTargetSource().getTarget();
return target;
}
diff --git a/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/DataSourceConfig.java b/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/DataSourceConfig.java
index 3128c6b..9144b35 100644
--- a/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/DataSourceConfig.java
+++ b/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/DataSourceConfig.java
@@ -5,23 +5,23 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.mybatis;
import org.apache.linkis.common.utils.JavaLog;
import org.apache.linkis.mybatis.conf.MybatisConfiguration;
+
import org.apache.commons.dbcp.BasicDataSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
@@ -29,6 +29,8 @@ import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Configuration
@ConfigurationProperties
@@ -36,26 +38,37 @@ public class DataSourceConfig extends JavaLog {
private static final Logger LOGGER = LoggerFactory.getLogger(DataSourceConfig.class);
- @Bean(name="dataSource", destroyMethod = "close")
+ @Bean(name = "dataSource", destroyMethod = "close")
@ConditionalOnMissingBean
- public DataSource dataSource(){
+ public DataSource dataSource() {
String dbUrl = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_URL.getValue();
String username = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_USERNAME.getValue();
String password = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_PASSWORD.getValue();
- String driverClassName = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_DRIVER_CLASS_NAME.getValue();
+ String driverClassName =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_DRIVER_CLASS_NAME.getValue();
int initialSize = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_INITIALSIZE.getValue();
int minIdle = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_MINIDLE.getValue();
int maxActive = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_MAXACTIVE.getValue();
int maxWait = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_MAXWAIT.getValue();
- int timeBetweenEvictionRunsMillis = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_TBERM.getValue();
- int minEvictableIdleTimeMillis = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_MEITM.getValue();
- String validationQuery = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_VALIDATIONQUERY.getValue();
- boolean testWhileIdle = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_TESTWHILEIDLE.getValue();
- boolean testOnBorrow = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_TESTONBORROW.getValue();
- boolean testOnReturn = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_TESTONRETURN.getValue();
- boolean poolPreparedStatements = MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_POOLPREPAREDSTATEMENTS.getValue();
- boolean removeAbandoned = MybatisConfiguration.MYBATIS_DATASOURCE_REMOVE_ABANDONED_ENABLED.getValue();
- int removeAbandonedTimeout = MybatisConfiguration.MYBATIS_DATASOURCE_REMOVE_ABANDONED_TIMEOUT.getValue();
+ int timeBetweenEvictionRunsMillis =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_TBERM.getValue();
+ int minEvictableIdleTimeMillis =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_MEITM.getValue();
+ String validationQuery =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_VALIDATIONQUERY.getValue();
+ boolean testWhileIdle =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_TESTWHILEIDLE.getValue();
+ boolean testOnBorrow =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_TESTONBORROW.getValue();
+ boolean testOnReturn =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_TESTONRETURN.getValue();
+ boolean poolPreparedStatements =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_POOLPREPAREDSTATEMENTS
+ .getValue();
+ boolean removeAbandoned =
+ MybatisConfiguration.MYBATIS_DATASOURCE_REMOVE_ABANDONED_ENABLED.getValue();
+ int removeAbandonedTimeout =
+ MybatisConfiguration.MYBATIS_DATASOURCE_REMOVE_ABANDONED_TIMEOUT.getValue();
BasicDataSource datasource = new BasicDataSource();
info("Database connection address information(数据库连接地址信息)=" + dbUrl);
datasource.setUrl(dbUrl);
@@ -77,5 +90,4 @@ public class DataSourceConfig extends JavaLog {
datasource.setRemoveAbandonedTimeout(removeAbandonedTimeout);
return datasource;
}
-
}
diff --git a/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/MyBatisMapperScannerConfig.java b/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/MyBatisMapperScannerConfig.java
index fb3406e..a4a5712 100644
--- a/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/MyBatisMapperScannerConfig.java
+++ b/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/MyBatisMapperScannerConfig.java
@@ -5,24 +5,25 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.mybatis;
import org.apache.linkis.mybatis.conf.MybatisConfiguration;
-import org.mybatis.spring.mapper.MapperScannerConfigurer;
+
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.mybatis.spring.mapper.MapperScannerConfigurer;
@Configuration
@AutoConfigureAfter(MybatisConfigurationFactory.class)
@@ -31,10 +32,10 @@ public class MyBatisMapperScannerConfig {
public MapperScannerConfigurer mapperScannerConfigurer() {
MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
- //Each table corresponds to the XXMapper.java interface type Java file
- //每张表对应的XXMapper.java interface类型的Java文件
- mapperScannerConfigurer.setBasePackage(MybatisConfiguration.BDP_SERVER_MYBATIS_BASEPACKAGE.getValue());
+ // Each table corresponds to the XXMapper.java interface type Java file
+ // 每张表对应的XXMapper.java interface类型的Java文件
+ mapperScannerConfigurer.setBasePackage(
+ MybatisConfiguration.BDP_SERVER_MYBATIS_BASEPACKAGE.getValue());
return mapperScannerConfigurer;
}
-
}
diff --git a/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/MybatisConfigurationFactory.java b/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/MybatisConfigurationFactory.java
index 635d76b..18a24e9 100644
--- a/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/MybatisConfigurationFactory.java
+++ b/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/MybatisConfigurationFactory.java
@@ -5,28 +5,26 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.mybatis;
-import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
-import com.github.pagehelper.PageInterceptor;
import org.apache.linkis.common.utils.JavaLog;
import org.apache.linkis.mybatis.conf.MybatisConfiguration;
+
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.spring.SqlSessionFactoryBean;
-import org.mybatis.spring.SqlSessionTemplate;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -41,28 +39,34 @@ import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
+
+import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
+import com.github.pagehelper.PageInterceptor;
+import org.mybatis.spring.SqlSessionTemplate;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-
@Configuration
@ConfigurationProperties
@AutoConfigureAfter(DataSourceConfig.class)
@EnableTransactionManagement
public class MybatisConfigurationFactory extends JavaLog {
- @Autowired
- private DataSource dataSource;
+ @Autowired private DataSource dataSource;
// Provide SqlSeesion(提供SqlSeesion)
@Bean(name = "sqlSessionFactory")
@Primary
public MybatisSqlSessionFactoryBean sqlSessionFactory() {
- String typeAliasesPackage = MybatisConfiguration.BDP_SERVER_MYBATIS_TYPEALIASESPACKAGE.getValue();
- //Configure the mapper scan to find all mapper.xml mapping files(配置mapper的扫描,找到所有的mapper.xml映射文件)
- String mapperLocations = MybatisConfiguration.BDP_SERVER_MYBATIS_MAPPER_LOCATIONS.getValue();
- //Load the global configuration file(加载全局的配置文件)
+ String typeAliasesPackage =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_TYPEALIASESPACKAGE.getValue();
+ // Configure the mapper scan to find all mapper.xml mapping
+ // files(配置mapper的扫描,找到所有的mapper.xml映射文件)
+ String mapperLocations =
+ MybatisConfiguration.BDP_SERVER_MYBATIS_MAPPER_LOCATIONS.getValue();
+ // Load the global configuration file(加载全局的配置文件)
String configLocation = MybatisConfiguration.BDP_SERVER_MYBATIS_CONFIGLOCATION.getValue();
try {
MybatisSqlSessionFactoryBean sessionFactoryBean = new MybatisSqlSessionFactoryBean();
@@ -74,31 +78,34 @@ public class MybatisConfigurationFactory extends JavaLog {
// Read configuration(读取配置)
sessionFactoryBean.setTypeAliasesPackage(typeAliasesPackage);
- //Set the location of the mapper.xml file(设置mapper.xml文件所在位置)
- if(StringUtils.isNotBlank(mapperLocations)) {
+ // Set the location of the mapper.xml file(设置mapper.xml文件所在位置)
+ if (StringUtils.isNotBlank(mapperLocations)) {
String[] mapperArray = mapperLocations.split(",");
List<Resource> resources = new ArrayList<>();
- for(String mapperLocation : mapperArray){
- CollectionUtils.addAll(resources,new PathMatchingResourcePatternResolver().getResources(mapperLocation));
+ for (String mapperLocation : mapperArray) {
+ CollectionUtils.addAll(
+ resources,
+ new PathMatchingResourcePatternResolver().getResources(mapperLocation));
}
sessionFactoryBean.setMapperLocations(resources.toArray(new Resource[0]));
}
- /* Resource[] resources = new PathMatchingResourcePatternResolver().getResources(mapperLocations);
+ /* Resource[] resources = new PathMatchingResourcePatternResolver().getResources(mapperLocations);
sessionFactoryBean.setMapperLocations(resources);*/
-// Set the location of the mybatis-config.xml configuration file(设置mybatis-config.xml配置文件位置)
- sessionFactoryBean.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
-
+ // Set the location of the mybatis-config.xml configuration
+ // file(设置mybatis-config.xml配置文件位置)
+ sessionFactoryBean.setConfigLocation(
+ new DefaultResourceLoader().getResource(configLocation));
-// Add paging plugin, print sql plugin(添加分页插件、打印sql插件)
- Interceptor[] plugins = new Interceptor[]{pageInterceptor()};
+ // Add paging plugin, print sql plugin(添加分页插件、打印sql插件)
+ Interceptor[] plugins = new Interceptor[] {pageInterceptor()};
sessionFactoryBean.setPlugins(plugins);
return sessionFactoryBean;
} catch (IOException e) {
- error("mybatis resolver mapper*xml is error",e);
+ error("mybatis resolver mapper*xml is error", e);
return null;
} catch (Exception e) {
- error("mybatis sqlSessionFactoryBean create error",e);
+ error("mybatis sqlSessionFactoryBean create error", e);
return null;
}
}
@@ -109,25 +116,25 @@ public class MybatisConfigurationFactory extends JavaLog {
return new SqlSessionTemplate(sqlSessionFactory);
}
- //Transaction management(事务管理)
+ // Transaction management(事务管理)
@Bean
@Primary
public PlatformTransactionManager annotationDrivenTransactionManager() {
return new DataSourceTransactionManager(dataSource);
}
-// Log the log to be executed (if you don't want to intercept it, comment out this method)
-// 将要执行的sql进行日志打印(不想拦截,就把这方法注释掉)
-// @Bean
-// public SqlPrintInterceptor sqlPrintInterceptor(){
-// return new SqlPrintInterceptor();
-// }
+ // Log the log to be executed (if you don't want to intercept it, comment out this method)
+ // 将要执行的sql进行日志打印(不想拦截,就把这方法注释掉)
+ // @Bean
+ // public SqlPrintInterceptor sqlPrintInterceptor(){
+ // return new SqlPrintInterceptor();
+ // }
@Bean
public PageInterceptor pageInterceptor() {
PageInterceptor pageInterceptor = new PageInterceptor();
Properties p = new Properties();
-// p.setProperty("offsetAsPageNum", "true");
-// p.setProperty("rowBoundsWithCount", "true");
+ // p.setProperty("offsetAsPageNum", "true");
+ // p.setProperty("rowBoundsWithCount", "true");
p.setProperty("reasonable", "true");
p.setProperty("pageSizeZero", "true");
p.setProperty("helperDialect", "mysql");
diff --git a/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/conf/MybatisConfiguration.java b/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/conf/MybatisConfiguration.java
index ff6d014..69cde69 100644
--- a/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/conf/MybatisConfiguration.java
+++ b/linkis-commons/linkis-mybatis/src/main/java/org/apache/linkis/mybatis/conf/MybatisConfiguration.java
@@ -5,43 +5,76 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.mybatis.conf;
import org.apache.linkis.common.conf.CommonVars;
public class MybatisConfiguration {
- //Mybatis configuration
- public static final CommonVars<String> BDP_SERVER_MYBATIS_MAPPER_LOCATIONS = CommonVars.apply("wds.linkis.server.mybatis.mapperLocations", "");
- public static final CommonVars<String> BDP_SERVER_MYBATIS_TYPEALIASESPACKAGE = CommonVars.apply("wds.linkis.server.mybatis.typeAliasesPackage", "");
- public static final CommonVars<String> BDP_SERVER_MYBATIS_CONFIGLOCATION = CommonVars.apply("wds.linkis.server.mybatis.configLocation", "classpath:/mybatis-config.xml");
- public static final CommonVars<String> BDP_SERVER_MYBATIS_BASEPACKAGE = CommonVars.apply("wds.linkis.server.mybatis.BasePackage", "");
- public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_URL = CommonVars.apply("wds.linkis.server.mybatis.datasource.url", "");
- public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_USERNAME = CommonVars.apply("wds.linkis.server.mybatis.datasource.username", "");
- public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_PASSWORD = CommonVars.apply("wds.linkis.server.mybatis.datasource.password", "");
- public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_DRIVER_CLASS_NAME = CommonVars.apply("wds.linkis.server.mybatis.datasource.driver-class-name", "com.mysql.jdbc.Driver");
- public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_INITIALSIZE = CommonVars.apply("wds.linkis.server.mybatis.datasource.initialSize", new Integer(1));
- public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_MINIDLE = CommonVars.apply("wds.linkis.server.mybatis.datasource.minIdle", new Integer(1));
- public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_MAXACTIVE = CommonVars.apply("wds.linkis.server.mybatis.datasource.maxActive", new Integer(20));
- public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_MAXWAIT = CommonVars.apply("wds.linkis.server.mybatis.datasource.maxWait", new Integer(6000));
- public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_TBERM = CommonVars.apply("wds.linkis.server.mybatis.datasource.timeBetweenEvictionRunsMillis", new Integer(60000));
- public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_MEITM = CommonVars.apply("wds.linkis.server.mybatis.datasource.minEvictableIdleTimeMillis", new Integer(300000));
- public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_VALIDATIONQUERY = CommonVars.apply("wds.linkis.server.mybatis.datasource.validationQuery", "SELECT 1");
-
- public static final CommonVars<Boolean> BDP_SERVER_MYBATIS_DATASOURCE_TESTWHILEIDLE = CommonVars.apply("wds.linkis.server.mybatis.datasource.testWhileIdle", new Boolean(true));
- public static final CommonVars<Boolean> BDP_SERVER_MYBATIS_DATASOURCE_TESTONBORROW = CommonVars.apply("wds.linkis.server.mybatis.datasource.testOnBorrow", new Boolean(false));
- public static final CommonVars<Boolean> BDP_SERVER_MYBATIS_DATASOURCE_TESTONRETURN = CommonVars.apply("wds.linkis.server.mybatis.datasource.testOnReturn", new Boolean(false));
- public static final CommonVars<Boolean> BDP_SERVER_MYBATIS_DATASOURCE_POOLPREPAREDSTATEMENTS = CommonVars.apply("wds.linkis.server.mybatis.datasource.poolPreparedStatements", new Boolean(true));
- public static final CommonVars<Boolean> MYBATIS_DATASOURCE_REMOVE_ABANDONED_ENABLED = CommonVars.apply("wds.linkis.server.mybatis.remove.abandoned.enabled", new Boolean(true));
- public static final CommonVars<Integer> MYBATIS_DATASOURCE_REMOVE_ABANDONED_TIMEOUT = CommonVars.apply("wds.linkis.server.mybatis.remove.abandoned.timeout", 300);
+ // Mybatis configuration
+ public static final CommonVars<String> BDP_SERVER_MYBATIS_MAPPER_LOCATIONS =
+ CommonVars.apply("wds.linkis.server.mybatis.mapperLocations", "");
+ public static final CommonVars<String> BDP_SERVER_MYBATIS_TYPEALIASESPACKAGE =
+ CommonVars.apply("wds.linkis.server.mybatis.typeAliasesPackage", "");
+ public static final CommonVars<String> BDP_SERVER_MYBATIS_CONFIGLOCATION =
+ CommonVars.apply(
+ "wds.linkis.server.mybatis.configLocation", "classpath:/mybatis-config.xml");
+ public static final CommonVars<String> BDP_SERVER_MYBATIS_BASEPACKAGE =
+ CommonVars.apply("wds.linkis.server.mybatis.BasePackage", "");
+ public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_URL =
+ CommonVars.apply("wds.linkis.server.mybatis.datasource.url", "");
+ public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_USERNAME =
+ CommonVars.apply("wds.linkis.server.mybatis.datasource.username", "");
+ public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_PASSWORD =
+ CommonVars.apply("wds.linkis.server.mybatis.datasource.password", "");
+ public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_DRIVER_CLASS_NAME =
+ CommonVars.apply(
+ "wds.linkis.server.mybatis.datasource.driver-class-name",
+ "com.mysql.jdbc.Driver");
+ public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_INITIALSIZE =
+ CommonVars.apply("wds.linkis.server.mybatis.datasource.initialSize", new Integer(1));
+ public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_MINIDLE =
+ CommonVars.apply("wds.linkis.server.mybatis.datasource.minIdle", new Integer(1));
+ public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_MAXACTIVE =
+ CommonVars.apply("wds.linkis.server.mybatis.datasource.maxActive", new Integer(20));
+ public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_MAXWAIT =
+ CommonVars.apply("wds.linkis.server.mybatis.datasource.maxWait", new Integer(6000));
+ public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_TBERM =
+ CommonVars.apply(
+ "wds.linkis.server.mybatis.datasource.timeBetweenEvictionRunsMillis",
+ new Integer(60000));
+ public static final CommonVars<Integer> BDP_SERVER_MYBATIS_DATASOURCE_MEITM =
+ CommonVars.apply(
+ "wds.linkis.server.mybatis.datasource.minEvictableIdleTimeMillis",
+ new Integer(300000));
+ public static final CommonVars<String> BDP_SERVER_MYBATIS_DATASOURCE_VALIDATIONQUERY =
+ CommonVars.apply("wds.linkis.server.mybatis.datasource.validationQuery", "SELECT 1");
+ public static final CommonVars<Boolean> BDP_SERVER_MYBATIS_DATASOURCE_TESTWHILEIDLE =
+ CommonVars.apply(
+ "wds.linkis.server.mybatis.datasource.testWhileIdle", new Boolean(true));
+ public static final CommonVars<Boolean> BDP_SERVER_MYBATIS_DATASOURCE_TESTONBORROW =
+ CommonVars.apply(
+ "wds.linkis.server.mybatis.datasource.testOnBorrow", new Boolean(false));
+ public static final CommonVars<Boolean> BDP_SERVER_MYBATIS_DATASOURCE_TESTONRETURN =
+ CommonVars.apply(
+ "wds.linkis.server.mybatis.datasource.testOnReturn", new Boolean(false));
+ public static final CommonVars<Boolean> BDP_SERVER_MYBATIS_DATASOURCE_POOLPREPAREDSTATEMENTS =
+ CommonVars.apply(
+ "wds.linkis.server.mybatis.datasource.poolPreparedStatements",
+ new Boolean(true));
+ public static final CommonVars<Boolean> MYBATIS_DATASOURCE_REMOVE_ABANDONED_ENABLED =
+ CommonVars.apply(
+ "wds.linkis.server.mybatis.remove.abandoned.enabled", new Boolean(true));
+ public static final CommonVars<Integer> MYBATIS_DATASOURCE_REMOVE_ABANDONED_TIMEOUT =
+ CommonVars.apply("wds.linkis.server.mybatis.remove.abandoned.timeout", 300);
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/AbstractRetryableProtocol.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/AbstractRetryableProtocol.java
index eba65e1..16d034c 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/AbstractRetryableProtocol.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/AbstractRetryableProtocol.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol;
+package org.apache.linkis.protocol;
public class AbstractRetryableProtocol implements RetryableProtocol {
@@ -27,7 +26,7 @@ public class AbstractRetryableProtocol implements RetryableProtocol {
@Override
public Class<? extends Throwable>[] retryExceptions() {
- return new Class[]{};
+ return new Class[] {};
}
@Override
@@ -39,5 +38,4 @@ public class AbstractRetryableProtocol implements RetryableProtocol {
public long period() {
return 1000L;
}
-
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/constants/TaskConstant.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/constants/TaskConstant.java
index 98da411..88d3e07 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/constants/TaskConstant.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/constants/TaskConstant.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.constants;
+package org.apache.linkis.protocol.constants;
public interface TaskConstant {
@@ -65,5 +64,4 @@ public interface TaskConstant {
String CODE = "code";
String REQUEST_IP = "requestIP";
-
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/engine/EngineInfo.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/engine/EngineInfo.java
index 176e8ff..ea71d01 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/engine/EngineInfo.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/engine/EngineInfo.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.engine;
+package org.apache.linkis.protocol.engine;
public class EngineInfo {
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/engine/EngineState.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/engine/EngineState.java
index 2713b49..3c24918 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/engine/EngineState.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/engine/EngineState.java
@@ -5,25 +5,28 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.engine;
+package org.apache.linkis.protocol.engine;
public enum EngineState {
- /**
- * 引擎的各种状态
- */
- Starting, Idle, Busy, ShuttingDown, Error, Dead, Success;
+ /** 引擎的各种状态 */
+ Starting,
+ Idle,
+ Busy,
+ ShuttingDown,
+ Error,
+ Dead,
+ Success;
public int id() {
return this.ordinal();
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelAttachRequest.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelAttachRequest.java
index 250de5f..b8b4763 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelAttachRequest.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelAttachRequest.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.label;
import org.apache.linkis.common.ServiceInstance;
@@ -22,27 +22,20 @@ import org.apache.linkis.common.ServiceInstance;
import java.util.HashMap;
import java.util.Map;
-
public class InsLabelAttachRequest implements LabelRequest {
- /**
- * Service instance
- */
+ /** Service instance */
private ServiceInstance serviceInstance;
- /**
- * Labels stored as map structure
- */
+ /** Labels stored as map structure */
private Map<String, Object> labels = new HashMap<>();
+ public InsLabelAttachRequest() {}
- public InsLabelAttachRequest(){
-
- }
-
- public InsLabelAttachRequest(ServiceInstance serviceInstance, Map<String, Object> labels){
+ public InsLabelAttachRequest(ServiceInstance serviceInstance, Map<String, Object> labels) {
this.serviceInstance = serviceInstance;
this.labels = labels;
}
+
public ServiceInstance getServiceInstance() {
return serviceInstance;
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelQueryRequest.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelQueryRequest.java
index dfa2f0b..2da1411 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelQueryRequest.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelQueryRequest.java
@@ -5,29 +5,26 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.label;
import org.apache.linkis.common.ServiceInstance;
+public class InsLabelQueryRequest implements LabelRequest {
-public class InsLabelQueryRequest implements LabelRequest{
-
- /**
- * Service instance
- */
+ /** Service instance */
private ServiceInstance serviceInstance;
- public InsLabelQueryRequest(ServiceInstance serviceInstance) {
+ public InsLabelQueryRequest(ServiceInstance serviceInstance) {
this.serviceInstance = serviceInstance;
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelQueryResponse.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelQueryResponse.java
index f74b66d..47903f3 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelQueryResponse.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelQueryResponse.java
@@ -5,23 +5,21 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.label;
import org.apache.linkis.protocol.util.ImmutablePair;
import java.util.List;
-import java.util.Map;
-
public class InsLabelQueryResponse {
@@ -41,5 +39,4 @@ public class InsLabelQueryResponse {
this.labelList = labelList;
return this;
}
-
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelRefreshRequest.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelRefreshRequest.java
index 908138c..9a38e9f 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelRefreshRequest.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelRefreshRequest.java
@@ -5,30 +5,27 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.label;
import org.apache.linkis.common.ServiceInstance;
import java.util.Map;
+public class InsLabelRefreshRequest extends InsLabelAttachRequest {
-public class InsLabelRefreshRequest extends InsLabelAttachRequest{
-
- public InsLabelRefreshRequest(){
-
- }
+ public InsLabelRefreshRequest() {}
- public InsLabelRefreshRequest(ServiceInstance serviceInstance, Map<String, Object> labels){
+ public InsLabelRefreshRequest(ServiceInstance serviceInstance, Map<String, Object> labels) {
super(serviceInstance, labels);
}
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelRemoveRequest.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelRemoveRequest.java
index 9c7c532..44f6bd7 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelRemoveRequest.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/InsLabelRemoveRequest.java
@@ -5,30 +5,27 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.label;
import org.apache.linkis.common.ServiceInstance;
-
-public class InsLabelRemoveRequest implements LabelRequest{
+public class InsLabelRemoveRequest implements LabelRequest {
private ServiceInstance serviceInstance;
- public InsLabelRemoveRequest(){
-
- }
+ public InsLabelRemoveRequest() {}
- public InsLabelRemoveRequest(ServiceInstance serviceInstance){
+ public InsLabelRemoveRequest(ServiceInstance serviceInstance) {
this.serviceInstance = serviceInstance;
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelInsQueryRequest.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelInsQueryRequest.java
index 2479efb..36b5e96 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelInsQueryRequest.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelInsQueryRequest.java
@@ -5,28 +5,25 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.label;
import java.util.Map;
-
public class LabelInsQueryRequest implements LabelRequest {
private Map<String, Object> labels;
- public LabelInsQueryRequest() {
-
- }
+ public LabelInsQueryRequest() {}
public LabelInsQueryRequest(Map<String, Object> labels) {
this.labels = labels;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelInsQueryResponse.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelInsQueryResponse.java
index 417b4df..219e139 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelInsQueryResponse.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelInsQueryResponse.java
@@ -5,24 +5,22 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.label;
+package org.apache.linkis.protocol.label;
import org.apache.linkis.common.ServiceInstance;
import java.util.List;
-
public class LabelInsQueryResponse {
private List<ServiceInstance> insList;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelRequest.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelRequest.java
index 4c7e51a..16be496 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelRequest.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/LabelRequest.java
@@ -5,20 +5,18 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.label;
import org.apache.linkis.protocol.message.RequestProtocol;
-
-public interface LabelRequest extends RequestProtocol {
-}
+public interface LabelRequest extends RequestProtocol {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/NodeLabelAddRequest.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/NodeLabelAddRequest.java
index bc5a75d..e3b8ad8 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/NodeLabelAddRequest.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/NodeLabelAddRequest.java
@@ -5,33 +5,29 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.label;
import org.apache.linkis.common.ServiceInstance;
import java.util.Map;
-
public class NodeLabelAddRequest implements LabelRequest {
private ServiceInstance serviceInstance;
private Map<String, Object> labels;
-
- public NodeLabelAddRequest() {
-
- }
+ public NodeLabelAddRequest() {}
public NodeLabelAddRequest(ServiceInstance serviceInstance, Map<String, Object> labels) {
this.serviceInstance = serviceInstance;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/NodeLabelRemoveRequest.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/NodeLabelRemoveRequest.java
index 9037b1d..1f3b7a7 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/NodeLabelRemoveRequest.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/label/NodeLabelRemoveRequest.java
@@ -5,30 +5,27 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.label;
import org.apache.linkis.common.ServiceInstance;
-
public class NodeLabelRemoveRequest implements LabelRequest {
private ServiceInstance serviceInstance;
private boolean isEngine;
- public NodeLabelRemoveRequest() {
-
- }
+ public NodeLabelRemoveRequest() {}
public NodeLabelRemoveRequest(ServiceInstance serviceInstance, boolean isEngine) {
this.serviceInstance = serviceInstance;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/HttpProtocol.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/HttpProtocol.java
index 73a1206..2d22d6a 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/HttpProtocol.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/HttpProtocol.java
@@ -5,21 +5,18 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.message;
+package org.apache.linkis.protocol.message;
import org.apache.linkis.protocol.Protocol;
-
-public interface HttpProtocol extends Protocol {
-}
+public interface HttpProtocol extends Protocol {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/RequestMethod.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/RequestMethod.java
index abc807c..9be303a 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/RequestMethod.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/RequestMethod.java
@@ -5,23 +5,21 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.message;
+package org.apache.linkis.protocol.message;
public interface RequestMethod {
default String method() {
return null;
}
-
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/RequestProtocol.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/RequestProtocol.java
index 37836d2..81be837 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/RequestProtocol.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/message/RequestProtocol.java
@@ -5,19 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.message;
-
-public interface RequestProtocol extends HttpProtocol {
+package org.apache.linkis.protocol.message;
-}
+public interface RequestProtocol extends HttpProtocol {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/QueryProtocol.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/QueryProtocol.java
index 745ec1e..134c1e7 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/QueryProtocol.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/QueryProtocol.java
@@ -5,18 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.query;
+package org.apache.linkis.protocol.query;
-public interface QueryProtocol {
-}
+public interface QueryProtocol {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/CacheNotFound.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/CacheNotFound.java
index 546c445..75264a8 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/CacheNotFound.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/CacheNotFound.java
@@ -5,17 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
-public class CacheNotFound implements ResponseReadCache {
-}
+public class CacheNotFound implements ResponseReadCache {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/CacheTaskResult.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/CacheTaskResult.java
index 22f50f7..e17d3f4 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/CacheTaskResult.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/CacheTaskResult.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
public class CacheTaskResult implements ResponseReadCache {
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/FailedToDeleteCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/FailedToDeleteCache.java
index da7856d..f18dffb 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/FailedToDeleteCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/FailedToDeleteCache.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
public class FailedToDeleteCache implements ResponseDeleteCache {
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/FailedToWriteCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/FailedToWriteCache.java
index f4146cb..ae01a69 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/FailedToWriteCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/FailedToWriteCache.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
public class FailedToWriteCache implements ResponseWriteCache {
@@ -28,5 +28,4 @@ public class FailedToWriteCache implements ResponseWriteCache {
public String getErrorMessage() {
return errorMessage;
}
-
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestDeleteCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestDeleteCache.java
index 798a881..3674f46 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestDeleteCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestDeleteCache.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
import org.apache.linkis.protocol.query.QueryProtocol;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestReadCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestReadCache.java
index 8ca6960..20ed14f 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestReadCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestReadCache.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
import org.apache.linkis.protocol.query.QueryProtocol;
@@ -27,7 +27,8 @@ public class RequestReadCache implements QueryProtocol {
private Long readCacheBefore;
private List<String> labelsStr;
- public RequestReadCache(String executionContent, String user, List<String> labelsStr, Long readCacheBefore) {
+ public RequestReadCache(
+ String executionContent, String user, List<String> labelsStr, Long readCacheBefore) {
this.executionContent = executionContent;
this.user = user;
this.labelsStr = labelsStr;
@@ -49,5 +50,4 @@ public class RequestReadCache implements QueryProtocol {
public List<String> getLabelsStr() {
return labelsStr;
}
-
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestWriteCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestWriteCache.java
index 41e47a5..a778485 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestWriteCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/RequestWriteCache.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
import org.apache.linkis.protocol.query.QueryProtocol;
@@ -28,7 +28,12 @@ public class RequestWriteCache implements QueryProtocol {
private List<String> labelsStr;
private String resultSet;
- public RequestWriteCache(String executionContent, String user, Long cacheExpireAfter, List<String> labelsStr, String resultSet) {
+ public RequestWriteCache(
+ String executionContent,
+ String user,
+ Long cacheExpireAfter,
+ List<String> labelsStr,
+ String resultSet) {
this.executionContent = executionContent;
this.user = user;
this.cacheExpireAfter = cacheExpireAfter;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseDeleteCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseDeleteCache.java
index bc0d6a2..7d9b034 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseDeleteCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseDeleteCache.java
@@ -5,19 +5,18 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
import org.apache.linkis.protocol.query.QueryProtocol;
-public interface ResponseDeleteCache extends QueryProtocol {
-}
+public interface ResponseDeleteCache extends QueryProtocol {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseReadCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseReadCache.java
index edceb89..5356b8b 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseReadCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseReadCache.java
@@ -5,19 +5,18 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
import org.apache.linkis.protocol.query.QueryProtocol;
-public interface ResponseReadCache extends QueryProtocol {
-}
+public interface ResponseReadCache extends QueryProtocol {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseWriteCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseWriteCache.java
index 44bd290..9686c07 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseWriteCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/ResponseWriteCache.java
@@ -5,19 +5,18 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
import org.apache.linkis.protocol.query.QueryProtocol;
-public interface ResponseWriteCache extends QueryProtocol {
-}
+public interface ResponseWriteCache extends QueryProtocol {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/SuccessDeletedCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/SuccessDeletedCache.java
index f8d109d..2cecae9 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/SuccessDeletedCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/SuccessDeletedCache.java
@@ -5,17 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
-public class SuccessDeletedCache implements ResponseDeleteCache{
-}
+public class SuccessDeletedCache implements ResponseDeleteCache {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/SuccessWriteCache.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/SuccessWriteCache.java
index dc8995d..341e0b1 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/SuccessWriteCache.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/query/cache/SuccessWriteCache.java
@@ -5,17 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.query.cache;
-public class SuccessWriteCache implements ResponseWriteCache {
-}
+public class SuccessWriteCache implements ResponseWriteCache {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestLogin.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestLogin.java
index 35b6127..334c161 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestLogin.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestLogin.java
@@ -5,21 +5,19 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.usercontrol;
-
+package org.apache.linkis.protocol.usercontrol;
-public class RequestLogin implements UserControlLoginProtocol {
+public class RequestLogin implements UserControlLoginProtocol {
private String userName;
private String password;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestRegister.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestRegister.java
index 84813cc..9413d08 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestRegister.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestRegister.java
@@ -5,20 +5,19 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.usercontrol;
+package org.apache.linkis.protocol.usercontrol;
-public class RequestRegister implements UserControlRegtisterProtocol{
+public class RequestRegister implements UserControlRegtisterProtocol {
// json string
private String params;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestUserListFromWorkspace.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestUserListFromWorkspace.java
index dd85043..0d18719 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestUserListFromWorkspace.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestUserListFromWorkspace.java
@@ -5,22 +5,21 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.usercontrol;
import java.util.List;
-
-public class RequestUserListFromWorkspace implements UserControlLoginProtocol {
+public class RequestUserListFromWorkspace implements UserControlLoginProtocol {
public RequestUserListFromWorkspace(List<Integer> userWorkspaceIds) {
this.userWorkspaceIds = userWorkspaceIds;
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestUserWorkspace.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestUserWorkspace.java
index 138770e..c092e38 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestUserWorkspace.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/RequestUserWorkspace.java
@@ -5,20 +5,19 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.usercontrol;
+package org.apache.linkis.protocol.usercontrol;
-public class RequestUserWorkspace implements UserControlLoginProtocol{
+public class RequestUserWorkspace implements UserControlLoginProtocol {
private String userName;
@@ -33,6 +32,4 @@ public class RequestUserWorkspace implements UserControlLoginProtocol{
public void setUserName(String userName) {
this.userName = userName;
}
-
-
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseLogin.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseLogin.java
index bbda279..e72c661 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseLogin.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseLogin.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.usercontrol;
import java.util.Date;
-
public class ResponseLogin implements UserControlLoginProtocol {
private String userName;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseRegister.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseRegister.java
index 962dba8..9090673 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseRegister.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseRegister.java
@@ -5,22 +5,21 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.usercontrol;
import java.util.HashMap;
-
-public class ResponseRegister implements UserControlRegtisterProtocol{
+public class ResponseRegister implements UserControlRegtisterProtocol {
private int status;
private String message;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseUserWorkspace.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseUserWorkspace.java
index 2e36e25..2934d26 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseUserWorkspace.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseUserWorkspace.java
@@ -5,22 +5,21 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.usercontrol;
import java.util.List;
-
-public class ResponseUserWorkspace implements UserControlLoginProtocol{
+public class ResponseUserWorkspace implements UserControlLoginProtocol {
List<Integer> userWorkspaceIds;
@@ -35,6 +34,4 @@ public class ResponseUserWorkspace implements UserControlLoginProtocol{
public void setUserWorkspaceIds(List<Integer> userWorkspaceIds) {
this.userWorkspaceIds = userWorkspaceIds;
}
-
-
}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseWorkspaceUserList.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseWorkspaceUserList.java
index c2168b8..b21ba38 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseWorkspaceUserList.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/ResponseWorkspaceUserList.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.usercontrol;
import java.util.List;
-
public class ResponseWorkspaceUserList implements UserControlLoginProtocol {
public ResponseWorkspaceUserList(List<String> userNames) {
this.userNames = userNames;
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/UserControlLoginProtocol.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/UserControlLoginProtocol.java
index e1fe582..62d1986 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/UserControlLoginProtocol.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/UserControlLoginProtocol.java
@@ -5,18 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.usercontrol;
+package org.apache.linkis.protocol.usercontrol;
-public interface UserControlLoginProtocol {
-}
+public interface UserControlLoginProtocol {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/UserControlRegtisterProtocol.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/UserControlRegtisterProtocol.java
index 0e38cc8..2e84c70 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/UserControlRegtisterProtocol.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/usercontrol/UserControlRegtisterProtocol.java
@@ -5,18 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.protocol.usercontrol;
+package org.apache.linkis.protocol.usercontrol;
-public interface UserControlRegtisterProtocol {
-}
+public interface UserControlRegtisterProtocol {}
diff --git a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/util/ImmutablePair.java b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/util/ImmutablePair.java
index 854df46..58cf166 100644
--- a/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/util/ImmutablePair.java
+++ b/linkis-commons/linkis-protocol/src/main/java/org/apache/linkis/protocol/util/ImmutablePair.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.protocol.util;
import java.util.AbstractMap;
-
public class ImmutablePair<K, V> {
private AbstractMap.SimpleImmutableEntry<K, V> entry;
@@ -57,11 +56,10 @@ public class ImmutablePair<K, V> {
private boolean eq(Object o1, Object o2) {
if (null != o1 && null != o2) {
return o1.equals(o2);
- } else if (o1 == o2){
+ } else if (o1 == o2) {
return true;
} else {
return false;
}
}
}
-
diff --git a/linkis-commons/linkis-rpc/src/main/java/org/apache/linkis/rpc/serializer/NoneDelegate.java b/linkis-commons/linkis-rpc/src/main/java/org/apache/linkis/rpc/serializer/NoneDelegate.java
index 954fff4..2394bae 100644
--- a/linkis-commons/linkis-rpc/src/main/java/org/apache/linkis/rpc/serializer/NoneDelegate.java
+++ b/linkis-commons/linkis-rpc/src/main/java/org/apache/linkis/rpc/serializer/NoneDelegate.java
@@ -5,24 +5,24 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.rpc.serializer;
import io.protostuff.*;
import io.protostuff.runtime.Delegate;
-import scala.Option;
import java.io.IOException;
+import scala.Option;
public class NoneDelegate implements Delegate<Option> {
@Override
@@ -41,7 +41,8 @@ public class NoneDelegate implements Delegate<Option> {
}
@Override
- public void transfer(Pipe pipe, Input input, Output output, int i, boolean b) throws IOException {
+ public void transfer(Pipe pipe, Input input, Output output, int i, boolean b)
+ throws IOException {
throw new ProtostuffException("Corrupt input. option cannot serialize");
}
diff --git a/linkis-commons/linkis-rpc/src/main/java/org/apache/linkis/rpc/serializer/ProtostuffSerializeUtil.java b/linkis-commons/linkis-rpc/src/main/java/org/apache/linkis/rpc/serializer/ProtostuffSerializeUtil.java
index 6a6ad90..81d4eee 100644
--- a/linkis-commons/linkis-rpc/src/main/java/org/apache/linkis/rpc/serializer/ProtostuffSerializeUtil.java
+++ b/linkis-commons/linkis-rpc/src/main/java/org/apache/linkis/rpc/serializer/ProtostuffSerializeUtil.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.rpc.serializer;
import io.protostuff.LinkedBuffer;
@@ -24,26 +24,26 @@ import io.protostuff.runtime.DefaultIdStrategy;
import io.protostuff.runtime.Delegate;
import io.protostuff.runtime.RuntimeEnv;
import io.protostuff.runtime.RuntimeSchema;
-import scala.Option;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import scala.Option;
public class ProtostuffSerializeUtil {
- private final static Delegate<Option> TIMESTAMP_DELEGATE = new NoneDelegate();
+ private static final Delegate<Option> TIMESTAMP_DELEGATE = new NoneDelegate();
- private final static DefaultIdStrategy idStrategy = ((DefaultIdStrategy) RuntimeEnv.ID_STRATEGY);
+ private static final DefaultIdStrategy idStrategy =
+ ((DefaultIdStrategy) RuntimeEnv.ID_STRATEGY);
static {
idStrategy.registerDelegate(TIMESTAMP_DELEGATE);
}
- /**
- * 缓存Schema
- */
- private static Map<Class<?>, Schema<?>> schemaCache = new ConcurrentHashMap<Class<?>, Schema<?>>();
+ /** 缓存Schema */
+ private static Map<Class<?>, Schema<?>> schemaCache =
+ new ConcurrentHashMap<Class<?>, Schema<?>>();
public static <T> String serialize(T obj) {
@@ -69,7 +69,6 @@ public class ProtostuffSerializeUtil {
return obj;
}
-
private static <T> Schema<T> getSchema(Class<T> clazz) {
Schema<T> schema = (Schema<T>) schemaCache.get(clazz);
if (schema == null) {
@@ -87,18 +86,17 @@ public class ProtostuffSerializeUtil {
*
* @param hexString 16进制格式的字符串
* @return 转换后的字节数组
- **/
+ */
public static byte[] toByteArray(String hexString) {
if (null == hexString)
throw new IllegalArgumentException("this hexString must not be null");
- if ("".equals(hexString))
- return new byte[0];
+ if ("".equals(hexString)) return new byte[0];
hexString = hexString.toLowerCase();
final byte[] byteArray = new byte[hexString.length() / 2];
int k = 0;
- for (int i = 0; i < byteArray.length; i++) {//因为是16进制,最多只会占用4位,转换成字节需要两个16进制的字符,高位在先
+ for (int i = 0; i < byteArray.length; i++) { // 因为是16进制,最多只会占用4位,转换成字节需要两个16进制的字符,高位在先
byte high = (byte) (Character.digit(hexString.charAt(k), 16) & 0xff);
byte low = (byte) (Character.digit(hexString.charAt(k + 1), 16) & 0xff);
byteArray[i] = (byte) (high << 4 | low);
@@ -112,18 +110,17 @@ public class ProtostuffSerializeUtil {
*
* @param byteArray 需要转换的字节数组
* @return 16进制表示格式的字符串
- **/
+ */
public static String toHexString(byte[] byteArray) {
if (byteArray == null)
throw new IllegalArgumentException("this byteArray must not be null ");
final StringBuilder hexString = new StringBuilder();
for (int i = 0; i < byteArray.length; i++) {
- if ((byteArray[i] & 0xff) < 0x10)//0~F前面不零
- hexString.append("0");
+ if ((byteArray[i] & 0xff) < 0x10) // 0~F前面不零
+ hexString.append("0");
hexString.append(Integer.toHexString(0xFF & byteArray[i]));
}
return hexString.toString().toLowerCase();
}
-
}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/domain/FsPathListWithError.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/domain/FsPathListWithError.java
index 59df0eb..fe59907 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/domain/FsPathListWithError.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/domain/FsPathListWithError.java
@@ -5,34 +5,33 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.domain;
import org.apache.linkis.common.io.FsPath;
import java.util.List;
-
public class FsPathListWithError {
private List<FsPath> fsPaths;
private String error;
- public FsPathListWithError(){
+ public FsPathListWithError() {}
- }
- public FsPathListWithError(List<FsPath> fsPaths, String error){
+ public FsPathListWithError(List<FsPath> fsPaths, String error) {
this.fsPaths = fsPaths;
this.error = error;
}
+
public List<FsPath> getFsPaths() {
return fsPaths;
}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/ExcelStorageReader.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/ExcelStorageReader.java
index 07b2426..fb5b722 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/ExcelStorageReader.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/ExcelStorageReader.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.storage.excel;
+package org.apache.linkis.storage.excel;
import java.io.File;
import java.io.FileInputStream;
@@ -24,38 +23,36 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
-
public class ExcelStorageReader {
- public static List<List<String>> getExcelTitle(InputStream in, File file, Boolean hasHeader, String suffix) throws Exception {
+ public static List<List<String>> getExcelTitle(
+ InputStream in, File file, Boolean hasHeader, String suffix) throws Exception {
List<List<String>> res;
if (".xls".equalsIgnoreCase(suffix)) {
- if(in == null)
- in = new FileInputStream(file);
+ if (in == null) in = new FileInputStream(file);
res = XlsUtils.getBasicInfo(in);
} else {
res = XlsxUtils.getBasicInfo(in, file);
}
- if(res == null && res.size() < 2){
+ if (res == null && res.size() < 2) {
throw new Exception("There is a problem with the file format(文件格式有问题)");
}
List<String> headerType = new ArrayList<String>();
List<String> header = res.get(1);
if (hasHeader) {
- for(int i = 0; i < header.size(); i ++){
+ for (int i = 0; i < header.size(); i++) {
headerType.add("string");
}
} else {
List<String> headerNew = new ArrayList<String>();
- for(int i = 0; i < header.size(); i ++){
+ for (int i = 0; i < header.size(); i++) {
headerNew.add("col_" + (i + 1));
headerType.add("string");
}
res.set(1, headerNew);
}
res.add(headerType);
- return res;
+ return res;
}
-
}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/XlsUtils.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/XlsUtils.java
index 4c07269..eeac0d5 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/XlsUtils.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/XlsUtils.java
@@ -5,22 +5,23 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.storage.excel;
+package org.apache.linkis.storage.excel;
import org.apache.linkis.storage.utils.StorageUtils;
+
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -30,35 +31,36 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
-
public class XlsUtils {
- private final static Logger LOG = LoggerFactory
- .getLogger(XlsUtils.class);
+ private static final Logger LOG = LoggerFactory.getLogger(XlsUtils.class);
- public static List<List<String>> getBasicInfo(InputStream inputStream){
+ public static List<List<String>> getBasicInfo(InputStream inputStream) {
List<List<String>> res = new ArrayList<>();
FirstRowDeal firstRowDeal = new FirstRowDeal();
ExcelXlsReader xlsReader = new ExcelXlsReader();
try {
xlsReader.init(firstRowDeal, inputStream);
xlsReader.process();
- }catch (ExcelAnalysisException e) {
+ } catch (ExcelAnalysisException e) {
res.add(firstRowDeal.getSheetNames());
res.add(firstRowDeal.getRow());
LOG.info("Finshed to get xls Info");
- } catch (Exception e){
+ } catch (Exception e) {
LOG.error("Failed to parse xls: ", e);
} finally {
xlsReader.close();
}
- return res;
+ return res;
}
- public static String excelToCsv(InputStream inputStream, FileSystem fs, Boolean hasHeader, List<String> sheetNames) throws Exception{
- String hdfsPath = "/tmp/" + StorageUtils.getJvmUser() + "/" + System.currentTimeMillis() + ".csv";
+ public static String excelToCsv(
+ InputStream inputStream, FileSystem fs, Boolean hasHeader, List<String> sheetNames)
+ throws Exception {
+ String hdfsPath =
+ "/tmp/" + StorageUtils.getJvmUser() + "/" + System.currentTimeMillis() + ".csv";
ExcelXlsReader xlsReader = new ExcelXlsReader();
RowToCsvDeal rowToCsvDeal = new RowToCsvDeal();
OutputStream out = null;
@@ -71,8 +73,7 @@ public class XlsUtils {
LOG.error("Failed to excel to csv", e);
throw e;
} finally {
- if(out != null)
- out.close();
+ if (out != null) out.close();
xlsReader.close();
}
return hdfsPath;
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/XlsxUtils.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/XlsxUtils.java
index 549c0c6..8c8ab6d 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/XlsxUtils.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/excel/XlsxUtils.java
@@ -5,73 +5,78 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.excel;
-import com.github.pjfanning.xlsx.StreamingReader;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
+import com.github.pjfanning.xlsx.StreamingReader;
+
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
public class XlsxUtils {
- public static List<List<String>> getBasicInfo(InputStream inputStream, File file) throws Exception{
+ public static List<List<String>> getBasicInfo(InputStream inputStream, File file)
+ throws Exception {
try {
List<List<String>> res = new ArrayList<>();
Workbook wb = null;
- if(inputStream != null){
- wb = StreamingReader.builder()
- .rowCacheSize(2) // number of rows to keep in memory (defaults to 10)
- .setUseSstReadOnly(true)
- .open(inputStream);
+ if (inputStream != null) {
+ wb =
+ StreamingReader.builder()
+ .rowCacheSize(
+ 2) // number of rows to keep in memory (defaults to 10)
+ .setUseSstReadOnly(true)
+ .open(inputStream);
} else {
- wb = StreamingReader.builder()
- .rowCacheSize(2) // number of rows to keep in memory (defaults to 10)
- .setUseSstReadOnly(true)
- .open(file);
+ wb =
+ StreamingReader.builder()
+ .rowCacheSize(
+ 2) // number of rows to keep in memory (defaults to 10)
+ .setUseSstReadOnly(true)
+ .open(file);
}
List<String> sheetNames = new ArrayList<>();
- for(Sheet sheet : wb){
+ for (Sheet sheet : wb) {
sheetNames.add(sheet.getSheetName());
}
Sheet sheet = wb.getSheetAt(0);
Iterator<Row> iterator = sheet.iterator();
Row row = null;
- while(iterator.hasNext() && row == null){
+ while (iterator.hasNext() && row == null) {
row = iterator.next();
}
- if(row == null){
+ if (row == null) {
throw new Exception("The incoming Excel file is empty(传入的Excel文件为空)");
}
List<String> values = new ArrayList<>();
- for(Cell cell:row){
+ for (Cell cell : row) {
values.add(cell.getStringCellValue());
}
res.add(sheetNames);
res.add(values);
return res;
} finally {
- if(inputStream != null){
+ if (inputStream != null) {
inputStream.close();
}
}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/FSNotInitException.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/FSNotInitException.java
index 0a9cdd9..6494898 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/FSNotInitException.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/FSNotInitException.java
@@ -5,24 +5,23 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.exception;
import org.apache.linkis.common.exception.WarnException;
-
public class FSNotInitException extends WarnException {
- public FSNotInitException(){
+ public FSNotInitException() {
super(52000, "FSNotInitException");
}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorCode.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorCode.java
index 6561cff..a6d048b 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorCode.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorCode.java
@@ -5,30 +5,26 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.exception;
public enum StorageErrorCode {
- /**
- *
- */
- FS_NOT_INIT(53001,"please init first")
- ;
-
+ /** */
+ FS_NOT_INIT(53001, "please init first");
- StorageErrorCode(int errorCode, String message) {
- this.code = errorCode;
- this.message = message;
+ StorageErrorCode(int errorCode, String message) {
+ this.code = errorCode;
+ this.message = message;
}
private int code;
@@ -50,5 +46,4 @@ public enum StorageErrorCode {
public void setMessage(String message) {
this.message = message;
}
-
}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorException.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorException.java
index 86a3676..ac7e0b4 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorException.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorException.java
@@ -5,33 +5,33 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.exception;
import org.apache.linkis.common.exception.ErrorException;
-
-public class StorageErrorException extends ErrorException {
+public class StorageErrorException extends ErrorException {
public StorageErrorException(int errCode, String desc) {
super(errCode, desc);
}
- public StorageErrorException(int errCode, String desc, Throwable t){
+ public StorageErrorException(int errCode, String desc, Throwable t) {
super(errCode, desc);
initCause(t);
}
- public StorageErrorException(int errCode, String desc, String ip, int port, String serviceKind) {
+ public StorageErrorException(
+ int errCode, String desc, String ip, int port, String serviceKind) {
super(errCode, desc, ip, port, serviceKind);
}
}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageFatalException.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageFatalException.java
index 51843b7..9541e49 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageFatalException.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageFatalException.java
@@ -5,32 +5,33 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.exception;
import org.apache.linkis.common.exception.FatalException;
-
public class StorageFatalException extends FatalException {
- public StorageFatalException(int errCode, String desc){
+ public StorageFatalException(int errCode, String desc) {
super(errCode, desc);
}
- public StorageFatalException(int errCode, String desc, String ip, int port, String serviceKind){
+
+ public StorageFatalException(
+ int errCode, String desc, String ip, int port, String serviceKind) {
super(errCode, desc, ip, port, serviceKind);
}
- public StorageFatalException(int errCode, String desc, Throwable t){
+ public StorageFatalException(int errCode, String desc, Throwable t) {
super(errCode, desc);
initCause(t);
}
-}
\ No newline at end of file
+}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageWarnException.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageWarnException.java
index 5687814..b24f18d 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageWarnException.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageWarnException.java
@@ -5,33 +5,32 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.exception;
import org.apache.linkis.common.exception.WarnException;
-
public class StorageWarnException extends WarnException {
- public StorageWarnException(int errCode, String desc){
+ public StorageWarnException(int errCode, String desc) {
super(errCode, desc);
}
- public StorageWarnException(int errCode, String desc, String ip, int port, String serviceKind){
+ public StorageWarnException(int errCode, String desc, String ip, int port, String serviceKind) {
super(errCode, desc, ip, port, serviceKind);
}
- public StorageWarnException(int errCode, String desc, Throwable t){
+ public StorageWarnException(int errCode, String desc, Throwable t) {
super(errCode, desc);
initCause(t);
}
-}
\ No newline at end of file
+}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/BuildFactory.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/BuildFactory.java
index a950555..5ebd1d6 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/BuildFactory.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/BuildFactory.java
@@ -5,21 +5,20 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.factory;
import org.apache.linkis.common.io.Fs;
-
public interface BuildFactory {
Fs getFs(String user, String proxyUser);
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/impl/BuildHDFSFileSystem.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/impl/BuildHDFSFileSystem.java
index d7d8ff2..6a107df 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/impl/BuildHDFSFileSystem.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/impl/BuildHDFSFileSystem.java
@@ -5,18 +5,17 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.linkis.storage.factory.impl;
+package org.apache.linkis.storage.factory.impl;
import org.apache.linkis.common.io.Fs;
import org.apache.linkis.storage.factory.BuildFactory;
@@ -24,15 +23,15 @@ import org.apache.linkis.storage.fs.FileSystem;
import org.apache.linkis.storage.fs.impl.HDFSFileSystem;
import org.apache.linkis.storage.io.IOMethodInterceptorCreator$;
import org.apache.linkis.storage.utils.StorageUtils;
-import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.Enhancer;
public class BuildHDFSFileSystem implements BuildFactory {
-
/**
- * If it is a node with hdfs configuration file, then go to the proxy mode of hdfs, if not go to io proxy mode
- * 如果是有hdfs配置文件的节点,则走hdfs的代理模式,如果不是走io代理模式
+ * If it is a node with hdfs configuration file, then go to the proxy mode of hdfs, if not go to
+ * io proxy mode 如果是有hdfs配置文件的节点,则走hdfs的代理模式,如果不是走io代理模式
+ *
* @param user
* @param proxyUser
* @return
@@ -44,10 +43,11 @@ public class BuildHDFSFileSystem implements BuildFactory {
if (StorageUtils.isHDFSNode()) {
fs = new HDFSFileSystem();
} else {
- //TODO Agent user(代理的用户)
+ // TODO Agent user(代理的用户)
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(HDFSFileSystem.class.getSuperclass());
- enhancer.setCallback(IOMethodInterceptorCreator$.MODULE$.getIOMethodInterceptor(fsName()));
+ enhancer.setCallback(
+ IOMethodInterceptorCreator$.MODULE$.getIOMethodInterceptor(fsName()));
fs = (FileSystem) enhancer.create();
}
fs.setUser(proxyUser);
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/impl/BuildLocalFileSystem.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/impl/BuildLocalFileSystem.java
index 8511367..4a1e837 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/impl/BuildLocalFileSystem.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/factory/impl/BuildLocalFileSystem.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.factory.impl;
import org.apache.linkis.common.io.Fs;
@@ -24,18 +24,18 @@ import org.apache.linkis.storage.fs.impl.LocalFileSystem;
import org.apache.linkis.storage.io.IOMethodInterceptorCreator$;
import org.apache.linkis.storage.utils.StorageConfiguration;
import org.apache.linkis.storage.utils.StorageUtils;
-import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.Enhancer;
public class BuildLocalFileSystem implements BuildFactory {
@Override
- public Fs getFs(String user, String proxyUser){
+ public Fs getFs(String user, String proxyUser) {
FileSystem fs = null;
if (StorageUtils.isIOProxy()) {
- if(user.equals(proxyUser)){
- if((Boolean) StorageConfiguration.IS_SHARE_NODE().getValue()){
- fs = new LocalFileSystem();
+ if (user.equals(proxyUser)) {
+ if ((Boolean) StorageConfiguration.IS_SHARE_NODE().getValue()) {
+ fs = new LocalFileSystem();
} else {
fs = getProxyFs();
}
@@ -44,7 +44,7 @@ public class BuildLocalFileSystem implements BuildFactory {
}
fs.setUser(proxyUser);
} else {
- fs = new LocalFileSystem();
+ fs = new LocalFileSystem();
fs.setUser(user);
}
return fs;
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/FileSystem.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/FileSystem.java
index 9dc4a31..736d5f6 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/FileSystem.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/FileSystem.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.fs;
import org.apache.linkis.common.io.Fs;
@@ -24,16 +24,16 @@ import org.apache.linkis.storage.domain.FsPathListWithError;
import java.io.File;
import java.io.IOException;
-
-public abstract class FileSystem implements Fs{
+public abstract class FileSystem implements Fs {
protected String user;
- private String defaultFilePerm = "rwxr-----"; //740
- private String defaultFolderPerm = "rwxr-x---"; //750
+ private String defaultFilePerm = "rwxr-----"; // 740
+ private String defaultFolderPerm = "rwxr-x---"; // 750
public String getDefaultFilePerm() {
return defaultFilePerm;
}
+
public String getDefaultFolderPerm() {
return defaultFolderPerm;
}
@@ -46,7 +46,6 @@ public abstract class FileSystem implements Fs{
public abstract long getUsableSpace(FsPath dest) throws IOException;
-
public abstract boolean canExecute(FsPath dest) throws IOException;
public abstract boolean setOwner(FsPath dest, String user, String group) throws IOException;
@@ -61,26 +60,25 @@ public abstract class FileSystem implements Fs{
return null;
}
- public boolean createNewFile(FsPath dest) throws IOException{
+ public boolean createNewFile(FsPath dest) throws IOException {
return create(dest.getPath());
}
- public boolean copyFile(FsPath origin, FsPath dest) throws IOException{
+ public boolean copyFile(FsPath origin, FsPath dest) throws IOException {
return copy(origin.getPath(), dest.getPath());
}
/**
* Set permissions for a path(设置某个路径的权限)
+ *
* @param dest path(路径)
* @param permission Permissions, such as rwxr-x---etc.(权限,如rwxr-x---等)
- * @throws IOException Setting a failure throws an exception, or throws an exception if the user is not owner(设置失败抛出异常,或者如果该用户不是owner,也会抛出异常)
+ * @throws IOException Setting a failure throws an exception, or throws an exception if the user
+ * is not owner(设置失败抛出异常,或者如果该用户不是owner,也会抛出异常)
* @return
*/
public abstract boolean setPermission(FsPath dest, String permission) throws IOException;
-
-
-
public String getUser() {
return user;
}
@@ -91,7 +89,7 @@ public abstract class FileSystem implements Fs{
protected FsPath getParentPath(String path) {
String parentPath = "";
- if(File.separatorChar == '/') {
+ if (File.separatorChar == '/') {
parentPath = new File(path).getParent();
} else {
parentPath = path.substring(0, path.lastIndexOf("/"));
@@ -103,5 +101,4 @@ public abstract class FileSystem implements Fs{
FsPath fsPath = get(dest);
return user.equals(fsPath.getOwner()) || user.equals(rootUserName());
}
-
}
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/HDFSFileSystem.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/HDFSFileSystem.java
index 8a6333b..f658b11 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/HDFSFileSystem.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/HDFSFileSystem.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.linkis.storage.fs.impl;
import org.apache.linkis.common.io.FsPath;
@@ -23,6 +23,7 @@ import org.apache.linkis.storage.domain.FsPathListWithError;
import org.apache.linkis.storage.fs.FileSystem;
import org.apache.linkis.storage.utils.StorageConfiguration;
import org.apache.linkis.storage.utils.StorageUtils;
+
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
@@ -34,6 +35,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.security.UserGroupInformation;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,7 +46,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
public class HDFSFileSystem extends FileSystem {
public static final String HDFS_PREFIX_WITHOUT_AUTH = "hdfs:///";
@@ -56,11 +57,7 @@ public class HDFSFileSystem extends FileSystem {
private static final Logger logger = LoggerFactory.getLogger(HDFSFileSystem.class);
- /**
- * File System abstract method start
- */
-
-
+ /** File System abstract method start */
@Override
public String listRoot() throws IOException {
return "/";
@@ -132,7 +129,6 @@ public class HDFSFileSystem extends FileSystem {
return result;
}
-
@Override
public boolean setPermission(FsPath dest, String permission) throws IOException {
String path = checkHDFSPath(dest.getPath());
@@ -163,7 +159,10 @@ public class HDFSFileSystem extends FileSystem {
FileStatus[] stat = fs.listStatus(new Path(checkHDFSPath(path.getPath())));
List<FsPath> fsPaths = new ArrayList<FsPath>();
for (FileStatus f : stat) {
- fsPaths.add(fillStorageFile(new FsPath(StorageUtils.HDFS_SCHEMA() + f.getPath().toUri().getPath()), f));
+ fsPaths.add(
+ fillStorageFile(
+ new FsPath(StorageUtils.HDFS_SCHEMA() + f.getPath().toUri().getPath()),
+ f));
}
if (fsPaths.isEmpty()) {
return null;
@@ -171,12 +170,11 @@ public class HDFSFileSystem extends FileSystem {
return new FsPathListWithError(fsPaths, "");
}
- /**
- * FS interface method start
- */
+ /** FS interface method start */
@Override
public void init(Map<String, String> properties) throws IOException {
- if (MapUtils.isNotEmpty(properties) && properties.containsKey(StorageConfiguration.PROXY_USER().key())) {
+ if (MapUtils.isNotEmpty(properties)
+ && properties.containsKey(StorageConfiguration.PROXY_USER().key())) {
user = StorageConfiguration.PROXY_USER().getValue(properties);
}
@@ -193,7 +191,6 @@ public class HDFSFileSystem extends FileSystem {
conf.set(key, v);
}
}
-
}
/*conf.set("fs.hdfs.impl.disable.cache","true");*/
fs = HDFSUtils.getHDFSUserFileSystem(user, conf);
@@ -202,7 +199,6 @@ public class HDFSFileSystem extends FileSystem {
}
}
-
@Override
public String fsName() {
return "hdfs";
@@ -263,7 +259,15 @@ public class HDFSFileSystem extends FileSystem {
if (!canExecute(getParentPath(dest))) {
throw new IOException("You have not permission to access path " + dest);
}
- boolean res = FileUtil.copy(fs, new Path(checkHDFSPath(origin)), fs, new Path(checkHDFSPath(dest)), false, true, fs.getConf());
+ boolean res =
+ FileUtil.copy(
+ fs,
+ new Path(checkHDFSPath(origin)),
+ fs,
+ new Path(checkHDFSPath(dest)),
+ false,
+ true,
+ fs.getConf());
this.setPermission(new FsPath(dest), this.getDefaultFilePerm());
return res;
}
@@ -307,7 +311,9 @@ public class HDFSFileSystem extends FileSystem {
if (!isOwner(checkHDFSPath(oldDest.getPath()))) {
throw new IOException("You have not permission to rename path " + oldDest.getPath());
}
- return fs.rename(new Path(checkHDFSPath(oldDest.getPath())), new Path(checkHDFSPath(newDest.getPath())));
+ return fs.rename(
+ new Path(checkHDFSPath(oldDest.getPath())),
+ new Path(checkHDFSPath(newDest.getPath())));
}
@Override
@@ -319,11 +325,7 @@ public class HDFSFileSystem extends FileSystem {
}
}
-
- /**
- * Utils method start
- */
-
+ /** Utils method start */
private FsPath fillStorageFile(FsPath fsPath, FileStatus fileStatus) throws IOException {
fsPath.setAccess_time(fileStatus.getAccessTime());
fsPath.setModification_time(fileStatus.getModificationTime());
@@ -357,7 +359,7 @@ public class HDFSFileSystem extends FileSystem {
groupNames = ugi.getGroupNames();
} catch (NullPointerException e) {
if ((Boolean) org.apache.linkis.common.conf.Configuration.IS_TEST_MODE().getValue()) {
- groupNames = new String[]{"hadoop"};
+ groupNames = new String[] {"hadoop"};
} else {
throw e;
}
@@ -370,7 +372,7 @@ public class HDFSFileSystem extends FileSystem {
if (permission.getGroupAction().implies(access)) {
return true;
}
- } else { //other class
+ } else { // other class
if (permission.getOtherAction().implies(access)) {
return true;
}
@@ -388,9 +390,11 @@ public class HDFSFileSystem extends FileSystem {
private String checkHDFSPath(String path) {
try {
- boolean checkHdfsPath = (boolean) StorageConfiguration.HDFS_PATH_PREFIX_CHECK_ON().getValue();
+ boolean checkHdfsPath =
+ (boolean) StorageConfiguration.HDFS_PATH_PREFIX_CHECK_ON().getValue();
if (checkHdfsPath) {
- boolean rmHdfsPrefix = (boolean) StorageConfiguration.HDFS_PATH_PREFIX_REMOVE().getValue();
+ boolean rmHdfsPrefix =
+ (boolean) StorageConfiguration.HDFS_PATH_PREFIX_REMOVE().getValue();
if (rmHdfsPrefix) {
if (StringUtils.isBlank(path)) {
return path;
@@ -399,7 +403,10 @@ public class HDFSFileSystem extends FileSystem {
// leave the first "/" in path
int remainIndex = HDFS_PREFIX_WITHOUT_AUTH.length() - 1;
if (logger.isDebugEnabled()) {
- logger.debug("checkHDFSPath ori path : {}, after path : {}", path, path.substring(remainIndex));
+ logger.debug(
+ "checkHDFSPath ori path : {}, after path : {}",
+ path,
+ path.substring(remainIndex));
}
return path.substring(remainIndex);
} else if (path.startsWith(HDFS_PREFIX_WITH_AUTH)) {
@@ -410,7 +417,10 @@ public class HDFSFileSystem extends FileSystem {
return path;
}
if (logger.isDebugEnabled()) {
- logger.debug("checkHDFSPath ori path : {}, after path : {}", path, "/" + t1[1]);
+ logger.debug(
+ "checkHDFSPath ori path : {}, after path : {}",
+ path,
+ "/" + t1[1]);
}
return "/" + t1[1];
} else {
diff --git a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/LocalFileSystem.java b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/LocalFileSystem.java
index c21c615..bd5ced3 100644
--- a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/LocalFileSystem.java
+++ b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/LocalFileSystem.java
@@ -5,16 +5,16 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
... 100756 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org