Skip to content
Permalink
Browse files
fixed: word spell
  • Loading branch information
hufeng committed Jun 4, 2021
1 parent d0a919a commit 7244b169584ffecaa4cb9f695ca220b7ac338765
Showing 12 changed files with 19 additions and 31 deletions.
@@ -250,8 +250,7 @@ export default class Context<T = any> {
//=====================attachments=======================
/**
* 设置当前的attachments
* @param key
* @param value
* @param param
*/
set attachments(param: Object) {
log('set attachments->%o', param)
@@ -294,7 +293,7 @@ export default class Context<T = any> {

setMaxTimeout(end: Function) {
log(
'requestId#%d, set max timeout handler, maxtimeout: %d',
'requestId#%d, set max timeout handler, max timeout: %d',
this.requestId,
this._timeout
)
@@ -19,7 +19,6 @@ import debug from 'debug'
import { util } from '@apache/dubbo-common'
import DubboTcpTransport from './dubbo-tcp-transport'
import select from './select'
const { noop } = util
import {
IDubboObservable,
IDubboTransportSubscriber,
@@ -46,9 +45,9 @@ export default class DubboCluster
log('init dubbo-cluster')
this.dubboClusterTransportMap = new Map()
this.subscriber = {
onConnect: noop,
onData: noop,
onClose: noop
onConnect: util.noop,
onData: util.noop,
onClose: util.noop
}
}

@@ -127,9 +126,9 @@ export default class DubboCluster
}

getAvailableDubboTransport(hostnames: Set<HostName>): DubboTcpTransport {
// 1. first, We find avaiable clusters
// 1. first, We find available clusters
const allReadyHostnames = this.getAllReadyClusterHosts(hostnames)
log('find all avaiable clusters %s', allReadyHostnames)
log('find all available clusters %s', allReadyHostnames)

// 2. select one cluster
const hostname = select<string>(allReadyHostnames, 'random')
@@ -140,7 +139,7 @@ export default class DubboCluster
// 3. get all transports
const transports = this.getClusterReadyDubboTransports(hostname)
log(
'find all avaiable transports %s',
'find all available transports %s',
transports.map((t) => t.host)
)

@@ -26,12 +26,6 @@ const log = debug('dubbo:dubbo-url')
* parse dubbo service url
*
* @param dubboUrl dubbo的url
*
* for example:
* dubbo://192.168.2.1:38080/com.ofpay.demo.api.UserProvider?anyhost=true
* &application=demo-provider&default.timeout=10000&dubbo=2.4.10
* &environment=product&interface=com.ofpay.demo.api.UserProvider
* &methods=getUser,queryAll,queryUser,isLimit&owner=wenwu&pid=61578&side=provider&timestamp=1428904600188
*/
export default class DubboUrl {
private readonly url: URL
@@ -249,6 +249,9 @@ export default class Dubbo<TService = Object> {
return this.props.registry.ready()
}

/**
* close dubbo consumer, usually used in test suite
*/
close() {
this.props.registry.close()
this.scheduler.close()
@@ -78,7 +78,7 @@ export default class Queue implements IDubboObservable<TQueueObserver> {

// set max timout
ctx.setMaxTimeout(() => {
// delete thie context
// delete this context
this.queue.delete(ctx.requestId)
})

@@ -54,10 +54,6 @@ export interface IDubboProvider {
methods: { [methodName: string]: Function }
}

export interface IObservable<T> {
subscribe(subscriber: T): this
}

export interface IDirectlyDubboProps {
dubboHost: string
dubboVersion: string
@@ -87,7 +87,7 @@ export class ZookeeperRegistry
try {
// create root node
await this.mkdirp(DUBBO_ZK_ROOT_PATH)
// trigger reeady promise
// trigger ready promise
this.resolve()
} catch (err) {
this.reject(err)
@@ -177,7 +177,7 @@ export class ZookeeperRegistry
.w_get_children(servicePath, this.wrapWatch(dubboInterface))
.catch((err) => {
dlog(
`get beehive service urls errro %s %s %s`,
`get beehive service urls err %s %s %s`,
servicePath,
dubboInterface,
err
@@ -27,17 +27,14 @@ export const HESSIAN2_SERIALIZATION_ID = 2
//com.alibaba.dubbo.common.serialize.support.hessian.Hessian2Serialization
export const HESSIAN2_SERIALIZATION_CONTENT_ID = 2
//max dubbo response payload length
//com.alibaba.dubbo.common.Constants.DEAULT_PAY_LOAD
//com.alibaba.dubbo.common.Constants.DEFAULT_PAY_LOAD
export const DUBBO_DEFAULT_PAY_LOAD = 8 * 1024 * 1024 // 8M

// message flag
export const DUBBO_FLAG_REQUEST = 0x80
export const DUBBO_FLAG_TWOWAY = 0x40
export const DUBBO_FLAG_EVENT = 0x20

// event
export const DUBBO_HEART_BEAT_EVENT = null

//com.alibaba.dubbo.remoting.exchange.Response
export enum DUBBO_RESPONSE_STATUS {
OK = 20,
@@ -67,7 +67,7 @@ export default class DecodeBuffer
const magicHigh = this.buffer[0]
const magicLow = this.buffer[1]

//如果不是magichigh magiclow 做个容错
//如果不是magic high magic low 做个容错
if (magicHigh != DUBBO_MAGIC_HIGH || magicLow != DUBBO_MAGIC_LOW) {
log(
`%s receive server data error, buffer[0] is 0xda ${
@@ -61,7 +61,7 @@ export default class HeartBeat {
const who = this.type === 'request' ? 'dubbo-consumer' : 'dubbo-server'
log('%s init heartbeat manager', who)

// init heartbaet
// init heartbeat
this.init()
}

@@ -203,9 +203,10 @@ export default class DubboService {
])
// check hessian type
if (!util.checkRetValHessian(res)) {
throw new Error(
ctx.body.err = new Error(
`${path}#${methodName} return value not hessian type`
)
return
}
ctx.body.res = res
} catch (err) {
@@ -21,7 +21,6 @@ import { DubboService } from '@apache/dubbo-service'
import consumer from '../providers/org/apache/dubbo/demo/consumer'
import provider from '../providers/org/apache/dubbo/demo/provider'
import { UserRequest } from '../providers/org/apache/dubbo/demo/UserRequest'
import { TypeRequest } from '../providers/org/apache/dubbo/demo/TypeRequest'

let dubbo: DubboDirectlyInvoker = null
let dubboService: DubboService = null

0 comments on commit 7244b16

Please sign in to comment.