Skip to content

Commit

Permalink
修改request response 类加载逻辑,有类扫描改成手动注册
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiyue1102 committed Dec 21, 2022
1 parent 1322486 commit 9696b71
Show file tree
Hide file tree
Showing 33 changed files with 783 additions and 296 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.api.config.remote.request;

import com.alibaba.nacos.api.remote.Payload;

import java.util.HashSet;
import java.util.Set;

/**
* payload registry.
*
* @author shiyiyue
*/
public class RequestRegistry {

private static Set<Class<? extends Payload>> payloads = registryPayload();

private static Set<Class<? extends Payload>> registryPayload() {
HashSet<Class<? extends Payload>> payloads = new HashSet<>();
payloads.add(AbstractConfigRequest.class);
payloads.add(ClientConfigMetricRequest.class);
payloads.add(ConfigBatchListenRequest.class);
payloads.add(ConfigChangeNotifyRequest.class);
payloads.add(ConfigPublishRequest.class);
payloads.add(ConfigQueryRequest.class);
payloads.add(ConfigRemoveRequest.class);
return payloads;
}

public static final Set<Class<? extends Payload>> getPayloads() {
return payloads;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.api.config.remote.request.cluster;

import com.alibaba.nacos.api.remote.Payload;

import java.util.HashSet;
import java.util.Set;

/**
* payload registry.
*
* @author shiyiyue
*/
public class RequestRegistry {

private static Set<Class<? extends Payload>> payloads = registryPayload();

private static Set<Class<? extends Payload>> registryPayload() {
HashSet<Class<? extends Payload>> payloads = new HashSet<>();
payloads.add(ConfigChangeClusterSyncRequest.class);
return payloads;
}

public static final Set<Class<? extends Payload>> getPayloads() {
return payloads;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.api.config.remote.response;

import com.alibaba.nacos.api.remote.Payload;

import java.util.HashSet;
import java.util.Set;

/**
* payload registry.
*
* @author shiyiyue
*/
public class ResponseRegistry {

private static Set<Class<? extends Payload>> payloads = getPayload();

private static Set<Class<? extends Payload>> getPayload() {
HashSet<Class<? extends Payload>> payloads = new HashSet<>();
payloads.add(ClientConfigMetricResponse.class);
payloads.add(ConfigChangeBatchListenResponse.class);
payloads.add(ConfigChangeNotifyResponse.class);
payloads.add(ConfigPublishResponse.class);
payloads.add(ConfigQueryResponse.class);
payloads.add(ConfigRemoveResponse.class);
return payloads;
}

public static final Set<Class<? extends Payload>> getPayloads() {
return payloads;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.api.config.remote.response.cluster;

import com.alibaba.nacos.api.remote.Payload;

import java.util.HashSet;
import java.util.Set;

/**
* payload registry.
*
* @author shiyiyue
*/
public class ResponseRegistry {

private static Set<Class<? extends Payload>> payloads = getPayload();

private static Set<Class<? extends Payload>> getPayload() {
HashSet<Class<? extends Payload>> payloads = new HashSet<>();
payloads.add(ConfigChangeClusterSyncResponse.class);
return payloads;
}

public static final Set<Class<? extends Payload>> getPayloads() {
return payloads;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.api.naming.remote.request;

import com.alibaba.nacos.api.remote.Payload;

import java.util.HashSet;
import java.util.Set;

/**
* payload registry.
*
* @author shiyiyue
*/
public class RequestRegistry {

private static Set<Class<? extends Payload>> payloads = registryPayload();

private static Set<Class<? extends Payload>> registryPayload() {
HashSet<Class<? extends Payload>> payloads = new HashSet<>();
payloads.add(AbstractNamingRequest.class);
payloads.add(BatchInstanceRequest.class);
payloads.add(InstanceRequest.class);
payloads.add(NotifySubscriberRequest.class);
payloads.add(ServiceListRequest.class);
payloads.add(ServiceQueryRequest.class);
payloads.add(SubscribeServiceRequest.class);
return payloads;
}

public static final Set<Class<? extends Payload>> getPayloads() {
return payloads;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.api.naming.remote.response;

import com.alibaba.nacos.api.remote.Payload;

import java.util.HashSet;
import java.util.Set;

/**
* payload registry.
*
* @author shiyiyue
*/
public class ResponseRegistry {

private static Set<Class<? extends Payload>> payloads = getPayload();

private static final Set<Class<? extends Payload>> getPayload() {
HashSet<Class<? extends Payload>> payloads = new HashSet<>();
payloads.add(BatchInstanceResponse.class);
payloads.add(InstanceResponse.class);
payloads.add(NotifySubscriberResponse.class);
payloads.add(QueryServiceResponse.class);
payloads.add(ServiceListResponse.class);
payloads.add(SubscribeServiceResponse.class);
return payloads;
}

public static final Set<Class<? extends Payload>> getPayloads() {
return payloads;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.api.remote.request;

import com.alibaba.nacos.api.remote.Payload;

import java.util.HashSet;
import java.util.Set;

/**
* request payload registry.
* @author shiyiyue
*/
public class RequestRegistry {

private static Set<Class<? extends Payload>> payloads = registryPayload();

private static Set<Class<? extends Payload>> registryPayload() {
HashSet<Class<? extends Payload>> payloads = new HashSet<>();
payloads.add(InternalRequest.class);
payloads.add(Request.class);
payloads.add(ServerRequest.class);
payloads.add(ClientDetectionRequest.class);
payloads.add(ConnectionSetupRequest.class);
payloads.add(ConnectResetRequest.class);
payloads.add(HealthCheckRequest.class);
payloads.add(PushAckRequest.class);
payloads.add(ServerCheckRequest.class);
payloads.add(ServerLoaderInfoRequest.class);
payloads.add(ServerReloadRequest.class);
return payloads;
}

public static final Set<Class<? extends Payload>> getPayloads() {
return payloads;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 1999-2020 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.api.remote.response;

import com.alibaba.nacos.api.remote.Payload;

import java.util.HashSet;
import java.util.Set;

/**
* payload registry.
*
* @author shiyiyue
*/
public class ResponseRegistry {

private static Set<Class<? extends Payload>> payloads = getPayload();

private static Set<Class<? extends Payload>> getPayload() {
HashSet<Class<? extends Payload>> payloads = new HashSet<>();
payloads.add(Response.class);
payloads.add(ClientDetectionResponse.class);
payloads.add(ConnectResetResponse.class);
payloads.add(ErrorResponse.class);
payloads.add(HealthCheckResponse.class);
payloads.add(ServerCheckResponse.class);
payloads.add(ServerLoaderInfoResponse.class);
payloads.add(ServerReloadResponse.class);
return payloads;
}

public static final Set<Class<? extends Payload>> getPayloads() {
return payloads;
}
}
Loading

0 comments on commit 9696b71

Please sign in to comment.