Skip to content

Commit 6272691

Browse files
uglycowchickenlj
authored andcommitted
Merge pull request #3626, remove author.
1 parent 020697b commit 6272691

File tree

5 files changed

+889
-904
lines changed

5 files changed

+889
-904
lines changed
Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one or more
3-
* contributor license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright ownership.
5-
* The ASF licenses this file to You under the Apache License, Version 2.0
6-
* (the "License"); you may not use this file except in compliance with
7-
* the License. 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-
package org.apache.dubbo.rpc.protocol.rsocket;
18-
19-
import com.alibaba.fastjson.JSON;
20-
21-
import java.io.IOException;
22-
import java.nio.charset.StandardCharsets;
23-
import java.util.Map;
24-
25-
/**
26-
* @author sixie.xyn on 2019/1/3.
27-
*/
28-
public class MetadataCodec {
29-
30-
public static Map<String, Object> decodeMetadata(byte[] bytes) throws IOException {
31-
return JSON.parseObject(new String(bytes, StandardCharsets.UTF_8), Map.class);
32-
}
33-
34-
public static byte[] encodeMetadata(Map<String, Object> metadata) throws IOException {
35-
String jsonStr = JSON.toJSONString(metadata);
36-
return jsonStr.getBytes(StandardCharsets.UTF_8);
37-
}
38-
39-
}
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. 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+
package org.apache.dubbo.rpc.protocol.rsocket;
18+
19+
import com.alibaba.fastjson.JSON;
20+
21+
import java.io.IOException;
22+
import java.nio.charset.StandardCharsets;
23+
import java.util.Map;
24+
25+
public class MetadataCodec {
26+
27+
public static Map<String, Object> decodeMetadata(byte[] bytes) throws IOException {
28+
return JSON.parseObject(new String(bytes, StandardCharsets.UTF_8), Map.class);
29+
}
30+
31+
public static byte[] encodeMetadata(Map<String, Object> metadata) throws IOException {
32+
String jsonStr = JSON.toJSONString(metadata);
33+
return jsonStr.getBytes(StandardCharsets.UTF_8);
34+
}
35+
36+
}
Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one or more
3-
* contributor license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright ownership.
5-
* The ASF licenses this file to You under the Apache License, Version 2.0
6-
* (the "License"); you may not use this file except in compliance with
7-
* the License. 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-
package org.apache.dubbo.rpc.protocol.rsocket;
18-
19-
/**
20-
* @author sixie.xyn on 2019/1/3.
21-
*/
22-
public class RSocketConstants {
23-
24-
public static final String SERVICE_NAME_KEY = "_service_name";
25-
public static final String SERVICE_VERSION_KEY = "_service_version";
26-
public static final String METHOD_NAME_KEY = "_method_name";
27-
public static final String PARAM_TYPE_KEY = "_param_type";
28-
public static final String SERIALIZE_TYPE_KEY = "_serialize_type";
29-
public static final String TIMEOUT_KEY = "_timeout";
30-
31-
32-
public static final int FLAG_ERROR = 0x01;
33-
public static final int FLAG_NULL_VALUE = 0x02;
34-
public static final int FLAG_HAS_ATTACHMENT = 0x04;
35-
}
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. 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+
package org.apache.dubbo.rpc.protocol.rsocket;
18+
19+
public class RSocketConstants {
20+
21+
public static final String SERVICE_NAME_KEY = "_service_name";
22+
public static final String SERVICE_VERSION_KEY = "_service_version";
23+
public static final String METHOD_NAME_KEY = "_method_name";
24+
public static final String PARAM_TYPE_KEY = "_param_type";
25+
public static final String SERIALIZE_TYPE_KEY = "_serialize_type";
26+
public static final String TIMEOUT_KEY = "_timeout";
27+
28+
29+
public static final int FLAG_ERROR = 0x01;
30+
public static final int FLAG_NULL_VALUE = 0x02;
31+
public static final int FLAG_HAS_ATTACHMENT = 0x04;
32+
}
Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,43 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one or more
3-
* contributor license agreements. See the NOTICE file distributed with
4-
* this work for additional information regarding copyright ownership.
5-
* The ASF licenses this file to You under the Apache License, Version 2.0
6-
* (the "License"); you may not use this file except in compliance with
7-
* the License. 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-
package org.apache.dubbo.rpc.protocol.rsocket;
18-
19-
import org.apache.dubbo.rpc.Exporter;
20-
import org.apache.dubbo.rpc.Invoker;
21-
import org.apache.dubbo.rpc.protocol.AbstractExporter;
22-
23-
import java.util.Map;
24-
25-
/**
26-
* @author sixie.xyn on 2019/1/2.
27-
*/
28-
public class RSocketExporter<T> extends AbstractExporter<T> {
29-
30-
private final String key;
31-
32-
private final Map<String, Exporter<?>> exporterMap;
33-
34-
public RSocketExporter(Invoker<T> invoker, String key, Map<String, Exporter<?>> exporterMap) {
35-
super(invoker);
36-
this.key = key;
37-
this.exporterMap = exporterMap;
38-
}
39-
40-
@Override
41-
public void unexport() {
42-
super.unexport();
43-
exporterMap.remove(key);
44-
}
45-
46-
}
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. 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+
package org.apache.dubbo.rpc.protocol.rsocket;
18+
19+
import org.apache.dubbo.rpc.Exporter;
20+
import org.apache.dubbo.rpc.Invoker;
21+
import org.apache.dubbo.rpc.protocol.AbstractExporter;
22+
23+
import java.util.Map;
24+
25+
public class RSocketExporter<T> extends AbstractExporter<T> {
26+
27+
private final String key;
28+
29+
private final Map<String, Exporter<?>> exporterMap;
30+
31+
public RSocketExporter(Invoker<T> invoker, String key, Map<String, Exporter<?>> exporterMap) {
32+
super(invoker);
33+
this.key = key;
34+
this.exporterMap = exporterMap;
35+
}
36+
37+
@Override
38+
public void unexport() {
39+
super.unexport();
40+
exporterMap.remove(key);
41+
}
42+
43+
}

0 commit comments

Comments
 (0)