Last active
December 13, 2015 21:59
-
-
Save ericacm/4981559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ZookeeperService(hostInfo: HostInfo) | |
extends ClusterService with EmbeddedZookeeper with Logging { | |
// For Standalone use the hostname, eg. localhost | |
// For Replicated use hostname:port,hostname:port,... | |
@Value("${zookeeperService.hosts:localhost}") | |
var hosts: String = _ | |
// This node's ZK server client port | |
def clientPort: Int = hostInfo.appBasePort + 1 | |
def initialize() { | |
val serverNames = genServerNames(hosts) | |
if (isServerEnabled) { | |
val serverStarter = configureServer(serverNames) | |
startServer(serverStarter) | |
} else { | |
log.info("Embedded zookeeper server not enabled") | |
} | |
// Client startup | |
val connectString = serverNames.hosts.mkString(",") | |
// ... | |
} | |
// ... see part 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment