MCPcopy Create free account
hub / github.com/apache/mesos / startNetwork

Method startNetwork

src/tests/zookeeper_test_server.cpp:125–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123
124
125int ZooKeeperTestServer::startNetwork()
126{
127 if (!started) {
128 connectionFactory = new NIOServerCnxnFactory();
129
130 // We use '-1' to allow an unlimited number of connections for this
131 // connection factory instance.
132 connectionFactory->configure(java::net::InetSocketAddress(port), -1);
133
134 // It's possible that we are restarting the network, but not the
135 // server. Unfortunately, we can't just invoke 'startup' on the
136 // NIOServerCnxnFactory because of a bug in ZooKeeperServer (see
137 // MESOS-670). We remedy this with a giant hack: by setting the
138 // 'sessionTracker' variable on ZooKeeperServer to null then a new
139 // instance will get created and everything will work out. Until
140 // ZooKeeper provides mechanisms for doing in-memory testing this
141 // hack (or something like it) will need to exist. This hack is
142 // specific to ZooKeeper 3.4.8 and may need to change if up
143 // upgrade ZooKeeper.
144 zooKeeperServer->sessionTracker = Jvm::Null();
145
146 connectionFactory->startup(*zooKeeperServer);
147
148 if (port == 0) {
149 // We save the ephemeral port so if/when we restart the network
150 // the clients will reconnect to the same server. Note that this
151 // might not actually be kosher because it's possible that another
152 // process could bind to our ephemeral port after we unbind.
153 port = zooKeeperServer->getClientPort();
154 }
155
156 LOG(INFO) << "Started ZooKeeperTestServer on port " << port;
157 started = true;
158 }
159
160 return port;
161}
162
163} // namespace tests {
164} // namespace internal {

Callers 6

TEST_FFunction · 0.80
TEST_FFunction · 0.80
SetUpMethod · 0.80
TEST_FFunction · 0.80
SetUpTestCaseMethod · 0.80
SetUpMethod · 0.80

Calls 5

InetSocketAddressClass · 0.85
configureMethod · 0.80
getClientPortMethod · 0.80
NullClass · 0.50
startupMethod · 0.45

Tested by

no test coverage detected