Skip to content

Commit

Permalink
[Feature-apache#15103][Standalone]Support using JDBC registry plugin …
Browse files Browse the repository at this point in the history
…in standalone mode.(apache#15139)

fix: remove JdbcStandaloneRegistry
  • Loading branch information
qifanlili committed Nov 9, 2023
1 parent baa3e0b commit 0506b9e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
import java.util.List;
import java.util.Optional;

import javax.annotation.PostConstruct;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
@Slf4j
Expand All @@ -46,25 +47,20 @@ public StandaloneServer(List<StandaloneRegistry> registries) {

public static void main(String[] args) throws Exception {
try {
ConfigurableApplicationContext context = SpringApplication.run(StandaloneServer.class, args);
StandaloneServer standaloneServer = context.getBean(StandaloneServer.class);
standaloneServer.registry();
SpringApplication.run(StandaloneServer.class, args);
} catch (Exception ex) {
log.error("StandaloneServer start failed", ex);
System.exit(1);
}
}

private void registry() {
@PostConstruct
private void initRegistry() {
Optional<StandaloneRegistry> registry = registries.stream()
.filter(r -> r.supports(registryType))
.findFirst();

if (registry.isPresent()) {
registry.get().init();
} else {
log.error("Unsupported registry type: {}", registryType);
}
registry.ifPresent(StandaloneRegistry::init);
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Slf4j
@Component
public class ZookeeperStandaloneRegistry implements StandaloneRegistry {
public class StandaloneZookeeperRegistry implements StandaloneRegistry {

@Override
public void init() {
Expand Down

0 comments on commit 0506b9e

Please sign in to comment.