├── .github └── workflows │ └── ci.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── docs └── wiki │ ├── Home.md │ ├── _Footer.md │ ├── _Sidebar.md │ ├── en_faq.md │ ├── en_quickstart.md │ ├── en_userguide.md │ ├── media │ ├── 14612349319195.jpg │ ├── 14612352579675.jpg │ ├── 14612385789967.jpg │ ├── 14614085719511.jpg │ ├── manager-queryCommand.png │ ├── manager-queryRPCService.png │ ├── manager-trafficswitch1.png │ ├── manager-trafficswitch2.png │ └── manager-trafficswitch3.png │ ├── zh_configuration.md │ ├── zh_developguide.md │ ├── zh_errorcode.md │ ├── zh_faq.md │ ├── zh_overview.md │ ├── zh_quickstart.md │ └── zh_userguide.md ├── motan-benchmark ├── motan-benchmark-api │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── weibo │ │ └── motan │ │ └── benchmark │ │ ├── BenchmarkService.java │ │ ├── FullName.java │ │ └── Person.java ├── motan-benchmark-client │ ├── pom.xml │ └── src │ │ └── main │ │ ├── assembly │ │ └── assembly.xml │ │ ├── bin │ │ ├── start.sh │ │ └── stop.sh │ │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── motan │ │ │ └── benchmark │ │ │ ├── AbstractBenchmarkClient.java │ │ │ ├── AbstractClientRunnable.java │ │ │ ├── ClientRunnable.java │ │ │ ├── ClientStatistics.java │ │ │ ├── MotanBenchmarkClient.java │ │ │ ├── RunnableStatistics.java │ │ │ ├── TestEmptyRunnable.java │ │ │ ├── TestPojoRunnable.java │ │ │ └── TestStringRunnable.java │ │ └── resources │ │ ├── benchmark.properties │ │ ├── log4j.properties │ │ └── motan-benchmark-client.xml ├── motan-benchmark-server │ ├── pom.xml │ └── src │ │ └── main │ │ ├── assembly │ │ └── assembly.xml │ │ ├── bin │ │ ├── start.sh │ │ └── stop.sh │ │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── motan │ │ │ └── benchmark │ │ │ ├── BenchmarkServiceImpl.java │ │ │ └── MotanBenchmarkServer.java │ │ └── resources │ │ ├── log4j.properties │ │ └── motan-benchmark-server.xml └── pom.xml ├── motan-core ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── api │ │ │ └── motan │ │ │ ├── admin │ │ │ ├── AbstractAdminCommandHandler.java │ │ │ ├── AbstractAdminServer.java │ │ │ ├── AdminCommandHandler.java │ │ │ ├── AdminHandler.java │ │ │ ├── AdminInitialization.java │ │ │ ├── AdminServer.java │ │ │ ├── AdminServerFactory.java │ │ │ ├── AdminUtil.java │ │ │ ├── DefaultAdminHandler.java │ │ │ ├── DefaultPermissionChecker.java │ │ │ ├── PermissionChecker.java │ │ │ └── handler │ │ │ │ ├── CommandListHandler.java │ │ │ │ ├── DynamicFilterHandler.java │ │ │ │ ├── FaultInjectCommandHandler.java │ │ │ │ ├── MetaInfoHandler.java │ │ │ │ ├── RuntimeInfoHandler.java │ │ │ │ └── SwitcherHandler.java │ │ │ ├── closable │ │ │ ├── Closable.java │ │ │ ├── ShutDownHook.java │ │ │ └── ShutDownHookListener.java │ │ │ ├── cluster │ │ │ ├── Cluster.java │ │ │ ├── HaStrategy.java │ │ │ ├── LoadBalance.java │ │ │ ├── ha │ │ │ │ ├── AbstractHaStrategy.java │ │ │ │ ├── FailfastHaStrategy.java │ │ │ │ └── FailoverHaStrategy.java │ │ │ ├── loadbalance │ │ │ │ ├── AbstractLoadBalance.java │ │ │ │ ├── AbstractWeightedLoadBalance.java │ │ │ │ ├── ActiveWeightLoadBalance.java │ │ │ │ ├── ConfigurableWeightLoadBalance.java │ │ │ │ ├── ConsistentHashLoadBalance.java │ │ │ │ ├── GroupWeightLoadBalanceWrapper.java │ │ │ │ ├── LocalFirstLoadBalance.java │ │ │ │ ├── RandomLoadBalance.java │ │ │ │ ├── RoundRobinLoadBalance.java │ │ │ │ ├── Selector.java │ │ │ │ └── WeightRoundRobinLoadBalance.java │ │ │ └── support │ │ │ │ ├── ClusterSpi.java │ │ │ │ └── ClusterSupport.java │ │ │ ├── codec │ │ │ ├── AbstractCodec.java │ │ │ ├── Codec.java │ │ │ └── Serialization.java │ │ │ ├── common │ │ │ ├── ChannelState.java │ │ │ ├── FutureState.java │ │ │ ├── MotanConstants.java │ │ │ └── URLParamType.java │ │ │ ├── config │ │ │ ├── AbstractConfig.java │ │ │ ├── AbstractInterfaceConfig.java │ │ │ ├── AbstractRefererConfig.java │ │ │ ├── AbstractServiceConfig.java │ │ │ ├── BasicRefererInterfaceConfig.java │ │ │ ├── BasicServiceInterfaceConfig.java │ │ │ ├── ConfigUtil.java │ │ │ ├── DefaultGlobalConfig.java │ │ │ ├── ExtConfig.java │ │ │ ├── GlobalConfig.java │ │ │ ├── MeshClientConfig.java │ │ │ ├── MethodConfig.java │ │ │ ├── ProtocolConfig.java │ │ │ ├── RefererConfig.java │ │ │ ├── RegistryConfig.java │ │ │ ├── ServiceConfig.java │ │ │ ├── SpiConfig.java │ │ │ ├── annotation │ │ │ │ └── ConfigDesc.java │ │ │ └── handler │ │ │ │ ├── ConfigHandler.java │ │ │ │ └── SimpleConfigHandler.java │ │ │ ├── core │ │ │ ├── DefaultThreadFactory.java │ │ │ ├── StandardThreadExecutor.java │ │ │ └── extension │ │ │ │ ├── Activation.java │ │ │ │ ├── ActivationComparator.java │ │ │ │ ├── ExtensionLoader.java │ │ │ │ ├── Scope.java │ │ │ │ ├── Spi.java │ │ │ │ └── SpiMeta.java │ │ │ ├── exception │ │ │ ├── MotanAbstractException.java │ │ │ ├── MotanBizException.java │ │ │ ├── MotanErrorMsg.java │ │ │ ├── MotanErrorMsgConstant.java │ │ │ ├── MotanFrameworkException.java │ │ │ └── MotanServiceException.java │ │ │ ├── filter │ │ │ ├── AccessLogFilter.java │ │ │ ├── AccessStatisticFilter.java │ │ │ ├── ActiveLimitFilter.java │ │ │ ├── FaultInjectionFilter.java │ │ │ ├── Filter.java │ │ │ ├── GlobalDynamicFilter.java │ │ │ ├── InitializableFilter.java │ │ │ ├── ServiceMockFilter.java │ │ │ ├── SwitcherFilter.java │ │ │ └── ThreadProtectedFilter.java │ │ │ ├── log │ │ │ ├── DefaultLogService.java │ │ │ └── LogService.java │ │ │ ├── protocol │ │ │ ├── AbstractProtocol.java │ │ │ ├── injvm │ │ │ │ └── InjvmProtocol.java │ │ │ ├── mock │ │ │ │ └── AbstractMockRpcProtocol.java │ │ │ ├── rpc │ │ │ │ ├── CompressRpcCodec.java │ │ │ │ ├── DefaultRpcCodec.java │ │ │ │ ├── DefaultRpcExporter.java │ │ │ │ ├── DefaultRpcProtocol.java │ │ │ │ ├── DefaultRpcReferer.java │ │ │ │ └── RpcProtocolVersion.java │ │ │ ├── support │ │ │ │ └── ProtocolFilterDecorator.java │ │ │ └── v2motan │ │ │ │ ├── CompatibleCodec.java │ │ │ │ ├── GrowableByteBuffer.java │ │ │ │ ├── MotanV2Codec.java │ │ │ │ ├── MotanV2Header.java │ │ │ │ └── MotanV2Protocol.java │ │ │ ├── proxy │ │ │ ├── AbstractRefererHandler.java │ │ │ ├── CommonClient.java │ │ │ ├── CommonHandler.java │ │ │ ├── MeshClientRefererInvocationHandler.java │ │ │ ├── ProxyFactory.java │ │ │ ├── RefererCommonHandler.java │ │ │ ├── RefererInvocationHandler.java │ │ │ └── spi │ │ │ │ ├── CommonProxyFactory.java │ │ │ │ └── JdkProxyFactory.java │ │ │ ├── registry │ │ │ ├── DiscoveryService.java │ │ │ ├── NotifyListener.java │ │ │ ├── Registry.java │ │ │ ├── RegistryFactory.java │ │ │ ├── RegistryService.java │ │ │ └── support │ │ │ │ ├── AbstractRegistry.java │ │ │ │ ├── AbstractRegistryFactory.java │ │ │ │ ├── DirectRegistry.java │ │ │ │ ├── DirectRegistryFactory.java │ │ │ │ ├── FailbackRegistry.java │ │ │ │ ├── LocalRegistryFactory.java │ │ │ │ ├── LocalRegistryService.java │ │ │ │ └── command │ │ │ │ ├── CommandFailbackRegistry.java │ │ │ │ ├── CommandListener.java │ │ │ │ ├── CommandServiceManager.java │ │ │ │ ├── RpcCommand.java │ │ │ │ ├── RpcCommandUtil.java │ │ │ │ └── ServiceListener.java │ │ │ ├── rpc │ │ │ ├── AbstractExporter.java │ │ │ ├── AbstractNode.java │ │ │ ├── AbstractProvider.java │ │ │ ├── AbstractReferer.java │ │ │ ├── Application.java │ │ │ ├── ApplicationInfo.java │ │ │ ├── Callbackable.java │ │ │ ├── Caller.java │ │ │ ├── DefaultCallbackHolder.java │ │ │ ├── DefaultProvider.java │ │ │ ├── DefaultRequest.java │ │ │ ├── DefaultResponse.java │ │ │ ├── DefaultResponseFuture.java │ │ │ ├── Exporter.java │ │ │ ├── Future.java │ │ │ ├── FutureListener.java │ │ │ ├── Node.java │ │ │ ├── Protocol.java │ │ │ ├── Provider.java │ │ │ ├── ProviderFactory.java │ │ │ ├── Referer.java │ │ │ ├── RefererSupports.java │ │ │ ├── Request.java │ │ │ ├── Response.java │ │ │ ├── ResponseFuture.java │ │ │ ├── RpcContext.java │ │ │ ├── RpcStats.java │ │ │ ├── Traceable.java │ │ │ ├── TraceableContext.java │ │ │ ├── URL.java │ │ │ └── init │ │ │ │ ├── Initializable.java │ │ │ │ └── InitializationFactory.java │ │ │ ├── runtime │ │ │ ├── CircularRecorder.java │ │ │ ├── GlobalRuntime.java │ │ │ ├── RuntimeInfo.java │ │ │ ├── RuntimeInfoKeys.java │ │ │ └── meta │ │ │ │ ├── MetaService.java │ │ │ │ └── MetaServiceProvider.java │ │ │ ├── serialize │ │ │ ├── BreezeSerialization.java │ │ │ ├── DeserializableObject.java │ │ │ ├── FastJsonSerialization.java │ │ │ ├── Hessian2Serialization.java │ │ │ └── SimpleSerialization.java │ │ │ ├── switcher │ │ │ ├── LocalSwitcherService.java │ │ │ ├── Switcher.java │ │ │ ├── SwitcherListener.java │ │ │ └── SwitcherService.java │ │ │ ├── transport │ │ │ ├── AbstractClient.java │ │ │ ├── AbstractPoolClient.java │ │ │ ├── AbstractServer.java │ │ │ ├── AbstractSharedPoolClient.java │ │ │ ├── Channel.java │ │ │ ├── Client.java │ │ │ ├── DefaultMeshClient.java │ │ │ ├── DefaultProtectedStrategy.java │ │ │ ├── Endpoint.java │ │ │ ├── EndpointFactory.java │ │ │ ├── EndpointManager.java │ │ │ ├── HeartbeatFactory.java │ │ │ ├── MeshClient.java │ │ │ ├── MessageHandler.java │ │ │ ├── ProviderMessageRouter.java │ │ │ ├── ProviderProtectedStrategy.java │ │ │ ├── Server.java │ │ │ ├── SharedObjectFactory.java │ │ │ ├── Transport.java │ │ │ ├── TransportException.java │ │ │ ├── UnprotectedStrategy.java │ │ │ ├── async │ │ │ │ ├── MotanAsync.java │ │ │ │ └── MotanAsyncProcessor.java │ │ │ └── support │ │ │ │ ├── AbstractEndpointFactory.java │ │ │ │ ├── DefaultRpcHeartbeatFactory.java │ │ │ │ └── HeartbeatClientEndpointManager.java │ │ │ └── util │ │ │ ├── AccessStatisticResult.java │ │ │ ├── AsyncUtil.java │ │ │ ├── ByteUtil.java │ │ │ ├── CollectionUtil.java │ │ │ ├── ConcurrentHashSet.java │ │ │ ├── ExceptionUtil.java │ │ │ ├── InternalMetricsFactory.java │ │ │ ├── LoggerUtil.java │ │ │ ├── MathUtil.java │ │ │ ├── MeshProxyUtil.java │ │ │ ├── MetaUtil.java │ │ │ ├── MotanClientUtil.java │ │ │ ├── MotanDigestUtil.java │ │ │ ├── MotanFrameworkUtil.java │ │ │ ├── MotanGlobalConfigUtil.java │ │ │ ├── MotanSwitcherUtil.java │ │ │ ├── NetUtils.java │ │ │ ├── ReflectUtil.java │ │ │ ├── RequestIdGenerator.java │ │ │ ├── StatisticCallback.java │ │ │ ├── StatsUtil.java │ │ │ ├── StringTools.java │ │ │ └── UrlUtils.java │ └── resources │ │ └── META-INF │ │ ├── maven │ │ └── archetype.xml │ │ ├── motan.xsd │ │ ├── services │ │ ├── com.weibo.api.motan.admin.AdminCommandHandler │ │ ├── com.weibo.api.motan.cluster.Cluster │ │ ├── com.weibo.api.motan.cluster.HaStrategy │ │ ├── com.weibo.api.motan.cluster.LoadBalance │ │ ├── com.weibo.api.motan.codec.Codec │ │ ├── com.weibo.api.motan.codec.Serialization │ │ ├── com.weibo.api.motan.config.handler.ConfigHandler │ │ ├── com.weibo.api.motan.filter.Filter │ │ ├── com.weibo.api.motan.proxy.ProxyFactory │ │ ├── com.weibo.api.motan.registry.Registry │ │ ├── com.weibo.api.motan.registry.RegistryFactory │ │ ├── com.weibo.api.motan.rpc.Protocol │ │ ├── com.weibo.api.motan.rpc.init.Initializable │ │ ├── com.weibo.api.motan.switcher.SwitcherService │ │ ├── com.weibo.api.motan.transport.HeartbeatFactory │ │ ├── com.weibo.api.motan.transport.ProviderProtectedStrategy │ │ └── javax.annotation.processing.Processor │ │ ├── spring.handlers │ │ └── spring.schemas │ └── test │ ├── java │ └── com │ │ └── weibo │ │ └── api │ │ └── motan │ │ ├── BaseTestCase.java │ │ ├── TestConstants.java │ │ ├── TestUtils.java │ │ ├── admin │ │ ├── DefaultAdminHandlerTest.java │ │ ├── DefaultPermissionCheckerTest.java │ │ ├── HelloHandler.java │ │ └── handler │ │ │ ├── RuntimeInfoHandlerTest.java │ │ │ └── SwitcherHandlerTest.java │ │ ├── benchmark │ │ ├── DefaultRpcCodecTest.java │ │ ├── JdkProxyTest.java │ │ └── SerializeTest.java │ │ ├── cluster │ │ ├── ClusterSpiTest.java │ │ ├── ClusterSupportTest.java │ │ ├── ClusterTest.java │ │ ├── SelectUrlsTest.java │ │ ├── ha │ │ │ ├── FailfastHaStrategyTest.java │ │ │ └── FailoverHaStrategyTest.java │ │ └── loadbalance │ │ │ ├── AbstractLoadBalanceTest.java │ │ │ ├── ActiveWeightLoadBalanceTest.java │ │ │ ├── ConfigurableWeightLoadBalanceTest.java │ │ │ ├── ConsistentHashLoadBalanceTest.java │ │ │ ├── GroupWeightLoadBalanceTest.java │ │ │ ├── RandomLoadBalanceTest.java │ │ │ ├── RoundRobinLoadBalanceTest.java │ │ │ └── WeightRoundRobinLoadBalanceTest.java │ │ ├── config │ │ ├── ConfigClassTest.java │ │ ├── MotanMultiConfigTest.java │ │ ├── RefererConfigTest.java │ │ ├── RegistryConfigTest.java │ │ └── ServiceConfigTest.java │ │ ├── core │ │ └── extension │ │ │ ├── ExtensionLoaderTest.java │ │ │ ├── SpiPrototypeInterface.java │ │ │ ├── SpiPrototypeTestImpl.java │ │ │ ├── SpiPrototypeTestImpl2.java │ │ │ ├── SpiTestImpl.java │ │ │ └── SpiTestInterface.java │ │ ├── filter │ │ ├── AccessLogFilterTest.java │ │ ├── AccessStatisticFilterTest.java │ │ ├── ActiveLimitFilterTest.java │ │ ├── FaultInjectionFilterTest.java │ │ ├── GlobalDynamicFilterTest.java │ │ ├── ServiceMockFilterTest.java │ │ └── SwitcherFilterTest.java │ │ ├── mock │ │ ├── MockChannel.java │ │ ├── MockClient.java │ │ ├── MockDynamicReferer.java │ │ ├── MockEndpointFactory.java │ │ ├── MockProvider.java │ │ ├── MockReferer.java │ │ └── MockServer.java │ │ ├── protocol │ │ ├── example │ │ │ ├── Hello.java │ │ │ ├── IHello.java │ │ │ ├── IHelloMock.java │ │ │ ├── IWorld.java │ │ │ ├── IWorldAsync.java │ │ │ ├── MockWorld.java │ │ │ ├── Model.java │ │ │ ├── SimpleObject.java │ │ │ ├── UnSerializableClass.java │ │ │ └── World.java │ │ ├── rpc │ │ │ ├── CompressRpcCodecTest.java │ │ │ ├── DefaultRpcCodecTest.java │ │ │ └── DefaultRpcProtocolTest.java │ │ ├── support │ │ │ └── ProtocolFilterDecoratorTest.java │ │ └── v2motan │ │ │ ├── GrowableByteBufferTest.java │ │ │ ├── MotanV2CodecTest.java │ │ │ └── MotanV2HeaderTest.java │ │ ├── proxy │ │ └── RefererInvocationHandlerTest.java │ │ ├── registry │ │ └── support │ │ │ └── command │ │ │ ├── CommandFailbackRegistryTest.java │ │ │ ├── CommandServiceManagerTest.java │ │ │ └── RpcCommandUtilTest.java │ │ ├── rpc │ │ ├── DefaultProviderTest.java │ │ ├── DefaultResponseFutureTest.java │ │ ├── LocalSwitcherServiceTest.java │ │ └── URLTest.java │ │ ├── runtime │ │ └── CircularRecorderTest.java │ │ ├── serialize │ │ ├── BaseSerializeTest.java │ │ ├── BreezeSerializationTest.java │ │ ├── FastJsonSerializationTest.java │ │ ├── Hessian2SerializationTest.java │ │ ├── SimpleSerializationTest.java │ │ └── UserAttentions.java │ │ ├── transport │ │ ├── DefaultMeshClientTest.java │ │ ├── DefaultProtectedStrategyTest.java │ │ ├── ProviderA.java │ │ ├── ProviderB.java │ │ ├── ProviderC.java │ │ └── ProviderMessageRouterTest.java │ │ └── util │ │ ├── MathUtilTest.java │ │ ├── MeshProxyUtilTest.java │ │ ├── MetaUtilTest.java │ │ ├── MotanGlobalConfigUtilTest.java │ │ ├── NetUtilsTest.java │ │ ├── ReflectUtilTest.java │ │ ├── RequestIdGeneratorTest.java │ │ ├── StatsUtilTest.java │ │ └── StringToolsTest.java │ └── resources │ ├── META-INF │ └── services │ │ ├── com.weibo.api.motan.core.extension.SpiPrototypeInterface │ │ ├── com.weibo.api.motan.core.extension.SpiTestInterface │ │ ├── com.weibo.api.motan.filter.Filter │ │ └── com.weibo.api.motan.transport.EndpointFactory │ ├── log4j.properties │ └── motan.properties ├── motan-demo ├── motan-demo-api │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ ├── com │ │ │ │ └── weibo │ │ │ │ │ └── motan │ │ │ │ │ └── demo │ │ │ │ │ └── service │ │ │ │ │ ├── GrpcService.java │ │ │ │ │ ├── MotanDemoService.java │ │ │ │ │ ├── PbParamService.java │ │ │ │ │ ├── RestfulService.java │ │ │ │ │ ├── TestInterface.java │ │ │ │ │ ├── TestSuperInterface.java │ │ │ │ │ ├── YarService.java │ │ │ │ │ └── model │ │ │ │ │ └── User.java │ │ │ └── io │ │ │ │ └── grpc │ │ │ │ └── examples │ │ │ │ └── routeguide │ │ │ │ ├── Feature.java │ │ │ │ ├── FeatureDatabase.java │ │ │ │ ├── FeatureDatabaseOrBuilder.java │ │ │ │ ├── FeatureOrBuilder.java │ │ │ │ ├── Point.java │ │ │ │ ├── PointOrBuilder.java │ │ │ │ ├── Rectangle.java │ │ │ │ ├── RectangleOrBuilder.java │ │ │ │ ├── RouteGuideGrpc.java │ │ │ │ ├── RouteGuideProto.java │ │ │ │ ├── RouteNote.java │ │ │ │ ├── RouteNoteOrBuilder.java │ │ │ │ ├── RouteSummary.java │ │ │ │ └── RouteSummaryOrBuilder.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── breeze │ │ │ └── com.weibo.motan.demo.service.model.User.breeze │ │ └── test │ │ └── java │ │ └── com │ │ └── weibo │ │ └── motan │ │ └── demo │ │ └── test │ │ └── TestMotanAsync.java ├── motan-demo-client │ ├── .gitignore │ ├── pom.xml │ └── src │ │ └── main │ │ ├── assembly │ │ └── assembly.xml │ │ ├── bin │ │ ├── start.sh │ │ └── stop.sh │ │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── motan │ │ │ └── demo │ │ │ └── client │ │ │ ├── AnnotationRpcClientDemo.java │ │ │ ├── DemoMeshClient.java │ │ │ ├── DemoRpcAsyncClient.java │ │ │ ├── DemoRpcClient.java │ │ │ ├── DemoRpcHandler.java │ │ │ ├── GrpcClientDemo.java │ │ │ ├── HelloController.java │ │ │ ├── Motan2RpcClient.java │ │ │ ├── Motan2RpcClientWithMesh.java │ │ │ ├── MotanApiClientDemo.java │ │ │ ├── RestfulClient.java │ │ │ ├── SpringBootRpcClientDemo.java │ │ │ └── YarClient.java │ │ └── resources │ │ ├── demo_mesh_client.xml │ │ ├── log4j.properties │ │ ├── motan2_demo_client.xml │ │ ├── motan2_demo_client_mesh.xml │ │ ├── motan_demo_async_client.xml │ │ ├── motan_demo_client.xml │ │ ├── motan_demo_client_annotation.xml │ │ ├── motan_demo_client_commandRegistry.xml │ │ ├── motan_demo_client_direct.xml │ │ ├── motan_demo_client_grpc.xml │ │ └── motan_demo_client_restful.xml ├── motan-demo-server │ ├── .gitignore │ ├── pom.xml │ └── src │ │ └── main │ │ ├── assembly │ │ └── assembly.xml │ │ ├── bin │ │ ├── start.sh │ │ └── stop.sh │ │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── motan │ │ │ └── demo │ │ │ ├── server │ │ │ ├── AnnotationRpcServerDemo.java │ │ │ ├── DemoRpcServer.java │ │ │ ├── GrpcServerDemo.java │ │ │ ├── Motan2Server.java │ │ │ ├── Motan2ServerWithMesh.java │ │ │ ├── MotanApiExportDemo.java │ │ │ ├── MotanDemoServiceAsyncImpl.java │ │ │ ├── MotanDemoServiceImpl.java │ │ │ ├── PbParamServiceImpl.java │ │ │ ├── RestfulServerDemo.java │ │ │ ├── RouteGuideUtil.java │ │ │ └── YarServerDemo.java │ │ │ └── springboot │ │ │ └── SpringBootRpcServerDemo.java │ │ └── resources │ │ ├── log4j.properties │ │ ├── motan2_demo_server.xml │ │ ├── motan2_demo_server_mesh.xml │ │ ├── motan_demo_server.xml │ │ ├── motan_demo_server_annotation.xml │ │ ├── motan_demo_server_commandRegistry.xml │ │ ├── motan_demo_server_grpc.xml │ │ ├── motan_demo_server_restful.xml │ │ ├── motan_demo_server_yar.xml │ │ └── route_guide_db.json └── pom.xml ├── motan-extension ├── codec-extension │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── api │ │ │ └── motan │ │ │ └── codec │ │ │ └── ProtobufCodec.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.weibo.api.motan.codec.Codec ├── filter-extension │ ├── filter-opentracing │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── weibo │ │ │ │ │ └── api │ │ │ │ │ └── motan │ │ │ │ │ └── filter │ │ │ │ │ └── opentracing │ │ │ │ │ ├── OpenTracingContext.java │ │ │ │ │ ├── OpenTracingFilter.java │ │ │ │ │ └── TracerFactory.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── com.weibo.api.motan.filter.Filter │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── weibo │ │ │ │ └── api │ │ │ │ └── motan │ │ │ │ └── filter │ │ │ │ └── opentracing │ │ │ │ ├── HelloService.java │ │ │ │ ├── HelloServiceImpl.java │ │ │ │ ├── OpenTracingFilterTest.java │ │ │ │ └── zipkin │ │ │ │ └── demo │ │ │ │ ├── HelloClient.java │ │ │ │ ├── HelloServer.java │ │ │ │ └── MyTracerFactory.java │ │ │ └── resources │ │ │ ├── motan_client.xml │ │ │ └── motan_server.xml │ └── pom.xml ├── pom.xml ├── protocol-extension │ ├── motan-protocol-grpc │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── weibo │ │ │ │ └── api │ │ │ │ └── motan │ │ │ │ └── protocol │ │ │ │ └── grpc │ │ │ │ ├── GrpcClient.java │ │ │ │ ├── GrpcProtocol.java │ │ │ │ ├── GrpcResponseFuture.java │ │ │ │ ├── GrpcServer.java │ │ │ │ ├── GrpcUtil.java │ │ │ │ ├── MotanHandlerRegistry.java │ │ │ │ ├── MotanServerCallHandler.java │ │ │ │ ├── annotation │ │ │ │ └── GrpcConfig.java │ │ │ │ └── http │ │ │ │ ├── HttpProtocolNegotiator.java │ │ │ │ └── NettyHttpRequestHandler.java │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.weibo.api.motan.rpc.Protocol │ ├── motan-protocol-restful │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── weibo │ │ │ │ │ └── api │ │ │ │ │ └── motan │ │ │ │ │ └── protocol │ │ │ │ │ └── restful │ │ │ │ │ ├── EmbedRestServer.java │ │ │ │ │ ├── EndpointFactory.java │ │ │ │ │ ├── RestServer.java │ │ │ │ │ ├── RestfulProtocol.java │ │ │ │ │ └── support │ │ │ │ │ ├── AbstractEndpointFactory.java │ │ │ │ │ ├── ProviderResource.java │ │ │ │ │ ├── RestfulClientResponse.java │ │ │ │ │ ├── RestfulContainerRequest.java │ │ │ │ │ ├── RestfulInjectorFactory.java │ │ │ │ │ ├── RestfulUtil.java │ │ │ │ │ ├── RpcExceptionMapper.java │ │ │ │ │ ├── netty │ │ │ │ │ └── NettyEndpointFactory.java │ │ │ │ │ ├── proxy │ │ │ │ │ ├── RestfulClientInvoker.java │ │ │ │ │ └── RestfulProxyBuilder.java │ │ │ │ │ └── servlet │ │ │ │ │ ├── RestfulServletContainerListener.java │ │ │ │ │ ├── ServletEndpointFactory.java │ │ │ │ │ └── ServletRestServer.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ ├── com.weibo.api.motan.protocol.restful.EndpointFactory │ │ │ │ └── com.weibo.api.motan.rpc.Protocol │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── weibo │ │ │ │ └── api │ │ │ │ └── motan │ │ │ │ └── protocol │ │ │ │ └── restful │ │ │ │ ├── ClientFilter.java │ │ │ │ ├── HelloResource.java │ │ │ │ ├── RestHelloResource.java │ │ │ │ ├── ServerFilter.java │ │ │ │ ├── TestRestful.java │ │ │ │ └── TestServletCotainerRestful.java │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.weibo.api.motan.filter.Filter │ ├── motan-protocol-yar │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── weibo │ │ │ │ │ └── api │ │ │ │ │ └── motan │ │ │ │ │ ├── protocol │ │ │ │ │ └── yar │ │ │ │ │ │ ├── AttachmentRequest.java │ │ │ │ │ │ ├── YarExporter.java │ │ │ │ │ │ ├── YarMessageRouter.java │ │ │ │ │ │ ├── YarProtocolUtil.java │ │ │ │ │ │ ├── YarReferer.java │ │ │ │ │ │ ├── YarRpcProtocol.java │ │ │ │ │ │ └── annotation │ │ │ │ │ │ └── YarConfig.java │ │ │ │ │ └── transport │ │ │ │ │ └── netty4 │ │ │ │ │ ├── http │ │ │ │ │ └── NoHeartbeatFactory.java │ │ │ │ │ └── yar │ │ │ │ │ ├── Netty4YarEndpointFactory.java │ │ │ │ │ └── YarMessageHandlerWrapper.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ ├── com.weibo.api.motan.rpc.Protocol │ │ │ │ ├── com.weibo.api.motan.transport.EndpointFactory │ │ │ │ └── com.weibo.api.motan.transport.HeartbeatFactory │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── weibo │ │ │ └── api │ │ │ └── motan │ │ │ ├── protocol │ │ │ └── yar │ │ │ │ ├── YarMessageRouterTest.java │ │ │ │ ├── YarProtocolUtilTest.java │ │ │ │ └── YarRpcProtocolTest.java │ │ │ └── transport │ │ │ └── netty4 │ │ │ └── yar │ │ │ └── YarMessageHandlerWrapperTest.java │ └── pom.xml └── serialization-extension │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── api │ │ │ └── motan │ │ │ └── serialize │ │ │ ├── GrpcPbJsonSerialization.java │ │ │ ├── GrpcPbSerialization.java │ │ │ ├── HproseSerialization.java │ │ │ └── ProtobufSerialization.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.weibo.api.motan.codec.Serialization │ └── test │ ├── java │ └── com │ │ └── weibo │ │ └── api │ │ └── motan │ │ └── serialize │ │ └── protobuf │ │ ├── HelloService.java │ │ ├── HelloServiceImpl.java │ │ ├── TestProtoBuf.java │ │ └── gen │ │ └── UserProto.java │ └── resources │ └── protobuf │ ├── User.proto │ └── User2.proto ├── motan-manager ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ ├── MotanManagerApp.java │ │ │ ├── controller │ │ │ ├── CommandController.java │ │ │ ├── ServerController.java │ │ │ └── UserController.java │ │ │ ├── dao │ │ │ └── OperationRecordMapper.java │ │ │ ├── exception │ │ │ └── CustomException.java │ │ │ ├── filter │ │ │ └── AuthenticationTokenProcessingFilter.java │ │ │ ├── model │ │ │ ├── OperationRecord.java │ │ │ ├── TokenTransfer.java │ │ │ └── UserTransfer.java │ │ │ ├── service │ │ │ ├── CommandService.java │ │ │ ├── LoggingAspect.java │ │ │ ├── RegistryService.java │ │ │ ├── UnauthorizedEntryPoint.java │ │ │ └── impl │ │ │ │ ├── AbstractCommandService.java │ │ │ │ ├── ConsulCommandService.java │ │ │ │ ├── ConsulRegistryService.java │ │ │ │ ├── ZookeeperCommandService.java │ │ │ │ └── ZookeeperRegistryService.java │ │ │ └── utils │ │ │ ├── ConsulClientWrapper.java │ │ │ ├── TokenUtils.java │ │ │ └── ZkClientWrapper.java │ └── resources │ │ ├── application.properties │ │ ├── log4j.properties │ │ ├── mapping │ │ └── OperationRecordMapper.xml │ │ ├── motan-manager.sql │ │ ├── spring-mybatis.xml │ │ ├── spring-security.xml │ │ └── static │ │ ├── app │ │ ├── app.js │ │ ├── beyond.js │ │ ├── config.js │ │ ├── config.lazyload.js │ │ ├── config.router.js │ │ ├── controllers │ │ │ ├── login.js │ │ │ ├── modal.js │ │ │ ├── operationRecord.js │ │ │ ├── queryOrders.js │ │ │ ├── queryRPC.js │ │ │ └── trafficSwitch.js │ │ ├── directives │ │ │ ├── header.js │ │ │ ├── loading.js │ │ │ ├── navbar.js │ │ │ ├── realtimechart.js │ │ │ ├── sidebar.js │ │ │ ├── skin.js │ │ │ └── widget.js │ │ └── services │ │ │ ├── config.service.js │ │ │ └── user.service.js │ │ ├── assets │ │ ├── css │ │ │ ├── animate.min.css │ │ │ ├── beyond.min.css │ │ │ ├── bootstrap.min.css │ │ │ ├── demo.min.css │ │ │ ├── font-awesome.min.css │ │ │ ├── other-less │ │ │ │ └── lesshat.min.css │ │ │ ├── skins │ │ │ │ ├── azure.min.css │ │ │ │ ├── black.min.css │ │ │ │ ├── blue.min.css │ │ │ │ ├── darkblue.min.css │ │ │ │ ├── darkred.min.css │ │ │ │ ├── deepblue.min.css │ │ │ │ ├── gray.min.css │ │ │ │ ├── green.min.css │ │ │ │ ├── orange.min.css │ │ │ │ ├── pink.min.css │ │ │ │ ├── purple.min.css │ │ │ │ ├── skins-mixins.min.css │ │ │ │ └── teal.min.css │ │ │ ├── typicons.min.css │ │ │ └── weather-icons.min.css │ │ ├── fonts │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ ├── fontawesome-webfont.woff2 │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── img │ │ │ ├── angle-down.png │ │ │ ├── app-45616.png │ │ │ ├── app.png │ │ │ ├── attach-blue.png │ │ │ ├── attach-green.png │ │ │ ├── attach-red.png │ │ │ ├── attach-yellow.png │ │ │ ├── favicon.png │ │ │ ├── jquery.minicolors.png │ │ │ ├── logo-solo.png │ │ │ ├── logo.png │ │ │ ├── sort_asc.png │ │ │ ├── sort_asc_disabled.png │ │ │ ├── sort_both.png │ │ │ ├── sort_desc.png │ │ │ ├── sort_desc_disabled.png │ │ │ └── tree-icons.png │ │ ├── sound │ │ │ └── alert.mp3 │ │ └── swf │ │ │ ├── copy_csv_xls.swf │ │ │ └── copy_csv_xls_pdf.swf │ │ ├── index.html │ │ ├── lib │ │ ├── angular │ │ │ ├── angular-animate │ │ │ │ └── angular-animate.js │ │ │ ├── angular-breadcrumb │ │ │ │ └── angular-breadcrumb.js │ │ │ ├── angular-cookies │ │ │ │ └── angular-cookies.js │ │ │ ├── angular-mocks │ │ │ │ └── angular-mocks.js │ │ │ ├── angular-ngStorage │ │ │ │ └── ngStorage.js │ │ │ ├── angular-ocLazyLoad │ │ │ │ └── ocLazyLoad.js │ │ │ ├── angular-resource │ │ │ │ └── angular-resource.js │ │ │ ├── angular-sanitize │ │ │ │ └── angular-sanitize.js │ │ │ ├── angular-touch │ │ │ │ └── angular-touch.js │ │ │ ├── angular-ui-bootstrap │ │ │ │ └── ui-bootstrap.js │ │ │ ├── angular-ui-router │ │ │ │ └── angular-ui-router.js │ │ │ ├── angular-ui-utils │ │ │ │ └── angular-ui-utils.js │ │ │ └── angular.js │ │ ├── jquery │ │ │ ├── bootstrap.js │ │ │ ├── fuelux │ │ │ │ └── spinbox │ │ │ │ │ └── fuelux.spinbox.js │ │ │ ├── jquery.min.js │ │ │ ├── slimscroll │ │ │ │ └── jquery.slimscroll.js │ │ │ └── textarea │ │ │ │ └── jquery.autosize.js │ │ ├── modules │ │ │ ├── angular-daterangepicker │ │ │ │ ├── angular-daterangepicker.js │ │ │ │ ├── angular-daterangepicker.min.js │ │ │ │ ├── daterangepicker.js │ │ │ │ └── moment.js │ │ │ ├── angular-ui-fuelux-wizard │ │ │ │ └── wizard.js │ │ │ ├── angular-ui-grid │ │ │ │ ├── ui-grid.css │ │ │ │ ├── ui-grid.eot │ │ │ │ ├── ui-grid.js │ │ │ │ ├── ui-grid.min.css │ │ │ │ ├── ui-grid.min.js │ │ │ │ ├── ui-grid.svg │ │ │ │ ├── ui-grid.ttf │ │ │ │ └── ui-grid.woff │ │ │ ├── angular-ui-select │ │ │ │ ├── angular-ui-select-0.10.0.7z │ │ │ │ ├── select.css │ │ │ │ ├── select.js │ │ │ │ ├── select.min.css │ │ │ │ └── select.min.js │ │ │ ├── angularjs-toaster │ │ │ │ ├── toaster.css │ │ │ │ ├── toaster.js │ │ │ │ └── toaster.min.css │ │ │ ├── ng-grid │ │ │ │ ├── data.json │ │ │ │ ├── ng-grid.css │ │ │ │ └── ng-grid.min.js │ │ │ └── ng-tags-input │ │ │ │ └── ng-tags-input.js │ │ └── utilities.js │ │ └── views │ │ ├── blank.html │ │ ├── error-404.html │ │ ├── error-500.html │ │ ├── layout.html │ │ ├── login.html │ │ ├── operationRecord.html │ │ ├── partials │ │ ├── breadcrumbs.html │ │ ├── header.html │ │ ├── loading.html │ │ ├── navbar.html │ │ └── sidebar.html │ │ ├── queryOrders.html │ │ ├── queryRPC.html │ │ └── trafficSwitch.html │ └── test │ ├── java │ └── com │ │ └── weibo │ │ └── service │ │ └── impl │ │ ├── EmbeddedZookeeper.java │ │ └── ZkRegistryServiceTest.java │ └── resources │ └── zoo.cfg ├── motan-registry-consul ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── api │ │ │ └── motan │ │ │ └── registry │ │ │ └── consul │ │ │ ├── ConsulConstants.java │ │ │ ├── ConsulHeartbeatManager.java │ │ │ ├── ConsulRegistry.java │ │ │ ├── ConsulRegistryFactory.java │ │ │ ├── ConsulResponse.java │ │ │ ├── ConsulService.java │ │ │ ├── ConsulUtils.java │ │ │ └── client │ │ │ ├── ConsulEcwidClient.java │ │ │ └── MotanConsulClient.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.weibo.api.motan.registry.RegistryFactory │ └── test │ └── java │ └── com │ └── weibo │ └── api │ └── motan │ └── registry │ └── consul │ ├── ConsulHeartbeatManagerTest.java │ ├── ConsulRegistryTest.java │ ├── ConsulUtilsTest.java │ ├── MockConsulClient.java │ └── MockUtils.java ├── motan-registry-weibomesh ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── api │ │ │ └── motan │ │ │ └── registry │ │ │ └── weibomesh │ │ │ ├── DefaultHttpMeshTransport.java │ │ │ ├── MeshRegistry.java │ │ │ ├── MeshRegistryFactory.java │ │ │ ├── MeshRegistryListener.java │ │ │ ├── MeshTransport.java │ │ │ └── Util.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.weibo.api.motan.registry.RegistryFactory │ └── test │ └── java │ └── com │ └── weibo │ └── api │ └── motan │ └── registry │ └── weibomesh │ ├── MeshRegistryListenerTest.java │ ├── MeshRegistryTest.java │ ├── TestNotifyListener.java │ └── UtilTest.java ├── motan-registry-zookeeper ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── api │ │ │ └── motan │ │ │ └── registry │ │ │ └── zookeeper │ │ │ ├── StringSerializer.java │ │ │ ├── ZkNodeType.java │ │ │ ├── ZkUtils.java │ │ │ ├── ZookeeperRegistry.java │ │ │ ├── ZookeeperRegistryFactory.java │ │ │ └── ZookeeperStringSerializerRegistryFactory.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.weibo.api.motan.registry.RegistryFactory │ └── test │ ├── java │ └── com │ │ └── weibo │ │ └── api │ │ └── motan │ │ └── registry │ │ └── zookeeper │ │ ├── EmbeddedZookeeper.java │ │ └── ZookeeperRegistryTest.java │ └── resources │ └── zoo.cfg ├── motan-springsupport ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── weibo │ │ └── api │ │ └── motan │ │ └── config │ │ └── springsupport │ │ ├── AnnotationBean.java │ │ ├── BasicRefererConfigBean.java │ │ ├── BasicServiceConfigBean.java │ │ ├── MeshClientConfigBean.java │ │ ├── MotanBeanDefinitionParser.java │ │ ├── MotanNamespaceHandler.java │ │ ├── ProtocolConfigBean.java │ │ ├── RefererConfigBean.java │ │ ├── RegistryConfigBean.java │ │ ├── ServiceConfigBean.java │ │ ├── SpiConfigBean.java │ │ ├── annotation │ │ ├── MotanReferer.java │ │ └── MotanService.java │ │ └── util │ │ └── SpringBeanUtil.java │ └── test │ ├── java │ └── com │ │ └── weibo │ │ └── api │ │ └── motan │ │ └── config │ │ └── springsupport │ │ ├── BaseTest.java │ │ ├── ISpi.java │ │ ├── ITest.java │ │ ├── MockEndpointFactory.java │ │ ├── MockRegistryFactory.java │ │ ├── RefererConfigBeanTest.java │ │ ├── ServiceConfigBeanTest.java │ │ ├── SpiImpl.java │ │ ├── SpringSpiTest.java │ │ ├── SpringSupportTest.java │ │ └── TestImpl.java │ └── resources │ ├── META-INF │ └── services │ │ ├── com.weibo.api.motan.core.extension.SpiPrototypeInterface │ │ └── com.weibo.api.motan.core.extension.SpiTestInterface │ ├── log4j.properties │ ├── schemaTestContext.xml │ └── spi_test_context.xml ├── motan-transport-netty ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── api │ │ │ └── motan │ │ │ └── transport │ │ │ └── netty │ │ │ ├── NettyChannel.java │ │ │ ├── NettyChannelFactory.java │ │ │ ├── NettyChannelHandler.java │ │ │ ├── NettyClient.java │ │ │ ├── NettyDecoder.java │ │ │ ├── NettyEncoder.java │ │ │ ├── NettyEndpointFactory.java │ │ │ ├── NettyServer.java │ │ │ ├── NettyServerChannelManage.java │ │ │ ├── ProtectedExecutionHandler.java │ │ │ ├── StandardThreadExecutor.java │ │ │ └── admin │ │ │ ├── AdminHttpServer.java │ │ │ ├── AdminRpcServer.java │ │ │ └── NettyAdminServerFactory.java │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── com.weibo.api.motan.admin.AdminServerFactory │ │ └── com.weibo.api.motan.transport.EndpointFactory │ └── test │ └── java │ └── com │ └── weibo │ └── api │ └── motan │ └── transport │ └── netty │ ├── MockDefaultRpcCodec.java │ ├── NettyClientTest.java │ ├── NettyEndpointFactoryTest.java │ ├── NettyExampleTest.java │ ├── NettyServerExample.java │ ├── StandardThreadExecutorTest.java │ └── admin │ └── AdminHttpServerTest.java ├── motan-transport-netty4 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── weibo │ │ │ └── api │ │ │ └── motan │ │ │ └── transport │ │ │ └── netty4 │ │ │ ├── CodecUtil.java │ │ │ ├── NettyChannel.java │ │ │ ├── NettyChannelFactory.java │ │ │ ├── NettyChannelHandler.java │ │ │ ├── NettyClient.java │ │ │ ├── NettyDecoder.java │ │ │ ├── NettyEncoder.java │ │ │ ├── NettyEndpointFactory.java │ │ │ ├── NettyMessage.java │ │ │ ├── NettyServer.java │ │ │ ├── NettyServerChannelManage.java │ │ │ ├── admin │ │ │ ├── AdminHttpServer.java │ │ │ ├── AdminRpcServer.java │ │ │ └── NettyAdminServerFactory.java │ │ │ └── http │ │ │ ├── HttpMessageHandler.java │ │ │ ├── Netty4HttpServer.java │ │ │ └── NettyHttpUtil.java │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── com.weibo.api.motan.admin.AdminServerFactory │ │ └── com.weibo.api.motan.transport.EndpointFactory │ └── test │ ├── java │ └── com │ │ └── weibo │ │ └── api │ │ └── motan │ │ └── transport │ │ └── netty4 │ │ ├── NettyClientTest.java │ │ ├── NettyDecoderTest.java │ │ ├── NettyServerTest.java │ │ ├── TestHttpClient.java │ │ ├── admin │ │ ├── AdminHttpServerTest.java │ │ ├── AdminRpcServerTest.java │ │ └── NettyAdminServerFactoryTest.java │ │ └── http │ │ └── Netty4HttpServerTest.java │ └── resources │ └── log4j.properties └── pom.xml /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Workflow for Codecov 2 | on: [ push, pull_request ] 3 | jobs: 4 | run: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Checkout 8 | uses: actions/checkout@v4 9 | - name: Set up JDK 8 10 | uses: actions/setup-java@v1 11 | with: 12 | java-version: 8 13 | - name: Install dependencies 14 | run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V 15 | - name: Run tests and collect coverage 16 | run: mvn -B test 17 | - name: Upload coverage to Codecov 18 | uses: codecov/codecov-action@v5 19 | env: 20 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .target/ 2 | .logs/ 3 | */logs/ 4 | */*/logs/ 5 | */target/ 6 | bin/ 7 | 8 | # maven ignore 9 | target/ 10 | *.war 11 | *.zip 12 | *.tar 13 | *.tar.gz 14 | 15 | # eclipse ignore 16 | .settings/ 17 | .project 18 | .classpath 19 | 20 | # idea ignore 21 | .idea/ 22 | *.ipr 23 | *.iml 24 | *.iws 25 | 26 | # temp ignore 27 | *.log 28 | *.cache 29 | *.diff 30 | *.patch 31 | *.tmp 32 | 33 | # system ignore 34 | .DS_Store 35 | Thumbs.db 36 | logs/ 37 | .vscode/ 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2009-2016 Weibo, Inc. 2 | 3 | All files licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use these files except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /docs/wiki/Home.md: -------------------------------------------------------------------------------- 1 | # Motan 2 | 3 | #### [中文文档](zh_overview) 4 | 5 | # Overview 6 | Motan is a remote procedure call(RPC) framework for rapid development of high performance distributed services. 7 | 8 | # Features 9 | - Create distributed services without writing extra code. 10 | - Provides cluster support and integrate with popular service discovery services like [Consul][consul] or [Zookeeper][zookeeper]. 11 | - Supports advanced scheduling features like weighted load-balance, scheduling cross IDCs, etc. 12 | - Optimization for high load scenarios, provides high availability in production environment. 13 | 14 | 15 | # Contents 16 | 17 | * [Quick Start](https://github.com/weibocom/motan/wiki/en_quickstart) 18 | * [Using Motan in single machine environment](https://github.com/weibocom/motan/wiki/en_quickstart#using-motan-in-single-machine-environment) 19 | * [Using Motan in cluster environment](https://github.com/weibocom/motan/wiki/en_quickstart#using-motan-in-cluster-environment) 20 | * User Guide(Preparing) 21 | * Overview(Preparing) 22 | * Use Motan(Preparing) 23 | * Configuration(Preparing) 24 | * Managing and Monitoring(Preparing) 25 | * Develop Guide(Preparing) 26 | * [FAQ](https://github.com/weibocom/motan/wiki/en_faq) 27 | 28 | 29 | [consul]:http://www.consul.io 30 | [zookeeper]:http://zookeeper.apache.org -------------------------------------------------------------------------------- /docs/wiki/_Footer.md: -------------------------------------------------------------------------------- 1 | Copyright 2009-2016 Weibo, Inc. -------------------------------------------------------------------------------- /docs/wiki/_Sidebar.md: -------------------------------------------------------------------------------- 1 | ### Documents 2 | * [Overview](Home) 3 | * [Quick Start](en_quickstart) 4 | * User Guide(Preparing) 5 | * Develop Guide(Preparing) 6 | * [FAQ](en_faq) 7 | 8 | ### 中文文档 9 | * [概述](zh_overview) 10 | * [快速入门](zh_quickstart) 11 | * [用户指南](zh_userguide) 12 | * [开发指南](zh_developguide) 13 | * [常见问题](zh_faq) 14 | -------------------------------------------------------------------------------- /docs/wiki/en_faq.md: -------------------------------------------------------------------------------- 1 | 2 | If you encounter problems in use, please [submit Issue](https://github.com/weibocom/motan/issues) to communicate with us. 3 | 4 | #### Is Motan able to support large-scale cluster? 5 | Yes, as the core component of Weibo, Motan has been supporting a cluster of thousands of machines. 6 | 7 | #### Does Motan support asynchronous calls? How to achieve? 8 | Motan requests are asynchronous calls at the transport layer, and no additional configuration is required. 9 | 10 | #### The open source version of Motan and Weibo's internal version are the same exactly? 11 | The open source Motan contains most of the features in the internal version, mainly to remove some functions related to internal dependencies. 12 | 13 | #### Does Motan support PHP calls? 14 | Motan currently does not support the PHP call, we are working for that, and the PHP client has been tested in a small scope. 15 | 16 | #### Motan support module extension? 17 | Yes, you can extend Motan through SPI. -------------------------------------------------------------------------------- /docs/wiki/en_userguide.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/en_userguide.md -------------------------------------------------------------------------------- /docs/wiki/media/14612349319195.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/media/14612349319195.jpg -------------------------------------------------------------------------------- /docs/wiki/media/14612352579675.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/media/14612352579675.jpg -------------------------------------------------------------------------------- /docs/wiki/media/14612385789967.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/media/14612385789967.jpg -------------------------------------------------------------------------------- /docs/wiki/media/14614085719511.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/media/14614085719511.jpg -------------------------------------------------------------------------------- /docs/wiki/media/manager-queryCommand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/media/manager-queryCommand.png -------------------------------------------------------------------------------- /docs/wiki/media/manager-queryRPCService.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/media/manager-queryRPCService.png -------------------------------------------------------------------------------- /docs/wiki/media/manager-trafficswitch1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/media/manager-trafficswitch1.png -------------------------------------------------------------------------------- /docs/wiki/media/manager-trafficswitch2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/media/manager-trafficswitch2.png -------------------------------------------------------------------------------- /docs/wiki/media/manager-trafficswitch3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/docs/wiki/media/manager-trafficswitch3.png -------------------------------------------------------------------------------- /docs/wiki/zh_faq.md: -------------------------------------------------------------------------------- 1 | 如果在使用中遇到问题,欢迎[提交Issue](https://github.com/weibocom/motan/issues)与我们交流。 2 | 3 | #### Motan是否能够支撑高并发、大规模集群场景? 4 | 可以,Motan作为微博的核心基础组件,已经支撑了微博底层平台数千台机器的远程调用需求。性能测试的结果请参考[这里](zh_userguide#性能测试)。 5 | 6 | #### Motan支持异步调用吗?如何实现? 7 | Motan的请求在传输层面都是异步调用的,不需要额外配置。 8 | 9 | #### 开源版Motan与微博内部的版本功能一样吗? 10 | 开源版Motan包含了内部版本中的大部分功能,主要是去除了一些内部的依赖组件相关的功能。 11 | 12 | #### Motan支持php调用吗? 13 | 目前Motan支持php的YAR协议调用,见motan-extension下的motan-protocol-yar模块。 14 | 15 | #### 我在使用Motan的过程中发现日志里有错误,如何解决? 16 | 请参考 [错误码及异常日志说明](zh_errorcode),或者[提交Issue](https://github.com/weibocom/motan/issues)与我们交流。 -------------------------------------------------------------------------------- /docs/wiki/zh_overview.md: -------------------------------------------------------------------------------- 1 | 2 | # 概述 3 | Motan是一套高性能、易于使用的分布式远程服务调用(RPC)框架。 4 | 5 | # 功能 6 | - 支持通过spring配置方式集成,无需额外编写代码即可为服务提供分布式调用能力。 7 | - 支持集成consul、zookeeper等配置服务组件,提供集群环境的服务发现及治理能力。 8 | - 支持动态自定义负载均衡、跨机房流量调整等高级服务调度能力。 9 | - 基于高并发、高负载场景进行优化,保障生产环境下RPC服务高可用。 10 | 11 | # 文档索引 12 | 13 | * [快速入门](zh_quickstart) 14 | * [简单调用示例](zh_quickstart#简单调用示例) 15 | * [集群使用示例](zh_quickstart#集群使用示例) 16 | * [其他调用示例](zh_quickstart#其他调用示例) 17 | * [用户指南](zh_userguide) 18 | * [基本介绍](zh_userguide#基本介绍) 19 | * [使用Motan](zh_userguide#使用motan) 20 | * [配置说明](zh_userguide#配置说明) 21 | * [运维及监控](zh_userguide#运维及监控) 22 | * [性能测试](zh_userguide#性能测试) 23 | * [开发指南](zh_developguide) 24 | * [常见问题](zh_faq) 25 | 26 | -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | motan-benchmark 23 | com.weibo 24 | 1.2.5-SNAPSHOT 25 | 26 | 4.0.0 27 | 28 | motan-benchmark-api 29 | 30 | 31 | -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-api/src/main/java/com/weibo/motan/benchmark/BenchmarkService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.motan.benchmark; 18 | 19 | import java.util.List; 20 | import java.util.Map; 21 | 22 | public interface BenchmarkService { 23 | Object echoService(Object request); 24 | 25 | void emptyService(); 26 | 27 | public Map getUserTypes(List uids); 28 | 29 | public long[] getLastStatusIds(long[] uids); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-client/src/main/assembly/assembly.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | assembly 18 | 19 | tar.gz 20 | 21 | true 22 | 23 | 24 | ${project.basedir}/src/main/bin 25 | bin 26 | 0755 27 | 28 | 29 | 30 | 31 | lib 32 | 33 | 34 | -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-client/src/main/bin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIR=`pwd` 3 | cd `dirname $0` 4 | cd ../lib 5 | LIB_DIR=`pwd` 6 | 7 | SERVER_NAME='com.weibo.motan.benchmark.MotanBenchmarkClient' 8 | 9 | PIDS=`ps -ef | grep java | grep "$LIB_DIR" | grep ${SERVER_NAME} | awk '{print $2}'` 10 | if [ -n "$PIDS" ]; then 11 | echo "start failed, the $SERVER_NAME already started!" 12 | exit 1 13 | fi 14 | 15 | LIB_JARS=`ls ${LIB_DIR} | grep .jar | awk '{print "'${LIB_DIR}'/"$0}' | tr "\n" ":"` 16 | cd .. 17 | nohup java -classpath ${LIB_JARS} ${SERVER_NAME} nohup.client.out 2>&1 & 18 | 19 | echo "start "${SERVER_NAME}" success!" 20 | cd ${DIR} -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-client/src/main/bin/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIR=`pwd` 3 | cd `dirname $0` 4 | cd ../lib 5 | LIB_DIR=`pwd` 6 | 7 | SERVER_NAME='com.weibo.motan.demo.client.DemoRpcClient' 8 | 9 | PIDS=`ps -ef | grep java | grep "$LIB_DIR" | grep ${SERVER_NAME} | awk '{print $2}'` 10 | if [ -z "$PIDS" ]; then 11 | echo "stop failed, the $SERVER_NAME not start!" 12 | exit 1 13 | fi 14 | 15 | for PID in ${PIDS}; 16 | do 17 | kill ${PID} > /dev/null 2>&1 18 | done 19 | 20 | echo "stop success! pid:"${PIDS} 21 | cd ${DIR} -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-client/src/main/java/com/weibo/motan/benchmark/ClientRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.motan.benchmark; 18 | 19 | public interface ClientRunnable extends Runnable { 20 | 21 | RunnableStatistics getStatistics(); 22 | } 23 | -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-client/src/main/java/com/weibo/motan/benchmark/TestEmptyRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.motan.benchmark; 18 | 19 | import java.util.concurrent.CountDownLatch; 20 | import java.util.concurrent.CyclicBarrier; 21 | 22 | public class TestEmptyRunnable extends AbstractClientRunnable { 23 | 24 | public TestEmptyRunnable(BenchmarkService service, String params, CyclicBarrier barrier, CountDownLatch latch, long startTime, long endTime) { 25 | super(service, barrier, latch, startTime, endTime); 26 | } 27 | 28 | @Override 29 | protected Object call(BenchmarkService benchmarkService) { 30 | benchmarkService.emptyService(); 31 | return "empty"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-client/src/main/resources/benchmark.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | runtime=90 18 | # isMultiClientΪtrueʱ��concurrentsָ����N���̣߳�ÿ���߳�ʹ�õ���Serviceʵ�����൱��ÿ���̶߳���һ��Client��N��Clientͬʱ�������÷��� 19 | # isMultiClientΪfalseʱ��concurrentsָ����N���̣߳�N���̹߳���ͬһServiceʵ�����൱��һ��Client����N���̵߳��÷��� 20 | isMultiClient=false 21 | concurrents=10 22 | 23 | # 1kString 24 | classname=com.weibo.motan.benchmark.TestStringRunnable 25 | params=1 26 | 27 | # 10kString 28 | # classname=com.weibo.motan.benchmark.TestStringRunnable 29 | # params=10 30 | 31 | # Empty 32 | # classname=com.weibo.motan.benchmark.TestEmptyRunnable 33 | # params=1 34 | 35 | # Pojo 36 | # classname=com.weibo.motan.benchmark.TestPojoRunnable 37 | # params=1 -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-server/src/main/assembly/assembly.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | assembly 18 | 19 | tar.gz 20 | 21 | true 22 | 23 | 24 | ${project.basedir}/src/main/bin 25 | bin 26 | 0755 27 | 28 | 29 | 30 | 31 | lib 32 | 33 | 34 | -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-server/src/main/bin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIR=`pwd` 3 | cd `dirname $0` 4 | cd ../lib 5 | LIB_DIR=`pwd` 6 | 7 | SERVER_NAME='com.weibo.motan.benchmark.MotanBenchmarkServer' 8 | 9 | PIDS=`ps -ef | grep java | grep "$LIB_DIR" | grep ${SERVER_NAME} | awk '{print $2}'` 10 | if [ -n "$PIDS" ]; then 11 | echo "start failed, the $SERVER_NAME already started!" 12 | exit 1 13 | fi 14 | 15 | LIB_JARS=`ls ${LIB_DIR} | grep .jar | awk '{print "'${LIB_DIR}'/"$0}' | tr "\n" ":"` 16 | cd .. 17 | nohup java -classpath ${LIB_JARS} ${SERVER_NAME} nohup.server.out 2>&1 & 18 | 19 | echo "start "${SERVER_NAME}" success!" 20 | cd ${DIR} -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-server/src/main/bin/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIR=`pwd` 3 | cd `dirname $0` 4 | cd ../lib 5 | LIB_DIR=`pwd` 6 | 7 | SERVER_NAME='com.weibo.motan.benchmark.MotanBenchmarkServer' 8 | 9 | PIDS=`ps -ef | grep java | grep "$LIB_DIR" | grep ${SERVER_NAME} | awk '{print $2}'` 10 | if [ -z "$PIDS" ]; then 11 | echo "stop failed, the $SERVER_NAME not start!" 12 | exit 1 13 | fi 14 | 15 | for PID in ${PIDS}; 16 | do 17 | kill ${PID} > /dev/null 2>&1 18 | done 19 | 20 | echo "stop success! pid:"${PIDS} 21 | cd ${DIR} -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-server/src/main/java/com/weibo/motan/benchmark/BenchmarkServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.motan.benchmark; 18 | 19 | import java.util.List; 20 | import java.util.Map; 21 | 22 | public class BenchmarkServiceImpl implements BenchmarkService { 23 | 24 | @Override 25 | public Object echoService(Object request) { 26 | return request; 27 | } 28 | 29 | @Override 30 | public void emptyService() { 31 | } 32 | 33 | @Override 34 | public Map getUserTypes(List uids) { 35 | return null; 36 | } 37 | 38 | @Override 39 | public long[] getLastStatusIds(long[] uids) { 40 | return new long[0]; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /motan-benchmark/motan-benchmark-server/src/main/java/com/weibo/motan/benchmark/MotanBenchmarkServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.motan.benchmark; 18 | 19 | import org.springframework.context.ApplicationContext; 20 | import org.springframework.context.support.ClassPathXmlApplicationContext; 21 | 22 | public class MotanBenchmarkServer { 23 | 24 | public static void main(String[] args) throws InterruptedException { 25 | ApplicationContext applicationContext = new ClassPathXmlApplicationContext( 26 | new String[]{"classpath*:motan-benchmark-server.xml"}); 27 | 28 | System.out.println("server running---"); 29 | Thread.sleep(Long.MAX_VALUE); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/admin/AdminCommandHandler.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.admin; 2 | 3 | import com.weibo.api.motan.core.extension.Scope; 4 | import com.weibo.api.motan.core.extension.Spi; 5 | import com.weibo.api.motan.rpc.Request; 6 | import com.weibo.api.motan.rpc.Response; 7 | 8 | /** 9 | * @author zhanglei28 10 | * @date 2023/11/3. 11 | */ 12 | @Spi(scope = Scope.SINGLETON) 13 | public interface AdminCommandHandler { 14 | 15 | String[] getCommandName(); // Get the list of commands that this handler can handle 16 | 17 | Response handle(Request request); 18 | } 19 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/admin/AdminHandler.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.admin; 2 | 3 | import com.weibo.api.motan.rpc.Request; 4 | import com.weibo.api.motan.rpc.Response; 5 | 6 | /** 7 | * @author zhanglei28 8 | * @date 2023/11/3. 9 | */ 10 | public interface AdminHandler { 11 | /** 12 | * @param request 请求参数统一为Map。 如果有复杂参数需要传递,可以自行定义Json格式的value string 13 | * @return response 返回值统一为Json格式的String 14 | */ 15 | Response handle(Request request); 16 | 17 | void addCommandHandler(AdminCommandHandler adminCommandHandler, boolean override); 18 | 19 | PermissionChecker updatePermissionChecker(PermissionChecker permissionChecker); 20 | } 21 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/admin/AdminServer.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.admin; 2 | 3 | import com.weibo.api.motan.rpc.URL; 4 | 5 | /** 6 | * @author zhanglei28 7 | * @date 2023/11/3. 8 | */ 9 | public interface AdminServer { 10 | 11 | boolean open(); 12 | 13 | void close(); 14 | 15 | URL getUrl(); 16 | 17 | AdminHandler getAdminHandler(); 18 | } 19 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/admin/AdminServerFactory.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.admin; 2 | 3 | import com.weibo.api.motan.core.extension.Scope; 4 | import com.weibo.api.motan.core.extension.Spi; 5 | import com.weibo.api.motan.rpc.URL; 6 | 7 | /** 8 | * @author zhanglei28 9 | * @date 2023/11/3. 10 | */ 11 | @Spi(scope = Scope.SINGLETON) 12 | public interface AdminServerFactory { 13 | AdminServer createServer(URL url, AdminHandler adminHandler); 14 | } 15 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/admin/PermissionChecker.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.admin; 2 | 3 | import com.weibo.api.motan.rpc.Request; 4 | 5 | /** 6 | * @author zhanglei28 7 | * @date 2023/11/3. 8 | */ 9 | public interface PermissionChecker { 10 | boolean check(Request request); 11 | } 12 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/closable/Closable.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.closable; 2 | 3 | /** 4 | * @author zhanran 5 | * Date: 2017/5/24 6 | */ 7 | public interface Closable { 8 | void close(); 9 | } 10 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/closable/ShutDownHookListener.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.closable; 2 | 3 | import javax.servlet.ServletContextEvent; 4 | import javax.servlet.ServletContextListener; 5 | 6 | /** 7 | * @author zhanran 8 | * Date: 2017/5/24 9 | * In order to shutdown motan server running in tomcat(run tomcat's shutdown.sh rather than kill PID manually),add ShutDownHookListener to web.xml 10 | * 为了关闭在tomcat中运行的motan server(运行tomcat的shutdown.sh关闭而不是手动kill pid),在web.xml中添加ShutDownHookListener 11 | */ 12 | public class ShutDownHookListener implements ServletContextListener { 13 | @Override 14 | public void contextInitialized(ServletContextEvent sce) { 15 | } 16 | 17 | @Override 18 | public void contextDestroyed(ServletContextEvent sce) { 19 | ShutDownHook.runHook(true); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/cluster/HaStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.cluster; 18 | 19 | import com.weibo.api.motan.core.extension.Scope; 20 | import com.weibo.api.motan.core.extension.Spi; 21 | import com.weibo.api.motan.rpc.Request; 22 | import com.weibo.api.motan.rpc.Response; 23 | import com.weibo.api.motan.rpc.URL; 24 | 25 | /** 26 | * 27 | * Ha strategy. 28 | * 29 | * @author fishermen 30 | * @version V1.0 created at: 2013-5-21 31 | */ 32 | @Spi(scope = Scope.PROTOTYPE) 33 | public interface HaStrategy { 34 | 35 | void setUrl(URL url); 36 | 37 | Response call(Request request, LoadBalance loadBalance); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/cluster/ha/AbstractHaStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.cluster.ha; 18 | 19 | import com.weibo.api.motan.cluster.HaStrategy; 20 | import com.weibo.api.motan.rpc.URL; 21 | 22 | /** 23 | * 24 | * Abstract ha strategy. 25 | * 26 | * @author fishermen 27 | * @version V1.0 created at: 2013-5-22 28 | */ 29 | 30 | public abstract class AbstractHaStrategy implements HaStrategy { 31 | 32 | protected URL url; 33 | 34 | @Override 35 | public void setUrl(URL url) { 36 | this.url = url; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/cluster/loadbalance/Selector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2009-2024 Weibo, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.weibo.api.motan.cluster.loadbalance; 20 | 21 | import com.weibo.api.motan.rpc.Referer; 22 | import com.weibo.api.motan.rpc.Request; 23 | 24 | /** 25 | * Package internal interface 26 | * 27 | * @author zhanglei28 28 | * @date 2024/3/26. 29 | */ 30 | interface Selector { 31 | Referer select(Request request); 32 | 33 | default void destroy() { 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/config/BasicRefererInterfaceConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.config; 18 | 19 | 20 | /** 21 | * 22 | * Base config for service and referer config. 23 | * 24 | * @author fishermen 25 | * @version V1.0 created at: 2013-6-5 26 | */ 27 | 28 | public class BasicRefererInterfaceConfig extends AbstractRefererConfig { 29 | 30 | private static final long serialVersionUID = -418351068816874749L; 31 | /** 是否默认配置 */ 32 | private Boolean isDefault; 33 | 34 | public void setDefault(boolean isDefault) { 35 | this.isDefault = isDefault; 36 | } 37 | 38 | public Boolean isDefault() { 39 | return isDefault; 40 | } 41 | 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/config/BasicServiceInterfaceConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.config; 18 | 19 | 20 | /** 21 | * 22 | * Base config for service and referer config. 23 | * 24 | * @author fishermen 25 | * @version V1.0 created at: 2013-6-5 26 | */ 27 | 28 | public class BasicServiceInterfaceConfig extends AbstractServiceConfig { 29 | 30 | private static final long serialVersionUID = 12689211620290427L; 31 | /** 是否默认配置 */ 32 | private Boolean isDefault; 33 | 34 | public void setDefault(boolean isDefault) { 35 | this.isDefault = isDefault; 36 | } 37 | 38 | public Boolean isDefault() { 39 | return isDefault; 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/config/ExtConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.config; 18 | 19 | /** 20 | * 21 | * 扩展配置的扩展点,需要在refererConfig和serviceConfig中增加更多配置的应用,通过此类扩展。 22 | * 23 | * @author fishermen 24 | * @version V1.0 created at: 2013-7-15 25 | */ 26 | 27 | public class ExtConfig extends AbstractConfig { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/config/GlobalConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2009-2022 Weibo, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.weibo.api.motan.config; 20 | 21 | import java.util.Map; 22 | import java.util.concurrent.ConcurrentHashMap; 23 | 24 | /** 25 | * @author zhanglei28 26 | * @date 2022/11/1. 27 | */ 28 | public interface GlobalConfig { 29 | 30 | String getConfig(String key); 31 | 32 | String getConfig(String key, String defaultValue); 33 | 34 | void putConfig(String key, String value); 35 | 36 | String remove(String key); 37 | 38 | void putConfigs(Map configs, boolean override); 39 | 40 | ConcurrentHashMap getConfigs(); 41 | } 42 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/core/extension/Scope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.core.extension; 18 | 19 | /** 20 | * @author maijunsheng 21 | * @version 创建时间:2013-5-28 22 | * 23 | */ 24 | public enum Scope { 25 | 26 | /** 27 | * 单例模式 28 | */ 29 | SINGLETON, 30 | 31 | /** 32 | * 多例模式 33 | */ 34 | PROTOTYPE 35 | } 36 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/core/extension/Spi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.core.extension; 18 | 19 | import java.lang.annotation.Documented; 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * @author maijunsheng 27 | * @version 创建时间:2013-5-28 28 | * 29 | */ 30 | @Documented 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({ElementType.TYPE}) 33 | public @interface Spi { 34 | 35 | Scope scope() default Scope.PROTOTYPE; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/core/extension/SpiMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.core.extension; 18 | 19 | import java.lang.annotation.Documented; 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * @author maijunsheng 27 | * @version 创建时间:2013-5-28 28 | * 29 | */ 30 | @Documented 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({ElementType.TYPE}) 33 | public @interface SpiMeta { 34 | String name() default ""; 35 | } 36 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/filter/Filter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.filter; 18 | 19 | import com.weibo.api.motan.core.extension.Spi; 20 | import com.weibo.api.motan.rpc.Caller; 21 | import com.weibo.api.motan.rpc.Request; 22 | import com.weibo.api.motan.rpc.Response; 23 | import com.weibo.api.motan.runtime.RuntimeInfo; 24 | 25 | /** 26 | * filter before transport. 27 | * 28 | * @author fishermen 29 | * @version V1.0 created at: 2013-5-16 30 | */ 31 | @Spi 32 | public interface Filter extends RuntimeInfo { 33 | 34 | Response filter(Caller caller, Request request); 35 | } 36 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/filter/InitializableFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | package com.weibo.api.motan.filter; 15 | 16 | import com.weibo.api.motan.core.extension.Scope; 17 | import com.weibo.api.motan.core.extension.Spi; 18 | import com.weibo.api.motan.rpc.Caller; 19 | 20 | /** 21 | * 22 | * @Description InitializableFilter 23 | * @author zhanglei 24 | * @date Nov 11, 2016 25 | * 26 | */ 27 | @Spi(scope = Scope.PROTOTYPE) 28 | public interface InitializableFilter extends Filter { 29 | /** 30 | * init with caller eg. referer or provider be careful when using SINGLETON scope 31 | * 32 | * @param caller 33 | */ 34 | void init(Caller caller); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/protocol/rpc/RpcProtocolVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.protocol.rpc; 18 | 19 | /** 20 | * @author maijunsheng 21 | * @version 创建时间:2013-5-22 22 | */ 23 | public enum RpcProtocolVersion { 24 | VERSION_1((byte) 1, 16), VERSION_1_Compress((byte) 2, 16), VERSION_2((byte) 3, 13);// 25 | 26 | private byte version; 27 | private int headerLength; 28 | 29 | RpcProtocolVersion(byte version, int headerLength) { 30 | this.version = version; 31 | this.headerLength = headerLength; 32 | } 33 | 34 | public byte getVersion() { 35 | return version; 36 | } 37 | 38 | public int getHeaderLength() { 39 | return headerLength; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/proxy/CommonHandler.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.proxy; 2 | 3 | import com.weibo.api.motan.rpc.Request; 4 | 5 | /** 6 | * @author sunnights 7 | * use CommonClient instead 8 | */ 9 | @Deprecated 10 | public interface CommonHandler extends CommonClient { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/proxy/ProxyFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.proxy; 18 | 19 | import com.weibo.api.motan.cluster.Cluster; 20 | import com.weibo.api.motan.core.extension.Spi; 21 | import com.weibo.api.motan.rpc.URL; 22 | import com.weibo.api.motan.transport.MeshClient; 23 | 24 | import java.util.List; 25 | 26 | /** 27 | * @author maijunsheng 28 | */ 29 | @Spi 30 | public interface ProxyFactory { 31 | 32 | T getProxy(Class clz, List> clusters); 33 | 34 | default T getProxy(Class clz, URL refUrl, MeshClient meshClient) { 35 | throw new RuntimeException(this.getClass().getName() + " not support proxy with MeshClient"); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/registry/DiscoveryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.registry; 18 | 19 | import java.util.List; 20 | 21 | import com.weibo.api.motan.rpc.URL; 22 | 23 | 24 | /** 25 | * 26 | * Deicovery service. 27 | * 28 | * @author fishermen 29 | * @version V1.0 created at: 2013-5-16 30 | */ 31 | 32 | public interface DiscoveryService { 33 | 34 | void subscribe(URL url, NotifyListener listener); 35 | 36 | void unsubscribe(URL url, NotifyListener listener); 37 | 38 | List discover(URL url); 39 | } 40 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/registry/NotifyListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.registry; 18 | 19 | import java.util.List; 20 | 21 | import com.weibo.api.motan.rpc.URL; 22 | 23 | 24 | /** 25 | * 26 | * Notify when service changed. 27 | * 28 | * @author fishermen 29 | * @version V1.0 created at: 2013-5-16 30 | */ 31 | 32 | public interface NotifyListener { 33 | 34 | void notify(URL registryUrl, List urls); 35 | } 36 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/registry/Registry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.registry; 18 | 19 | import com.weibo.api.motan.core.extension.Scope; 20 | import com.weibo.api.motan.core.extension.Spi; 21 | import com.weibo.api.motan.rpc.URL; 22 | import com.weibo.api.motan.runtime.RuntimeInfo; 23 | 24 | /** 25 | * Used to register and discover. 26 | * 27 | * @author fishermen 28 | * @version V1.0 created at: 2013-5-28 29 | */ 30 | @Spi(scope = Scope.SINGLETON) 31 | public interface Registry extends RegistryService, DiscoveryService, RuntimeInfo { 32 | 33 | URL getUrl(); 34 | } 35 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/registry/RegistryFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.registry; 18 | 19 | import com.weibo.api.motan.core.extension.Scope; 20 | import com.weibo.api.motan.core.extension.Spi; 21 | import com.weibo.api.motan.rpc.URL; 22 | 23 | /** 24 | * 25 | * To create registry 26 | * 27 | * @author fishermen 28 | * @version V1.0 created at: 2013-5-28 29 | */ 30 | @Spi(scope = Scope.SINGLETON) 31 | public interface RegistryFactory { 32 | 33 | Registry getRegistry(URL url); 34 | } 35 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/registry/support/DirectRegistryFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.registry.support; 18 | 19 | import com.weibo.api.motan.core.extension.SpiMeta; 20 | import com.weibo.api.motan.registry.Registry; 21 | import com.weibo.api.motan.rpc.URL; 22 | 23 | /** 24 | * Created by axb on 16/6/12. 25 | */ 26 | @SpiMeta(name = "direct") 27 | public class DirectRegistryFactory extends AbstractRegistryFactory { 28 | 29 | @Override 30 | protected Registry createRegistry(URL url) { 31 | return new DirectRegistry(url); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/registry/support/command/CommandListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.registry.support.command; 18 | 19 | import com.weibo.api.motan.rpc.URL; 20 | 21 | public interface CommandListener { 22 | 23 | void notifyCommand(URL refUrl, String commandString); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/registry/support/command/ServiceListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.registry.support.command; 18 | 19 | import java.util.List; 20 | 21 | import com.weibo.api.motan.rpc.URL; 22 | 23 | public interface ServiceListener { 24 | 25 | void notifyService(URL refUrl, URL registryUrl, List urls); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/Callbackable.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.rpc; 2 | 3 | import java.util.concurrent.Executor; 4 | 5 | /** 6 | * @author sunnights 7 | */ 8 | public interface Callbackable { 9 | 10 | void addFinishCallback(Runnable runnable, Executor executor); 11 | 12 | void onFinish(); 13 | 14 | default Callbackable getCallbackHolder(){ 15 | return null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/Caller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.rpc; 18 | 19 | /** 20 | * 21 | * 类说明 22 | * 23 | * @author fishermen 24 | * @version V1.0 created at: 2013-5-17 25 | */ 26 | 27 | public interface Caller extends Node { 28 | 29 | Class getInterface(); 30 | 31 | Response call(Request request); 32 | } 33 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/Exporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.rpc; 18 | 19 | /** 20 | * 21 | * Export service providers. 22 | * 23 | * @author fishermen 24 | * @version V1.0 created at: 2013-5-16 25 | */ 26 | 27 | public interface Exporter extends Node { 28 | 29 | Provider getProvider(); 30 | 31 | void unexport(); 32 | } 33 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/Node.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.rpc; 18 | 19 | import com.weibo.api.motan.runtime.RuntimeInfo; 20 | 21 | /** 22 | * node manage interface 23 | * 24 | * @author maijunsheng 25 | */ 26 | public interface Node extends RuntimeInfo { 27 | 28 | void init(); 29 | 30 | void destroy(); 31 | 32 | boolean isAvailable(); 33 | 34 | String desc(); 35 | 36 | URL getUrl(); 37 | } 38 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/Provider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.rpc; 18 | 19 | import com.weibo.api.motan.core.extension.Scope; 20 | import com.weibo.api.motan.core.extension.Spi; 21 | 22 | import java.lang.reflect.Method; 23 | 24 | /** 25 | * 26 | * Service provider. 27 | * 28 | * @author fishermen 29 | * @version V1.0 created at: 2013-5-16 30 | */ 31 | @Spi(scope = Scope.PROTOTYPE) 32 | public interface Provider extends Caller { 33 | 34 | Class getInterface(); 35 | 36 | Method lookupMethod(String methodName, String methodDesc); 37 | 38 | T getImpl(); 39 | } 40 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/ProviderFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2009-2016 Weibo, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.weibo.api.motan.rpc; 20 | 21 | /** 22 | * Created by zhanglei28 on 2017/10/17. 23 | */ 24 | public interface ProviderFactory { 25 | 26 | Provider newProvider(T proxyImpl, URL url, Class clz); 27 | } 28 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/Referer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.rpc; 18 | 19 | import com.weibo.api.motan.core.extension.Scope; 20 | import com.weibo.api.motan.core.extension.Spi; 21 | 22 | /** 23 | * 24 | * Refer to a service. 25 | * 26 | * @author fishermen 27 | * @version V1.0 created at: 2013-5-16 28 | */ 29 | @Spi(scope = Scope.PROTOTYPE) 30 | public interface Referer extends Caller, Node { 31 | 32 | /** 33 | * 当前使用该referer的调用数 34 | * 35 | * @return 36 | */ 37 | int activeRefererCount(); 38 | 39 | /** 40 | * 获取referer的原始service url 41 | * 42 | * @return 43 | */ 44 | URL getServiceUrl(); 45 | } 46 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/ResponseFuture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | package com.weibo.api.motan.rpc; 15 | 16 | public interface ResponseFuture extends Future, Response { 17 | // for client end 18 | void onSuccess(Response response); 19 | 20 | // for client end 21 | void onFailure(Response response); 22 | 23 | // for server end 24 | void onSuccess(Object value); 25 | 26 | // for server end 27 | void onFailure(Exception e); 28 | 29 | long getCreateTime(); 30 | 31 | void setReturnType(Class clazz); 32 | } 33 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/Traceable.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.rpc; 2 | 3 | /** 4 | * @author sunnights 5 | */ 6 | public interface Traceable { 7 | TraceableContext getTraceableContext(); 8 | } 9 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/rpc/init/Initializable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | package com.weibo.api.motan.rpc.init; 15 | 16 | import com.weibo.api.motan.core.extension.Scope; 17 | import com.weibo.api.motan.core.extension.Spi; 18 | 19 | /** 20 | * 21 | * @Description Initializable. the implement must be thread safe! 22 | * @author zhanglei 23 | * @date 2016-6-15 24 | * 25 | */ 26 | @Spi(scope = Scope.SINGLETON) 27 | public interface Initializable { 28 | void init(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/runtime/RuntimeInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2009-2024 Weibo, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.weibo.api.motan.runtime; 20 | 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | 24 | /** 25 | * @author zhanglei28 26 | * @date 2024/2/29. 27 | */ 28 | public interface RuntimeInfo { 29 | // The value of map must be composed of nested map, list, and basic data types. 30 | default Map getRuntimeInfo() { 31 | return new HashMap<>(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/runtime/meta/MetaService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2009-2024 Weibo, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.weibo.api.motan.runtime.meta; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * @author zhanglei28 25 | * @date 2024/3/13. 26 | */ 27 | public interface MetaService { 28 | // get host level dynamic meta info. 29 | Map getDynamicMeta(); 30 | } 31 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/switcher/SwitcherListener.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.switcher; 2 | 3 | /** 4 | * Created by axb on 16/4/25. 5 | */ 6 | public interface SwitcherListener { 7 | 8 | void onValueChanged(String key,Boolean value); 9 | } 10 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/transport/Client.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.transport; 18 | 19 | import com.weibo.api.motan.rpc.Request; 20 | 21 | /** 22 | * 23 | * 类说明 24 | * 25 | * @author fishermen 26 | * @version V1.0 created at: 2013-5-21 27 | */ 28 | 29 | public interface Client extends Endpoint { 30 | /** 31 | * async send request. 32 | * 33 | * @param request 34 | */ 35 | void heartbeat(Request request); 36 | } 37 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/transport/Endpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.transport; 18 | 19 | /** 20 | * 21 | * Endpoint of client or server. 22 | * 23 | * @author fishermen 24 | * @version V1.0 created at: 2013-5-21 25 | */ 26 | 27 | public interface Endpoint extends Channel { 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/transport/EndpointManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.transport; 18 | 19 | /** 20 | * @author maijunsheng 21 | * @version 创建时间:2013-6-14 22 | * 23 | */ 24 | public interface EndpointManager { 25 | 26 | void init(); 27 | 28 | void destroy(); 29 | 30 | void addEndpoint(Endpoint endpoint); 31 | 32 | void removeEndpoint(Endpoint endpoint); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/transport/MessageHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.transport; 18 | 19 | 20 | import com.weibo.api.motan.runtime.RuntimeInfo; 21 | 22 | /** 23 | * @author maijunsheng 24 | * @version 创建时间:2013-6-4 25 | */ 26 | public interface MessageHandler extends RuntimeInfo { 27 | 28 | Object handle(Channel channel, Object message); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/transport/ProviderProtectedStrategy.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.transport; 2 | 3 | import com.weibo.api.motan.core.extension.Scope; 4 | import com.weibo.api.motan.core.extension.Spi; 5 | import com.weibo.api.motan.rpc.Provider; 6 | import com.weibo.api.motan.rpc.Request; 7 | import com.weibo.api.motan.rpc.Response; 8 | import com.weibo.api.motan.runtime.RuntimeInfo; 9 | 10 | import java.util.concurrent.atomic.AtomicInteger; 11 | 12 | /** 13 | * Created by chenxl on 2020/6/9. 14 | */ 15 | @Spi(scope = Scope.PROTOTYPE) 16 | public interface ProviderProtectedStrategy extends RuntimeInfo { 17 | 18 | Response call(Request request, Provider provider); 19 | 20 | void setMethodCounter(AtomicInteger methodCounter); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/transport/SharedObjectFactory.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.transport; 2 | 3 | /** 4 | * @author sunnights 5 | */ 6 | public interface SharedObjectFactory { 7 | 8 | /** 9 | * 创建对象 10 | * 11 | * @return 12 | */ 13 | T makeObject(); 14 | 15 | /** 16 | * 重建对象 17 | * 18 | * @param obj 19 | * @param async 20 | * @return 21 | */ 22 | boolean rebuildObject(T obj, boolean async); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/transport/UnprotectedStrategy.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.transport; 2 | 3 | import com.weibo.api.motan.core.extension.SpiMeta; 4 | import com.weibo.api.motan.rpc.Provider; 5 | import com.weibo.api.motan.rpc.Request; 6 | import com.weibo.api.motan.rpc.Response; 7 | 8 | import java.util.concurrent.atomic.AtomicInteger; 9 | 10 | /** 11 | * Created by chenxl on 2020/6/9. 12 | */ 13 | @SpiMeta(name = "none") 14 | public class UnprotectedStrategy implements ProviderProtectedStrategy { 15 | 16 | public UnprotectedStrategy() { 17 | } 18 | 19 | @Override 20 | public Response call(Request request, Provider provider) { 21 | return provider.call(request); 22 | } 23 | 24 | @Override 25 | public void setMethodCounter(AtomicInteger methodCounter) { 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/transport/async/MotanAsync.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | package com.weibo.api.motan.transport.async; 15 | 16 | import java.lang.annotation.Documented; 17 | import java.lang.annotation.ElementType; 18 | import java.lang.annotation.Retention; 19 | import java.lang.annotation.RetentionPolicy; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * 24 | * @Description async request annotation 25 | * @author zhanglei 26 | * @date Feb 21, 2017 27 | * 28 | */ 29 | @Documented 30 | @Target({ElementType.TYPE}) 31 | @Retention(RetentionPolicy.SOURCE) 32 | public @interface MotanAsync { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /motan-core/src/main/java/com/weibo/api/motan/util/StatisticCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.util; 18 | 19 | /** 20 | * 统计扩展接口,需要统计的资源自行实现后 registry到StatsUtil便可以 21 | * 22 | * @author maijunsheng 23 | * @version 创建时间:2013-6-24 24 | * 25 | */ 26 | public interface StatisticCallback { 27 | 28 | String statisticCallback(); 29 | } 30 | -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/maven/archetype.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | weibo-commons-rpc-core 19 | 20 | src/main/java/App.java 21 | 22 | 23 | src/test/java/AppTest.java 24 | 25 | 26 | -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.admin.AdminCommandHandler: -------------------------------------------------------------------------------- 1 | com.weibo.api.motan.admin.handler.FaultInjectCommandHandler -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.cluster.Cluster: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.cluster.support.ClusterSpi -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.cluster.HaStrategy: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.cluster.ha.FailoverHaStrategy 18 | com.weibo.api.motan.cluster.ha.FailfastHaStrategy -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.cluster.LoadBalance: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.cluster.loadbalance.RandomLoadBalance 18 | com.weibo.api.motan.cluster.loadbalance.ConsistentHashLoadBalance 19 | com.weibo.api.motan.cluster.loadbalance.ActiveWeightLoadBalance 20 | com.weibo.api.motan.cluster.loadbalance.RoundRobinLoadBalance 21 | com.weibo.api.motan.cluster.loadbalance.LocalFirstLoadBalance 22 | com.weibo.api.motan.cluster.loadbalance.ConfigurableWeightLoadBalance 23 | com.weibo.api.motan.cluster.loadbalance.WeightRoundRobinLoadBalance -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.codec.Codec: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.protocol.rpc.DefaultRpcCodec 18 | com.weibo.api.motan.protocol.rpc.CompressRpcCodec 19 | com.weibo.api.motan.protocol.v2motan.MotanV2Codec 20 | com.weibo.api.motan.protocol.v2motan.CompatibleCodec -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.codec.Serialization: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.serialize.Hessian2Serialization 18 | com.weibo.api.motan.serialize.FastJsonSerialization 19 | com.weibo.api.motan.serialize.SimpleSerialization 20 | com.weibo.api.motan.serialize.BreezeSerialization 21 | -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.config.handler.ConfigHandler: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.config.handler.SimpleConfigHandler -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.filter.Filter: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.filter.AccessLogFilter 18 | com.weibo.api.motan.filter.ActiveLimitFilter 19 | com.weibo.api.motan.filter.AccessStatisticFilter 20 | com.weibo.api.motan.filter.SwitcherFilter 21 | com.weibo.api.motan.filter.ServiceMockFilter 22 | com.weibo.api.motan.filter.ThreadProtectedFilter 23 | com.weibo.api.motan.filter.FaultInjectionFilter 24 | com.weibo.api.motan.filter.GlobalDynamicFilter -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.proxy.ProxyFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.proxy.spi.CommonProxyFactory 18 | com.weibo.api.motan.proxy.spi.JdkProxyFactory -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.registry.Registry: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.registry.support.LocalRegistryService -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.registry.RegistryFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.registry.support.LocalRegistryFactory 18 | com.weibo.api.motan.registry.support.DirectRegistryFactory 19 | -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.rpc.Protocol: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.protocol.injvm.InjvmProtocol 18 | com.weibo.api.motan.protocol.rpc.DefaultRpcProtocol 19 | com.weibo.api.motan.protocol.v2motan.MotanV2Protocol -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.rpc.init.Initializable: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright 2009-2023 Weibo, Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # 18 | 19 | com.weibo.api.motan.admin.AdminInitialization -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.switcher.SwitcherService: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.switcher.LocalSwitcherService -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.transport.HeartbeatFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.transport.support.DefaultRpcHeartbeatFactory -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/com.weibo.api.motan.transport.ProviderProtectedStrategy: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.transport.DefaultProtectedStrategy 18 | com.weibo.api.motan.transport.UnprotectedStrategy -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | com.weibo.api.motan.transport.async.MotanAsyncProcessor 2 | -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/spring.handlers: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | http\://api.weibo.com/schema/motan=com.weibo.api.motan.config.springsupport.MotanNamespaceHandler -------------------------------------------------------------------------------- /motan-core/src/main/resources/META-INF/spring.schemas: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | http\://api.weibo.com/schema/motan.xsd=META-INF/motan.xsd -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/TestConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan; 18 | 19 | import com.weibo.api.motan.rpc.URL; 20 | 21 | public class TestConstants { 22 | public static final URL EMPTY_URL = new URL("", "127.0.0.1", 0, ""); 23 | } 24 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/core/extension/SpiPrototypeInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.core.extension; 18 | 19 | /** 20 | * @author maijunsheng 21 | * @version 创建时间:2013-5-29 22 | * 23 | */ 24 | @Spi(scope = Scope.PROTOTYPE) 25 | public interface SpiPrototypeInterface { 26 | long spiHello(); 27 | } 28 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/core/extension/SpiPrototypeTestImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.core.extension; 18 | 19 | import java.util.concurrent.atomic.AtomicLong; 20 | 21 | /** 22 | * @author maijunsheng 23 | * @version 创建时间:2013-5-29 24 | * 25 | */ 26 | @SpiMeta(name = "spiPrototypeTest") 27 | public class SpiPrototypeTestImpl implements SpiPrototypeInterface { 28 | private static AtomicLong counter = new AtomicLong(0); 29 | private long index = 0; 30 | 31 | public SpiPrototypeTestImpl() { 32 | index = counter.incrementAndGet(); 33 | } 34 | 35 | @Override 36 | public long spiHello() { 37 | return index; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/core/extension/SpiTestImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.core.extension; 18 | 19 | import java.util.concurrent.atomic.AtomicLong; 20 | 21 | /** 22 | * @author maijunsheng 23 | * @version 创建时间:2013-5-29 24 | * 25 | */ 26 | @SpiMeta(name = "spitest") 27 | public class SpiTestImpl implements SpiTestInterface { 28 | private static AtomicLong counter = new AtomicLong(0); 29 | private long index = 0; 30 | 31 | public SpiTestImpl() { 32 | index = counter.incrementAndGet(); 33 | } 34 | 35 | @Override 36 | public long spiHello() { 37 | return index; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/core/extension/SpiTestInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.core.extension; 18 | 19 | /** 20 | * @author maijunsheng 21 | * @version 创建时间:2013-5-29 22 | * 23 | */ 24 | @Spi(scope = Scope.SINGLETON) 25 | public interface SpiTestInterface { 26 | long spiHello(); 27 | } 28 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/protocol/example/IWorld.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.protocol.example; 18 | 19 | /** 20 | * @author maijunsheng 21 | * @version 创建时间:2013-6-6 22 | * 23 | */ 24 | public interface IWorld { 25 | String world(); 26 | 27 | String world(String world); 28 | 29 | String worldSleep(String world, int sleep); 30 | } 31 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/protocol/example/IWorldAsync.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2009-2023 Weibo, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.weibo.api.motan.protocol.example; 20 | 21 | import com.weibo.api.motan.rpc.ResponseFuture; 22 | 23 | /** 24 | * @author zhanglei28 25 | * @date 2023/10/19. 26 | */ 27 | public interface IWorldAsync extends IWorld { 28 | ResponseFuture worldAsync(); 29 | 30 | ResponseFuture worldAsync(String world); 31 | 32 | ResponseFuture worldSleepAsync(String world, int sleep); 33 | } 34 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/protocol/example/UnSerializableClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * 19 | */ 20 | package com.weibo.api.motan.protocol.example; 21 | 22 | /** 23 | * @author bozheng 24 | * 25 | */ 26 | public class UnSerializableClass { 27 | 28 | public String hello() { 29 | return "I am a unserializable class"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/transport/ProviderA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.transport; 18 | 19 | /** 20 | * @author maijunsheng 21 | * @version 创建时间:2013-6-18 22 | * 23 | */ 24 | public interface ProviderA { 25 | String providerA(); 26 | } 27 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/transport/ProviderB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.transport; 18 | 19 | /** 20 | * @author maijunsheng 21 | * @version 创建时间:2013-6-18 22 | * 23 | */ 24 | public interface ProviderB extends ProviderA { 25 | String providerB(); 26 | } 27 | -------------------------------------------------------------------------------- /motan-core/src/test/java/com/weibo/api/motan/transport/ProviderC.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.transport; 18 | 19 | /** 20 | * @author maijunsheng 21 | * @version 创建时间:2013-6-18 22 | * 23 | */ 24 | public interface ProviderC extends ProviderB { 25 | String providerC(); 26 | } 27 | -------------------------------------------------------------------------------- /motan-core/src/test/resources/META-INF/services/com.weibo.api.motan.core.extension.SpiPrototypeInterface: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.core.extension.SpiPrototypeTestImpl -------------------------------------------------------------------------------- /motan-core/src/test/resources/META-INF/services/com.weibo.api.motan.core.extension.SpiTestInterface: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.core.extension.SpiTestImpl -------------------------------------------------------------------------------- /motan-core/src/test/resources/META-INF/services/com.weibo.api.motan.filter.Filter: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2024 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.filter.GlobalDynamicFilterTest$TestInnerFilter -------------------------------------------------------------------------------- /motan-core/src/test/resources/META-INF/services/com.weibo.api.motan.transport.EndpointFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.mock.MockEndpointFactory -------------------------------------------------------------------------------- /motan-core/src/test/resources/motan.properties: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright 2009-2022 Weibo, Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # 18 | 19 | testGlobalKey=testValue 20 | test_key= test_value 21 | onlyKey= 22 | =onlyValue -------------------------------------------------------------------------------- /motan-demo/motan-demo-api/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-api/src/main/java/com/weibo/motan/demo/service/MotanDemoService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.motan.demo.service; 18 | 19 | import com.weibo.api.motan.transport.async.MotanAsync; 20 | import com.weibo.motan.demo.service.model.User; 21 | 22 | @MotanAsync 23 | public interface MotanDemoService { 24 | String hello(String name); 25 | 26 | User rename(User user, String name) throws Exception; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-api/src/main/java/com/weibo/motan/demo/service/PbParamService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2009-2016 Weibo, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.weibo.motan.demo.service; 20 | 21 | import io.grpc.examples.routeguide.Feature; 22 | import io.grpc.examples.routeguide.Point; 23 | 24 | /** 25 | * Created by zhanglei28 on 2017/9/12. 26 | */ 27 | public interface PbParamService { 28 | 29 | Feature getFeature(Point point); 30 | } 31 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-api/src/main/java/com/weibo/motan/demo/service/TestSuperInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | package com.weibo.motan.demo.service; 15 | 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | public interface TestSuperInterface { 20 | String extendsMethod(Map map); 21 | 22 | List extendsMethod2(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-api/src/main/java/io/grpc/examples/routeguide/FeatureDatabaseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: route_guide.proto 3 | 4 | package io.grpc.examples.routeguide; 5 | 6 | public interface FeatureDatabaseOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:routeguide.FeatureDatabase) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * repeated .routeguide.Feature feature = 1; 12 | */ 13 | java.util.List 14 | getFeatureList(); 15 | /** 16 | * repeated .routeguide.Feature feature = 1; 17 | */ 18 | io.grpc.examples.routeguide.Feature getFeature(int index); 19 | /** 20 | * repeated .routeguide.Feature feature = 1; 21 | */ 22 | int getFeatureCount(); 23 | /** 24 | * repeated .routeguide.Feature feature = 1; 25 | */ 26 | java.util.List 27 | getFeatureOrBuilderList(); 28 | /** 29 | * repeated .routeguide.Feature feature = 1; 30 | */ 31 | io.grpc.examples.routeguide.FeatureOrBuilder getFeatureOrBuilder( 32 | int index); 33 | } 34 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-api/src/main/java/io/grpc/examples/routeguide/PointOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: route_guide.proto 3 | 4 | package io.grpc.examples.routeguide; 5 | 6 | public interface PointOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:routeguide.Point) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * optional int32 latitude = 1; 12 | */ 13 | int getLatitude(); 14 | 15 | /** 16 | * optional int32 longitude = 2; 17 | */ 18 | int getLongitude(); 19 | } 20 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-api/src/main/java/io/grpc/examples/routeguide/RouteSummaryOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: route_guide.proto 3 | 4 | package io.grpc.examples.routeguide; 5 | 6 | public interface RouteSummaryOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:routeguide.RouteSummary) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | *
12 |    * The number of points received.
13 |    * 
14 | * 15 | * optional int32 point_count = 1; 16 | */ 17 | int getPointCount(); 18 | 19 | /** 20 | *
21 |    * The number of known features passed while traversing the route.
22 |    * 
23 | * 24 | * optional int32 feature_count = 2; 25 | */ 26 | int getFeatureCount(); 27 | 28 | /** 29 | *
30 |    * The distance covered in metres.
31 |    * 
32 | * 33 | * optional int32 distance = 3; 34 | */ 35 | int getDistance(); 36 | 37 | /** 38 | *
39 |    * The duration of the traversal in seconds.
40 |    * 
41 | * 42 | * optional int32 elapsed_time = 4; 43 | */ 44 | int getElapsedTime(); 45 | } 46 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-api/src/main/resources/META-INF/breeze/com.weibo.motan.demo.service.model.User.breeze: -------------------------------------------------------------------------------- 1 | // auto generated by breeze-maven-plugin (https://github.com/weibreeze/breeze) 2 | option java_package = com.weibo.motan.demo.service.model; 3 | 4 | package com.weibo.motan.demo.service.model; 5 | 6 | message User{ 7 | int32 id = 1; 8 | string name = 2; 9 | } 10 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-client/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-client/src/main/assembly/assembly.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | assembly 18 | 19 | tar.gz 20 | 21 | true 22 | 23 | 24 | ${project.basedir}/src/main/bin 25 | bin 26 | 0755 27 | 28 | 29 | 30 | 31 | lib 32 | 33 | 34 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-client/src/main/bin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd `dirname $0` 3 | cd ../lib 4 | LIB_DIR=`pwd` 5 | 6 | SERVER_NAME='com.weibo.motan.demo.client.DemoRpcClient' 7 | PIDS=`ps -ef | grep java | grep "$LIB_DIR" |grep $SERVER_NAME|awk '{print $2}'` 8 | if [ -n "$PIDS" ]; then 9 | echo "start fail! The $SERVER_NAME already started!" 10 | exit 1 11 | fi 12 | 13 | 14 | LIB_JARS=`ls $LIB_DIR|grep .jar|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"` 15 | cd .. 16 | java -Djava.net.preferIPv4Stack=true -server -Xms1g -Xmx1g -XX:PermSize=128m -classpath $LIB_JARS $SERVER_NAME -------------------------------------------------------------------------------- /motan-demo/motan-demo-client/src/main/bin/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | PWD=`pwd` 3 | cd `dirname $0` 4 | cd ../lib 5 | LIB_DIR=`pwd` 6 | 7 | SERVER_NAME='com.weibo.motan.demo.client.DemoRpcClient' 8 | PIDS=`ps -ef | grep java | grep "$LIB_DIR" |grep $SERVER_NAME|awk '{print $2}'` 9 | if [ -z "$PIDS" ]; then 10 | echo "stop fail! The $SERVER_NAME not start!" 11 | exit 1 12 | fi 13 | 14 | for PID in $PIDS ; 15 | do 16 | kill $PID > /dev/null 2>&1 17 | done 18 | echo "stop success! pid:"$PIDS 19 | cd $PWD 20 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-client/src/main/java/com/weibo/motan/demo/client/DemoRpcHandler.java: -------------------------------------------------------------------------------- 1 | package com.weibo.motan.demo.client; 2 | 3 | import com.weibo.api.motan.config.springsupport.annotation.MotanReferer; 4 | import com.weibo.api.motan.util.LoggerUtil; 5 | import com.weibo.motan.demo.service.MotanDemoService; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * Created by fld on 16/6/1. 10 | */ 11 | @Component 12 | public class DemoRpcHandler { 13 | 14 | @MotanReferer 15 | private MotanDemoService motanDemoService; 16 | 17 | public void test() { 18 | for (int i = 0; i < 10; i++) { 19 | System.out.println(motanDemoService.hello("motan handler" + i)); 20 | LoggerUtil.info("motan handler" + i); 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-client/src/main/java/com/weibo/motan/demo/client/YarClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | package com.weibo.motan.demo.client; 15 | 16 | import com.weibo.yar.yarclient.HttpYarClient; 17 | 18 | public class YarClient { 19 | 20 | public static void main(String[] args) throws Exception { 21 | HttpYarClient yarClient = new HttpYarClient(); 22 | String result = yarClient.call("http://127.0.0.1:8003/openapi/yarserver/test", "testString", String.class, "yar"); 23 | System.out.println(result); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-server/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-server/src/main/assembly/assembly.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | assembly 18 | 19 | tar.gz 20 | 21 | true 22 | 23 | 24 | ${project.basedir}/src/main/bin 25 | bin 26 | 0755 27 | 28 | 29 | 30 | 31 | lib 32 | 33 | 34 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-server/src/main/bin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd `dirname $0` 3 | cd ../lib 4 | LIB_DIR=`pwd` 5 | 6 | SERVER_NAME='com.weibo.motan.demo.server.DemoRpcServer' 7 | PIDS=`ps -ef | grep java | grep "$LIB_DIR" |grep $SERVER_NAME|awk '{print $2}'` 8 | if [ -n "$PIDS" ]; then 9 | echo "start fail! The $SERVER_NAME already started!" 10 | exit 1 11 | fi 12 | 13 | 14 | LIB_JARS=`ls $LIB_DIR|grep .jar|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"` 15 | cd .. 16 | nohup java -Djava.net.preferIPv4Stack=true -server -Xms1g -Xmx1g -XX:PermSize=128m -classpath $LIB_JARS $SERVER_NAME nohup.out 2>&1 & 17 | echo "start "$SERVER_NAME" success!" -------------------------------------------------------------------------------- /motan-demo/motan-demo-server/src/main/bin/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | PWD=`pwd` 3 | cd `dirname $0` 4 | cd ../lib 5 | LIB_DIR=`pwd` 6 | 7 | SERVER_NAME='com.weibo.motan.demo.server.DemoRpcServer' 8 | PIDS=`ps -ef | grep java | grep "$LIB_DIR" |grep $SERVER_NAME|awk '{print $2}'` 9 | if [ -z "$PIDS" ]; then 10 | echo "stop fail! The $SERVER_NAME not start!" 11 | exit 1 12 | fi 13 | 14 | for PID in $PIDS ; 15 | do 16 | kill $PID > /dev/null 2>&1 17 | done 18 | echo "stop success! pid:"$PIDS 19 | cd $PWD 20 | -------------------------------------------------------------------------------- /motan-demo/motan-demo-server/src/main/java/com/weibo/motan/demo/server/PbParamServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2009-2016 Weibo, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package com.weibo.motan.demo.server; 20 | 21 | import com.weibo.motan.demo.service.PbParamService; 22 | import io.grpc.examples.routeguide.Feature; 23 | import io.grpc.examples.routeguide.Point; 24 | 25 | /** 26 | * Created by zhanglei28 on 2017/9/12. 27 | */ 28 | public class PbParamServiceImpl implements PbParamService{ 29 | @Override 30 | public Feature getFeature(Point point) { 31 | return Feature.newBuilder().setName("testfeature").setLocation(point).build(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /motan-extension/codec-extension/src/main/resources/META-INF/services/com.weibo.api.motan.codec.Codec: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.codec.ProtobufCodec 18 | -------------------------------------------------------------------------------- /motan-extension/filter-extension/filter-opentracing/src/main/resources/META-INF/services/com.weibo.api.motan.filter.Filter: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.filter.opentracing.OpenTracingFilter -------------------------------------------------------------------------------- /motan-extension/filter-extension/filter-opentracing/src/test/java/com/weibo/api/motan/filter/opentracing/HelloService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.weibo.api.motan.filter.opentracing; 17 | 18 | public interface HelloService { 19 | String sayHello(String name); 20 | } 21 | -------------------------------------------------------------------------------- /motan-extension/filter-extension/filter-opentracing/src/test/java/com/weibo/api/motan/filter/opentracing/HelloServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.weibo.api.motan.filter.opentracing; 17 | 18 | public class HelloServiceImpl implements HelloService { 19 | 20 | @Override 21 | public String sayHello(String name) { 22 | return "hello," + name; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /motan-extension/filter-extension/filter-opentracing/src/test/java/com/weibo/api/motan/filter/opentracing/zipkin/demo/HelloServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.weibo.api.motan.filter.opentracing.zipkin.demo; 17 | 18 | import org.springframework.context.ApplicationContext; 19 | import org.springframework.context.support.ClassPathXmlApplicationContext; 20 | 21 | public class HelloServer { 22 | public static void main(String[] args) { 23 | //set tracer implementation by spring config. see motan_server.xml 24 | 25 | ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:motan_server.xml"); 26 | System.out.println("server start..."); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /motan-extension/filter-extension/filter-opentracing/src/test/java/com/weibo/api/motan/filter/opentracing/zipkin/demo/MyTracerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | package com.weibo.api.motan.filter.opentracing.zipkin.demo; 15 | 16 | import io.opentracing.Tracer; 17 | import io.opentracing.impl.BraveTracer; 18 | import io.opentracing.mock.MockTracer; 19 | 20 | import com.weibo.api.motan.filter.opentracing.TracerFactory; 21 | 22 | public class MyTracerFactory implements TracerFactory { 23 | // any tracer implementation 24 | final Tracer mockTracer = new MockTracer(); 25 | final Tracer braveTracer = new BraveTracer(); 26 | 27 | @Override 28 | public Tracer getTracer() { 29 | // return mockTracer; 30 | return braveTracer; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /motan-extension/filter-extension/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 13 | 4.0.0 14 | 15 | com.weibo 16 | motan-extension 17 | 1.2.5-SNAPSHOT 18 | 19 | filter-extension 20 | filter-extension 21 | https://github.com/weibocom/motan 22 | pom 23 | 24 | filter-opentracing 25 | 26 | 27 | -------------------------------------------------------------------------------- /motan-extension/protocol-extension/motan-protocol-grpc/src/main/resources/META-INF/services/com.weibo.api.motan.rpc.Protocol: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.protocol.grpc.GrpcProtocol -------------------------------------------------------------------------------- /motan-extension/protocol-extension/motan-protocol-restful/src/main/java/com/weibo/api/motan/protocol/restful/RestServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.weibo.api.motan.protocol.restful; 17 | 18 | import org.jboss.resteasy.spi.ResteasyDeployment; 19 | 20 | public interface RestServer { 21 | 22 | void start(); 23 | 24 | ResteasyDeployment getDeployment(); 25 | 26 | void stop(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /motan-extension/protocol-extension/motan-protocol-restful/src/main/resources/META-INF/services/com.weibo.api.motan.protocol.restful.EndpointFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.protocol.restful.support.netty.NettyEndpointFactory 18 | com.weibo.api.motan.protocol.restful.support.servlet.ServletEndpointFactory -------------------------------------------------------------------------------- /motan-extension/protocol-extension/motan-protocol-restful/src/main/resources/META-INF/services/com.weibo.api.motan.rpc.Protocol: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.protocol.restful.RestfulProtocol -------------------------------------------------------------------------------- /motan-extension/protocol-extension/motan-protocol-restful/src/test/resources/META-INF/services/com.weibo.api.motan.filter.Filter: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.protocol.restful.ClientFilter 18 | com.weibo.api.motan.protocol.restful.ServerFilter 19 | -------------------------------------------------------------------------------- /motan-extension/protocol-extension/motan-protocol-yar/src/main/java/com/weibo/api/motan/protocol/yar/annotation/YarConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.weibo.api.motan.protocol.yar.annotation; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * 25 | * @Description yar rpc config 26 | * @author zhanglei 27 | * @date 2016-6-7 28 | * 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target({ElementType.TYPE}) 32 | public @interface YarConfig { 33 | /** 34 | * yar rpc request path 35 | * @return path 36 | */ 37 | String path() default ""; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /motan-extension/protocol-extension/motan-protocol-yar/src/main/resources/META-INF/services/com.weibo.api.motan.rpc.Protocol: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.protocol.yar.YarRpcProtocol -------------------------------------------------------------------------------- /motan-extension/protocol-extension/motan-protocol-yar/src/main/resources/META-INF/services/com.weibo.api.motan.transport.EndpointFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.transport.netty4.yar.Netty4YarEndpointFactory -------------------------------------------------------------------------------- /motan-extension/protocol-extension/motan-protocol-yar/src/main/resources/META-INF/services/com.weibo.api.motan.transport.HeartbeatFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.transport.netty4.http.NoHeartbeatFactory -------------------------------------------------------------------------------- /motan-extension/serialization-extension/src/main/java/com/weibo/api/motan/serialize/GrpcPbJsonSerialization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.serialize; 18 | 19 | import com.weibo.api.motan.core.extension.SpiMeta; 20 | 21 | /** 22 | * Created by zhanglei28 on 2017/5/15. 23 | * grpc pb json 仅作为不同序列化标识,序列化处理逻辑与grpc pb一致 24 | */ 25 | @SpiMeta(name = "grpc-pb-json") 26 | public class GrpcPbJsonSerialization extends GrpcPbSerialization { 27 | 28 | @Override 29 | public int getSerializationNumber() { 30 | return 7; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /motan-extension/serialization-extension/src/main/resources/META-INF/services/com.weibo.api.motan.codec.Serialization: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.serialize.HproseSerialization 18 | com.weibo.api.motan.serialize.ProtobufSerialization 19 | com.weibo.api.motan.serialize.GrpcPbSerialization 20 | com.weibo.api.motan.serialize.GrpcPbJsonSerialization 21 | -------------------------------------------------------------------------------- /motan-extension/serialization-extension/src/test/java/com/weibo/api/motan/serialize/protobuf/HelloService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.weibo.api.motan.serialize.protobuf; 17 | 18 | import com.weibo.api.motan.serialize.protobuf.gen.UserProto.Address; 19 | import com.weibo.api.motan.serialize.protobuf.gen.UserProto.User; 20 | 21 | public interface HelloService { 22 | 23 | Address queryByUid(int uid); 24 | 25 | Long boxIfNotZero(int value); 26 | 27 | boolean isUserAddress(User user, Address address); 28 | 29 | void testException() throws UnsupportedOperationException; 30 | 31 | boolean isNull(User user); 32 | 33 | User copy(User origin); 34 | 35 | String sumAsString(int a, int b); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /motan-extension/serialization-extension/src/test/resources/protobuf/User.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | option java_package = "com.weibo.api.motan.serialize.protobuf.gen"; 3 | option java_outer_classname = "UserProto"; 4 | 5 | message User{ 6 | int32 id = 1; 7 | string name = 2; 8 | bool gender = 3; 9 | repeated Address address = 4; 10 | } 11 | 12 | message Address{ 13 | int32 id = 1; 14 | string province = 2; 15 | string city = 3; 16 | string street = 4; 17 | string phone = 5; 18 | } 19 | -------------------------------------------------------------------------------- /motan-extension/serialization-extension/src/test/resources/protobuf/User2.proto: -------------------------------------------------------------------------------- 1 | option java_package = "com.weibo.api.motan.serialize.protobuf.gen2"; 2 | option java_outer_classname = "UserProto2"; 3 | 4 | message User{ 5 | required int32 id = 1; 6 | required string name = 2; 7 | optional bool gender = 3; 8 | repeated Address address = 4; 9 | } 10 | 11 | message Address{ 12 | required int32 id = 1; 13 | optional string province = 2; 14 | optional string city = 3; 15 | optional string street = 4; 16 | required string phone = 5; 17 | } 18 | -------------------------------------------------------------------------------- /motan-manager/src/main/java/com/weibo/dao/OperationRecordMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.dao; 18 | 19 | import com.weibo.model.OperationRecord; 20 | import org.springframework.stereotype.Component; 21 | 22 | import java.util.List; 23 | 24 | public interface OperationRecordMapper { 25 | OperationRecord selectByPrimaryKey(Integer id); 26 | 27 | List selectAll(); 28 | 29 | int deleteByPrimaryKey(Integer id); 30 | 31 | int insert(OperationRecord record); 32 | 33 | int insertSelective(OperationRecord record); 34 | 35 | int updateByPrimaryKeySelective(OperationRecord record); 36 | 37 | int updateByPrimaryKey(OperationRecord record); 38 | } -------------------------------------------------------------------------------- /motan-manager/src/main/java/com/weibo/exception/CustomException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.exception; 18 | 19 | import org.springframework.http.HttpStatus; 20 | import org.springframework.web.bind.annotation.ResponseStatus; 21 | 22 | /** 23 | * Created by Zhang Yu on 2016/1/5 0005 14:02. 24 | */ 25 | public class CustomException { 26 | 27 | @ResponseStatus(value = HttpStatus.UNAUTHORIZED, reason = "Not log in") 28 | public static class UnauthorizedException extends RuntimeException { 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /motan-manager/src/main/java/com/weibo/model/TokenTransfer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.model; 18 | 19 | /** 20 | * Created by Zhang Yu on 2015/12/31 0031 11:13. 21 | */ 22 | public class TokenTransfer { 23 | private final String token; 24 | 25 | public TokenTransfer(String token) { 26 | this.token = token; 27 | } 28 | 29 | public String getToken() { 30 | return token; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /motan-manager/src/main/java/com/weibo/model/UserTransfer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.model; 18 | 19 | import java.util.Map; 20 | 21 | /** 22 | * Created by Zhang Yu on 2015/12/31 0031 10:23. 23 | */ 24 | public class UserTransfer { 25 | private final String name; 26 | private final Map roles; 27 | 28 | public UserTransfer(String name, Map roles) { 29 | this.name = name; 30 | this.roles = roles; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public Map getRoles() { 38 | return roles; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /motan-manager/src/main/java/com/weibo/service/RegistryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.service; 18 | 19 | import com.alibaba.fastjson.JSONObject; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * Created by Zhang Yu on 2015/11/2 0002. 25 | */ 26 | public interface RegistryService { 27 | List getGroups(); 28 | 29 | List getServicesByGroup(String group); 30 | 31 | List getNodes(String group, String service, String nodeType); 32 | 33 | List getAllNodes(String group); 34 | } 35 | -------------------------------------------------------------------------------- /motan-manager/src/main/java/com/weibo/utils/ConsulClientWrapper.java: -------------------------------------------------------------------------------- 1 | package com.weibo.utils; 2 | 3 | import com.ecwid.consul.v1.ConsulClient; 4 | import com.weibo.api.motan.exception.MotanFrameworkException; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.context.annotation.Lazy; 7 | import org.springframework.context.annotation.Scope; 8 | import org.springframework.stereotype.Component; 9 | 10 | import javax.annotation.PostConstruct; 11 | import javax.annotation.PreDestroy; 12 | 13 | @Component 14 | @Lazy 15 | @Scope("singleton") 16 | public class ConsulClientWrapper { 17 | 18 | @Value("${registry.url}") 19 | private String registryUrl; 20 | private ConsulClient consulClient; 21 | 22 | @PostConstruct 23 | void init() { 24 | try { 25 | String[] arr = registryUrl.split(":"); 26 | String host = arr[0]; 27 | int port = Integer.parseInt(arr[1]); 28 | consulClient = new ConsulClient(host, port); 29 | } catch (Exception e) { 30 | throw new MotanFrameworkException("Fail to connect consul, cause: " + e.getMessage()); 31 | } 32 | } 33 | 34 | @PreDestroy 35 | void destory() { 36 | consulClient = null; 37 | } 38 | 39 | public ConsulClient getConsulClient() { 40 | return consulClient; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /motan-manager/src/main/java/com/weibo/utils/ZkClientWrapper.java: -------------------------------------------------------------------------------- 1 | package com.weibo.utils; 2 | 3 | import com.weibo.api.motan.exception.MotanFrameworkException; 4 | import com.weibo.api.motan.registry.zookeeper.StringSerializer; 5 | import org.I0Itec.zkclient.ZkClient; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.context.annotation.Lazy; 8 | import org.springframework.context.annotation.Scope; 9 | import org.springframework.stereotype.Component; 10 | 11 | import javax.annotation.PostConstruct; 12 | import javax.annotation.PreDestroy; 13 | 14 | @Component 15 | @Lazy 16 | @Scope("singleton") 17 | public class ZkClientWrapper { 18 | 19 | @Value("${registry.url}") 20 | private String registryUrl; 21 | private ZkClient zkClient; 22 | 23 | @PostConstruct 24 | void init() { 25 | try { 26 | zkClient = new ZkClient(registryUrl, 10000, 10000, new StringSerializer()); 27 | } catch (Exception e) { 28 | throw new MotanFrameworkException("Fail to connect zookeeper, cause: " + e.getMessage()); 29 | } 30 | } 31 | 32 | @PreDestroy 33 | void destory() { 34 | zkClient = null; 35 | } 36 | 37 | public ZkClient getZkClient() { 38 | return zkClient; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /motan-manager/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | driverClassName=com.mysql.jdbc.Driver 18 | validationQuery=SELECT 1 19 | jdbc_url=jdbc:mysql://127.0.0.1:3306/motan-manager?useUnicode=true&characterEncoding=UTF-8 20 | jdbc_username=test 21 | jdbc_password=test 22 | 23 | #registry.type=zookeeper 24 | #registry.url=127.0.0.1:2181 25 | registry.type=consul 26 | registry.url=127.0.0.1:8500 27 | -------------------------------------------------------------------------------- /motan-manager/src/main/resources/motan-manager.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | -- ---------------------------- 4 | -- Table structure for operation_record 5 | -- ---------------------------- 6 | DROP TABLE IF EXISTS `operation_record`; 7 | CREATE TABLE `operation_record` ( 8 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 9 | `operator` varchar(255) DEFAULT NULL COMMENT '操作人', 10 | `type` VARCHAR(32) DEFAULT NULL COMMENT '操作类型', 11 | `group_name` varchar(255) DEFAULT NULL COMMENT 'group分组', 12 | `command` varchar(255) DEFAULT NULL COMMENT '指令内容或指令序号', 13 | `status` tinyint(2) DEFAULT NULL COMMENT '执行状态:1成功 0失败', 14 | `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间', 15 | PRIMARY KEY (`id`) 16 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 17 | -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/app/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | angular.module('app', [ 3 | 'ngAnimate', 4 | 'ngCookies', 5 | 'ngResource', 6 | 'ngSanitize', 7 | 'ngTouch', 8 | 'ngStorage', 9 | 'ui.router', 10 | 'ncy-angular-breadcrumb', 11 | 'ui.bootstrap', 12 | 'ui.utils', 13 | 'oc.lazyLoad' 14 | ]); -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/app/controllers/modal.js: -------------------------------------------------------------------------------- 1 | app.controller('ModalInstanceCtrl', function ($scope, $modalInstance) { 2 | $scope.ok = function () { 3 | $modalInstance.close(); 4 | }; 5 | 6 | $scope.cancel = function () { 7 | $modalInstance.dismiss('cancel'); 8 | }; 9 | }); -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/app/directives/loading.js: -------------------------------------------------------------------------------- 1 | angular.module('app') 2 | .directive('loadingContainer', function () { 3 | return { 4 | restrict: 'AC', 5 | link: function (scope, el, attrs) { 6 | el.removeClass('app-loading'); 7 | scope.$on('$stateChangeStart', function (event) { 8 | el.addClass('app-loading'); 9 | }); 10 | scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState) { 11 | event.targetScope.$watch('$viewContentLoaded', function() { 12 | el.removeClass('app-loading '); 13 | }); 14 | }); 15 | } 16 | }; 17 | }); -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/app/services/user.service.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | app.factory('UserService', function ($http, $log, $q) { 4 | return { 5 | getUser: function () { 6 | return $http.get('api/user').then( 7 | function (response) { 8 | return response.data; 9 | }, 10 | function (errResponse) { 11 | $log.error('Error while get user'); 12 | return $q.reject(errResponse); 13 | } 14 | ); 15 | }, 16 | authenticate: function (username, password) { 17 | var data = {'username': username, 'password': password}; 18 | return $http({ 19 | url: 'api/user/authenticate', 20 | method: 'POST', 21 | data: $.param(data), 22 | headers: {'Content-Type': 'application/x-www-form-urlencoded'} 23 | }).then( 24 | function (response) { 25 | return response.data; 26 | }, 27 | function (errResponse) { 28 | $log.error('Error while authenticate'); 29 | return $q.reject(errResponse); 30 | } 31 | ); 32 | } 33 | }; 34 | }); -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/css/other-less/lesshat.min.css: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/css/skins/skins-mixins.min.css: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/angle-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/angle-down.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/app-45616.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/app-45616.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/app.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/attach-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/attach-blue.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/attach-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/attach-green.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/attach-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/attach-red.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/attach-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/attach-yellow.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/favicon.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/jquery.minicolors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/jquery.minicolors.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/logo-solo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/logo-solo.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/logo.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/sort_asc.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/sort_asc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/sort_asc_disabled.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/sort_both.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/sort_desc.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/sort_desc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/sort_desc_disabled.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/img/tree-icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/img/tree-icons.png -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/sound/alert.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/sound/alert.mp3 -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/swf/copy_csv_xls.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/swf/copy_csv_xls.swf -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/assets/swf/copy_csv_xls_pdf.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/assets/swf/copy_csv_xls_pdf.swf -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/lib/modules/angular-ui-grid/ui-grid.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/lib/modules/angular-ui-grid/ui-grid.eot -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/lib/modules/angular-ui-grid/ui-grid.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/lib/modules/angular-ui-grid/ui-grid.ttf -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/lib/modules/angular-ui-grid/ui-grid.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/lib/modules/angular-ui-grid/ui-grid.woff -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/lib/modules/angular-ui-select/angular-ui-select-0.10.0.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weibocom/motan/ea514b0c4fb4b9d2020632f97abb094de944b4e6/motan-manager/src/main/resources/static/lib/modules/angular-ui-select/angular-ui-select-0.10.0.7z -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/views/blank.html: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/views/error-404.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
4 |

404

5 |
6 |

page not found

7 |

We Couldn’t Find This Page

8 |
9 | Home 10 |
11 |
-------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/views/error-500.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
4 |

500

5 |
6 |

ooops!!

7 |

SOMETHING WENT WRONG.

8 |
9 | Home 10 |
11 |
-------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/views/login.html: -------------------------------------------------------------------------------- 1 |  27 | -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/views/partials/breadcrumbs.html: -------------------------------------------------------------------------------- 1 | 
2 | -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/views/partials/header.html: -------------------------------------------------------------------------------- 1 | 
2 |

3 |

4 |
5 | 6 |
7 | 8 | 9 | 10 |
11 | 12 | -------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/views/partials/loading.html: -------------------------------------------------------------------------------- 1 | 
-------------------------------------------------------------------------------- /motan-manager/src/main/resources/static/views/partials/sidebar.html: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | 10 | 36 | 37 | -------------------------------------------------------------------------------- /motan-manager/src/test/resources/zoo.cfg: -------------------------------------------------------------------------------- 1 | # The number of milliseconds of each tick 2 | tickTime=2000 3 | # The number of ticks that the initial 4 | # synchronization phase can take 5 | initLimit=10 6 | # The number of ticks that can pass between 7 | # sending a request and getting an acknowledgement 8 | syncLimit=5 9 | # the directory where the snapshot is stored. 10 | # do not use /tmp for storage, /tmp here is just 11 | # example sakes. 12 | dataDir=/tmp/zookeeper/motan-test 13 | # the port at which the clients will connect 14 | clientPort=9001 15 | # the maximum number of client connections. 16 | # increase this if you need to handle more clients 17 | #maxClientCnxns=60 18 | # 19 | # Be sure to read the maintenance section of the 20 | # administrator guide before turning on autopurge. 21 | # 22 | # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance 23 | # 24 | # The number of snapshots to retain in dataDir 25 | #autopurge.snapRetainCount=3 26 | # Purge task interval in hours 27 | # Set to "0" to disable auto purge feature 28 | #autopurge.purgeInterval=1 -------------------------------------------------------------------------------- /motan-registry-consul/src/main/java/com/weibo/api/motan/registry/consul/ConsulRegistryFactory.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.registry.consul; 2 | 3 | import com.weibo.api.motan.core.extension.SpiMeta; 4 | import com.weibo.api.motan.registry.Registry; 5 | import com.weibo.api.motan.registry.consul.client.ConsulEcwidClient; 6 | import com.weibo.api.motan.registry.consul.client.MotanConsulClient; 7 | import com.weibo.api.motan.registry.support.AbstractRegistryFactory; 8 | import com.weibo.api.motan.rpc.URL; 9 | import org.apache.commons.lang3.StringUtils; 10 | 11 | 12 | @SpiMeta(name = "consul") 13 | public class ConsulRegistryFactory extends AbstractRegistryFactory { 14 | 15 | @Override 16 | protected Registry createRegistry(URL url) { 17 | String host = ConsulConstants.DEFAULT_HOST; 18 | int port = ConsulConstants.DEFAULT_PORT; 19 | if (StringUtils.isNotBlank(url.getHost())) { 20 | host = url.getHost(); 21 | } 22 | if (url.getPort() > 0) { 23 | port = url.getPort(); 24 | } 25 | //可以使用不同的client实现 26 | MotanConsulClient client = new ConsulEcwidClient(host, port); 27 | return new ConsulRegistry(url, client); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /motan-registry-consul/src/main/java/com/weibo/api/motan/registry/consul/ConsulResponse.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.registry.consul; 2 | 3 | public class ConsulResponse { 4 | /** 5 | * consul返回的具体结果 6 | */ 7 | private T value; 8 | 9 | private Long consulIndex; 10 | 11 | private Boolean consulKnownLeader; 12 | 13 | private Long consulLastContact; 14 | 15 | public T getValue() { 16 | return value; 17 | } 18 | 19 | public void setValue(T value) { 20 | this.value = value; 21 | } 22 | 23 | public Long getConsulIndex() { 24 | return consulIndex; 25 | } 26 | 27 | public void setConsulIndex(Long consulIndex) { 28 | this.consulIndex = consulIndex; 29 | } 30 | 31 | public Boolean getConsulKnownLeader() { 32 | return consulKnownLeader; 33 | } 34 | 35 | public void setConsulKnownLeader(Boolean consulKnownLeader) { 36 | this.consulKnownLeader = consulKnownLeader; 37 | } 38 | 39 | public Long getConsulLastContact() { 40 | return consulLastContact; 41 | } 42 | 43 | public void setConsulLastContact(Long consulLastContact) { 44 | this.consulLastContact = consulLastContact; 45 | } 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /motan-registry-consul/src/main/java/com/weibo/api/motan/registry/consul/ConsulService.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.registry.consul; 2 | 3 | import java.util.List; 4 | 5 | public class ConsulService { 6 | 7 | private String id; 8 | 9 | private String name; 10 | 11 | private List tags; 12 | 13 | private String address; 14 | 15 | private Integer port; 16 | 17 | private long ttl; 18 | 19 | public String getId() { 20 | return id; 21 | } 22 | 23 | public void setId(String id) { 24 | this.id = id; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public List getTags() { 36 | return tags; 37 | } 38 | 39 | public void setTags(List tags) { 40 | this.tags = tags; 41 | } 42 | 43 | public String getAddress() { 44 | return address; 45 | } 46 | 47 | public void setAddress(String address) { 48 | this.address = address; 49 | } 50 | 51 | public Integer getPort() { 52 | return port; 53 | } 54 | 55 | public void setPort(Integer port) { 56 | this.port = port; 57 | } 58 | 59 | public long getTtl() { 60 | return ttl; 61 | } 62 | 63 | public void setTtl(long ttl) { 64 | this.ttl = ttl; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /motan-registry-consul/src/main/resources/META-INF/services/com.weibo.api.motan.registry.RegistryFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.registry.consul.ConsulRegistryFactory 18 | -------------------------------------------------------------------------------- /motan-registry-weibomesh/src/main/resources/META-INF/services/com.weibo.api.motan.registry.RegistryFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.registry.weibomesh.MeshRegistryFactory -------------------------------------------------------------------------------- /motan-registry-zookeeper/src/main/java/com/weibo/api/motan/registry/zookeeper/StringSerializer.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.registry.zookeeper; 2 | 3 | import com.weibo.api.motan.util.ByteUtil; 4 | import org.I0Itec.zkclient.exception.ZkMarshallingError; 5 | import org.I0Itec.zkclient.serialize.SerializableSerializer; 6 | 7 | import java.io.ObjectStreamConstants; 8 | import java.io.UnsupportedEncodingException; 9 | 10 | public class StringSerializer extends SerializableSerializer { 11 | @Override 12 | public Object deserialize(byte[] bytes) throws ZkMarshallingError { 13 | if (bytes == null){ 14 | return null; 15 | } 16 | try { 17 | if (bytes.length > 1 && ByteUtil.bytes2short(bytes, 0) == ObjectStreamConstants.STREAM_MAGIC) { 18 | return super.deserialize(bytes); 19 | } 20 | return new String(bytes, "UTF-8"); 21 | } catch (UnsupportedEncodingException e) { 22 | throw new ZkMarshallingError(e); 23 | } 24 | } 25 | 26 | @Override 27 | public byte[] serialize(Object obj) throws ZkMarshallingError { 28 | try { 29 | return obj.toString().getBytes("UTF-8"); 30 | } catch (UnsupportedEncodingException e) { 31 | throw new ZkMarshallingError(e); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /motan-registry-zookeeper/src/main/java/com/weibo/api/motan/registry/zookeeper/ZkNodeType.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.registry.zookeeper; 2 | 3 | public enum ZkNodeType { 4 | 5 | AVAILABLE_SERVER("server"), 6 | UNAVAILABLE_SERVER("unavailableServer"), 7 | CLIENT("client"); 8 | 9 | private String value; 10 | 11 | private ZkNodeType(String value){ 12 | this.value = value; 13 | } 14 | 15 | public String getValue() { 16 | return value; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /motan-registry-zookeeper/src/main/java/com/weibo/api/motan/registry/zookeeper/ZkUtils.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.registry.zookeeper; 2 | 3 | import com.weibo.api.motan.common.MotanConstants; 4 | import com.weibo.api.motan.rpc.URL; 5 | 6 | public class ZkUtils { 7 | 8 | public static String toGroupPath(URL url) { 9 | return MotanConstants.ZOOKEEPER_REGISTRY_NAMESPACE + MotanConstants.PATH_SEPARATOR + url.getGroup(); 10 | } 11 | 12 | public static String toServicePath(URL url) { 13 | return toGroupPath(url) + MotanConstants.PATH_SEPARATOR + url.getPath(); 14 | } 15 | 16 | public static String toCommandPath(URL url) { 17 | return toGroupPath(url) + MotanConstants.ZOOKEEPER_REGISTRY_COMMAND; 18 | } 19 | 20 | public static String toNodeTypePath(URL url, ZkNodeType nodeType) { 21 | return toServicePath(url) + MotanConstants.PATH_SEPARATOR + nodeType.getValue(); 22 | } 23 | 24 | public static String toNodePath(URL url, ZkNodeType nodeType) { 25 | return toNodeTypePath(url, nodeType) + MotanConstants.PATH_SEPARATOR + url.getServerPortStr(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /motan-registry-zookeeper/src/main/java/com/weibo/api/motan/registry/zookeeper/ZookeeperStringSerializerRegistryFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.registry.zookeeper; 18 | 19 | import com.weibo.api.motan.core.extension.SpiMeta; 20 | import org.I0Itec.zkclient.ZkClient; 21 | 22 | @SpiMeta(name = "zk") 23 | public class ZookeeperStringSerializerRegistryFactory extends ZookeeperRegistryFactory { 24 | @Override 25 | protected ZkClient createInnerZkClient(String zkServers, int sessionTimeout, int connectionTimeout) { 26 | return new ZkClient(zkServers, sessionTimeout, connectionTimeout, new StringSerializer()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /motan-registry-zookeeper/src/main/resources/META-INF/services/com.weibo.api.motan.registry.RegistryFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.registry.zookeeper.ZookeeperRegistryFactory 18 | com.weibo.api.motan.registry.zookeeper.ZookeeperStringSerializerRegistryFactory 19 | -------------------------------------------------------------------------------- /motan-registry-zookeeper/src/test/resources/zoo.cfg: -------------------------------------------------------------------------------- 1 | # The number of milliseconds of each tick 2 | tickTime=2000 3 | # The number of ticks that the initial 4 | # synchronization phase can take 5 | initLimit=10 6 | # The number of ticks that can pass between 7 | # sending a request and getting an acknowledgement 8 | syncLimit=5 9 | # the directory where the snapshot is stored. 10 | # do not use /tmp for storage, /tmp here is just 11 | # example sakes. 12 | dataDir=/tmp/zookeeper/motan-test 13 | # the port at which the clients will connect 14 | clientPort=9000 15 | # the maximum number of client connections. 16 | # increase this if you need to handle more clients 17 | #maxClientCnxns=60 18 | # 19 | # Be sure to read the maintenance section of the 20 | # administrator guide before turning on autopurge. 21 | # 22 | # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance 23 | # 24 | # The number of snapshots to retain in dataDir 25 | #autopurge.snapRetainCount=3 26 | # Purge task interval in hours 27 | # Set to "0" to disable auto purge feature 28 | #autopurge.purgeInterval=1 -------------------------------------------------------------------------------- /motan-springsupport/src/main/java/com/weibo/api/motan/config/springsupport/ProtocolConfigBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.config.springsupport; 18 | 19 | import com.weibo.api.motan.config.ProtocolConfig; 20 | import org.springframework.beans.factory.BeanNameAware; 21 | 22 | /** 23 | * @author fld 24 | * 25 | * Created by fld on 16/5/13. 26 | */ 27 | public class ProtocolConfigBean extends ProtocolConfig implements BeanNameAware { 28 | 29 | @Override 30 | public void setBeanName(String name) { 31 | setId(name); 32 | MotanNamespaceHandler.protocolDefineNames.add(name); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /motan-springsupport/src/main/java/com/weibo/api/motan/config/springsupport/SpiConfigBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.config.springsupport; 18 | 19 | import org.springframework.beans.factory.InitializingBean; 20 | 21 | import com.weibo.api.motan.config.SpiConfig; 22 | import com.weibo.api.motan.core.extension.ExtensionLoader; 23 | 24 | public class SpiConfigBean extends SpiConfig implements InitializingBean { 25 | 26 | @Override 27 | public void afterPropertiesSet() throws Exception { 28 | ExtensionLoader.getExtensionLoader(getInterfaceClass()).addExtensionClass(getSpiClass()); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /motan-springsupport/src/test/java/com/weibo/api/motan/config/springsupport/ISpi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.config.springsupport; 18 | 19 | import com.weibo.api.motan.core.extension.Spi; 20 | 21 | /** 22 | * @author maijunsheng 23 | * @version 创建时间:2013-6-9 24 | * 25 | */ 26 | @Spi 27 | public interface ISpi { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /motan-springsupport/src/test/java/com/weibo/api/motan/config/springsupport/ITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.config.springsupport; 18 | 19 | public interface ITest { 20 | String echo(String msg); 21 | 22 | void hello(); 23 | 24 | String hello(String name); 25 | 26 | String helloException(); 27 | } 28 | -------------------------------------------------------------------------------- /motan-springsupport/src/test/java/com/weibo/api/motan/config/springsupport/SpiImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.config.springsupport; 18 | 19 | import com.weibo.api.motan.core.extension.SpiMeta; 20 | 21 | /** 22 | * @author maijunsheng 23 | * @version 创建时间:2013-6-9 24 | * 25 | */ 26 | @SpiMeta(name = "spi_impl") 27 | public class SpiImpl implements ISpi { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /motan-springsupport/src/test/java/com/weibo/api/motan/config/springsupport/TestImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2016 Weibo, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.weibo.api.motan.config.springsupport; 18 | 19 | public class TestImpl implements ITest { 20 | 21 | @Override 22 | public String echo(String msg) { 23 | return "hello " + msg; 24 | } 25 | 26 | @Override 27 | public void hello() {} 28 | 29 | @Override 30 | public String hello(String name) { 31 | return name; 32 | } 33 | 34 | @Override 35 | public String helloException() { 36 | throw new RuntimeException("error for test"); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /motan-springsupport/src/test/resources/META-INF/services/com.weibo.api.motan.core.extension.SpiPrototypeInterface: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.core.extension.SpiPrototypeTestImpl -------------------------------------------------------------------------------- /motan-springsupport/src/test/resources/META-INF/services/com.weibo.api.motan.core.extension.SpiTestInterface: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.core.extension.SpiTestImpl -------------------------------------------------------------------------------- /motan-springsupport/src/test/resources/spi_test_context.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 26 | 27 | -------------------------------------------------------------------------------- /motan-transport-netty/src/main/java/com/weibo/api/motan/transport/netty/admin/NettyAdminServerFactory.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.transport.netty.admin; 2 | 3 | import com.weibo.api.motan.admin.AdminHandler; 4 | import com.weibo.api.motan.admin.AdminServer; 5 | import com.weibo.api.motan.admin.AdminServerFactory; 6 | import com.weibo.api.motan.core.extension.SpiMeta; 7 | import com.weibo.api.motan.exception.MotanFrameworkException; 8 | import com.weibo.api.motan.rpc.URL; 9 | import org.jboss.netty.handler.codec.http.HttpServerCodec; 10 | 11 | /** 12 | * @author zhanglei28 13 | * @date 2023/11/3. 14 | */ 15 | @SpiMeta(name = "netty3") 16 | public class NettyAdminServerFactory implements AdminServerFactory { 17 | 18 | @Override 19 | public AdminServer createServer(URL url, AdminHandler adminHandler) { 20 | if (adminHandler == null) { 21 | throw new MotanFrameworkException("AdminHandler can not be null"); 22 | } 23 | String protocol = url.getProtocol(); 24 | if ("http".equals(protocol)) { 25 | return new AdminHttpServer(url, adminHandler); 26 | } else if ("motan2".equals(protocol)) { 27 | return new AdminRpcServer(url, adminHandler); 28 | } 29 | throw new MotanFrameworkException("unsupported admin server protocol: " + protocol); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /motan-transport-netty/src/main/resources/META-INF/services/com.weibo.api.motan.admin.AdminServerFactory: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright 2009-2023 Weibo, Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # 18 | 19 | com.weibo.api.motan.transport.netty.admin.NettyAdminServerFactory -------------------------------------------------------------------------------- /motan-transport-netty/src/main/resources/META-INF/services/com.weibo.api.motan.transport.EndpointFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.transport.netty.NettyEndpointFactory -------------------------------------------------------------------------------- /motan-transport-netty4/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | motan 7 | com.weibo 8 | 1.2.5-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | motan-transport-netty4 13 | 14 | 15 | 16 | com.weibo 17 | motan-core 18 | ${project.parent.version} 19 | 20 | 21 | io.netty 22 | netty-all 23 | 4.1.44.Final 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /motan-transport-netty4/src/main/java/com/weibo/api/motan/transport/netty4/NettyEncoder.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.transport.netty4; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.channel.ChannelHandlerContext; 5 | import io.netty.handler.codec.MessageToByteEncoder; 6 | 7 | /** 8 | * @author sunnights 9 | */ 10 | public class NettyEncoder extends MessageToByteEncoder { 11 | 12 | @Override 13 | protected void encode(ChannelHandlerContext ctx, byte[] msg, ByteBuf out) throws Exception { 14 | out.writeBytes(msg); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /motan-transport-netty4/src/main/java/com/weibo/api/motan/transport/netty4/NettyEndpointFactory.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.transport.netty4; 2 | 3 | import com.weibo.api.motan.core.extension.SpiMeta; 4 | import com.weibo.api.motan.rpc.URL; 5 | import com.weibo.api.motan.transport.Client; 6 | import com.weibo.api.motan.transport.MessageHandler; 7 | import com.weibo.api.motan.transport.Server; 8 | import com.weibo.api.motan.transport.support.AbstractEndpointFactory; 9 | 10 | /** 11 | * @author sunnights 12 | */ 13 | @SpiMeta(name = "motan") 14 | public class NettyEndpointFactory extends AbstractEndpointFactory { 15 | @Override 16 | protected Server innerCreateServer(URL url, MessageHandler messageHandler) { 17 | return new NettyServer(url, messageHandler); 18 | } 19 | 20 | @Override 21 | protected Client innerCreateClient(URL url) { 22 | return new NettyClient(url); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /motan-transport-netty4/src/main/java/com/weibo/api/motan/transport/netty4/admin/AdminRpcServer.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.transport.netty4.admin; 2 | 3 | import com.weibo.api.motan.admin.AbstractAdminServer; 4 | import com.weibo.api.motan.admin.AdminHandler; 5 | import com.weibo.api.motan.common.URLParamType; 6 | import com.weibo.api.motan.rpc.URL; 7 | import com.weibo.api.motan.transport.netty4.NettyServer; 8 | 9 | /** 10 | * @author zhanglei28 11 | * @date 2023/11/3. 12 | */ 13 | public class AdminRpcServer extends AbstractAdminServer { 14 | private final NettyServer server; 15 | 16 | public AdminRpcServer(URL url, AdminHandler adminHandler) { 17 | url.addParameter(URLParamType.codec.getName(), "motan-compatible"); 18 | this.url = url; 19 | this.adminHandler = adminHandler; 20 | server = new NettyServer(url, new RpcServerHandler(adminHandler)); 21 | } 22 | 23 | @Override 24 | public boolean open() { 25 | return server.open(); 26 | } 27 | 28 | @Override 29 | public void close() { 30 | server.close(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /motan-transport-netty4/src/main/java/com/weibo/api/motan/transport/netty4/admin/NettyAdminServerFactory.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.transport.netty4.admin; 2 | 3 | import com.weibo.api.motan.admin.AdminHandler; 4 | import com.weibo.api.motan.admin.AdminServer; 5 | import com.weibo.api.motan.admin.AdminServerFactory; 6 | import com.weibo.api.motan.core.extension.SpiMeta; 7 | import com.weibo.api.motan.exception.MotanFrameworkException; 8 | import com.weibo.api.motan.rpc.URL; 9 | 10 | /** 11 | * @author zhanglei28 12 | * @date 2023/11/3. 13 | */ 14 | @SpiMeta(name = "netty4") 15 | public class NettyAdminServerFactory implements AdminServerFactory { 16 | 17 | @Override 18 | public AdminServer createServer(URL url, AdminHandler adminHandler) { 19 | if (adminHandler == null) { 20 | throw new MotanFrameworkException("AdminHandler can not be null"); 21 | } 22 | String protocol = url.getProtocol(); 23 | if ("http".equals(protocol)) { 24 | return new AdminHttpServer(url, adminHandler); 25 | } else if ("motan2".equals(protocol)) { 26 | return new AdminRpcServer(url, adminHandler); 27 | } 28 | throw new MotanFrameworkException("unsupported admin server protocol: " + protocol); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /motan-transport-netty4/src/main/java/com/weibo/api/motan/transport/netty4/http/HttpMessageHandler.java: -------------------------------------------------------------------------------- 1 | package com.weibo.api.motan.transport.netty4.http; 2 | 3 | import com.weibo.api.motan.transport.Channel; 4 | import io.netty.handler.codec.http.FullHttpRequest; 5 | import io.netty.handler.codec.http.FullHttpResponse; 6 | 7 | /** 8 | * @author zhanglei28 9 | * @date 2023/11/22. 10 | */ 11 | public interface HttpMessageHandler { 12 | FullHttpResponse handle(Channel channel, FullHttpRequest httpRequest); 13 | } 14 | -------------------------------------------------------------------------------- /motan-transport-netty4/src/main/resources/META-INF/services/com.weibo.api.motan.admin.AdminServerFactory: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright 2009-2023 Weibo, Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # 18 | 19 | com.weibo.api.motan.transport.netty4.admin.NettyAdminServerFactory -------------------------------------------------------------------------------- /motan-transport-netty4/src/main/resources/META-INF/services/com.weibo.api.motan.transport.EndpointFactory: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | com.weibo.api.motan.transport.netty4.NettyEndpointFactory -------------------------------------------------------------------------------- /motan-transport-netty4/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009-2016 Weibo, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | log4j.rootLogger=fatal,console 17 | log4j.appender.console=org.apache.log4j.ConsoleAppender 18 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 19 | log4j.appender.console.layout.ConversionPattern=%-d{HH:mm:ss,SSS} %t %m%n 20 | --------------------------------------------------------------------------------