-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af7f497
commit 7e7a3ca
Showing
5 changed files
with
139 additions
and
86 deletions.
There are no files selected for viewing
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
114 changes: 114 additions & 0 deletions
114
d2/src/main/java/com/linkedin/d2/balancer/servers/ConnectionManager.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
package com.linkedin.d2.balancer.servers; | ||
|
||
import com.linkedin.common.callback.Callback; | ||
import com.linkedin.common.callback.Callbacks; | ||
import com.linkedin.common.util.None; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public abstract class ConnectionManager | ||
{ | ||
private final ZooKeeperAnnouncer[] _servers; | ||
private final String _zkConnectString; | ||
private final int _zkSessionTimeout; | ||
private final String _zkBasePath; | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(ConnectionManager.class); | ||
|
||
protected ConnectionManager(ZooKeeperAnnouncer[] servers, String zkConnectString, int zkSessionTimeout, String zkBasePath) | ||
{ | ||
_servers = servers; | ||
_zkConnectString = zkConnectString; | ||
_zkSessionTimeout = zkSessionTimeout; | ||
_zkBasePath = zkBasePath; | ||
} | ||
|
||
abstract public void start(Callback<None> callback); | ||
|
||
abstract public void shutdown(final Callback<None> callback); | ||
|
||
public void markDownAllServers(final Callback<None> callback) | ||
{ | ||
Callback<None> markDownCallback; | ||
if (callback != null) | ||
{ | ||
markDownCallback = callback; | ||
} | ||
else | ||
{ | ||
markDownCallback = new Callback<None>() | ||
{ | ||
@Override | ||
public void onError(Throwable e) | ||
{ | ||
LOG.error("failed to mark down servers", e); | ||
} | ||
|
||
@Override | ||
public void onSuccess(None result) | ||
{ | ||
LOG.info("mark down all servers successful"); | ||
} | ||
}; | ||
} | ||
Callback<None> multiCallback = Callbacks.countDown(markDownCallback, _servers.length); | ||
for (ZooKeeperAnnouncer server : _servers) | ||
{ | ||
server.markDown(multiCallback); | ||
} | ||
} | ||
|
||
public void markUpAllServers(final Callback<None> callback) | ||
{ | ||
Callback<None> markUpCallback; | ||
if (callback != null) | ||
{ | ||
markUpCallback = callback; | ||
} | ||
else | ||
{ | ||
markUpCallback = new Callback<None>() | ||
{ | ||
@Override | ||
public void onError(Throwable e) | ||
{ | ||
LOG.error("failed to mark up servers", e); | ||
} | ||
|
||
@Override | ||
public void onSuccess(None result) | ||
{ | ||
LOG.info("mark up all servers successful"); | ||
} | ||
}; | ||
} | ||
Callback<None> multiCallback = Callbacks.countDown(markUpCallback, _servers.length); | ||
for (ZooKeeperAnnouncer server : _servers) | ||
{ | ||
server.markUp(multiCallback); | ||
} | ||
|
||
} | ||
|
||
public ZooKeeperAnnouncer[] getAnnouncers() | ||
{ | ||
return _servers; | ||
} | ||
|
||
abstract public boolean isSessionEstablished(); | ||
|
||
public String getZooKeeperConnectString() | ||
{ | ||
return _zkConnectString; | ||
} | ||
|
||
public int getZooKeeperSessionTimeout() | ||
{ | ||
return _zkSessionTimeout; | ||
} | ||
|
||
public String getZooKeeperBasePath() | ||
{ | ||
return _zkBasePath; | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
grep -o "include '[^']*'" settings.gradle | sed -e "s/^include '/com.linkedin.pegasus:/g" -e "s/'//g" | while read -r module_name ; do | ||
if [ "$module_name" == "com.linkedin.pegasus:gradle-plugins" ] | ||
then | ||
echo "WARNING: $module_name cannot be deprecated due to MPPCX-7165. Skipping deprecation..." | ||
else | ||
mint catalog deprecate "$module_name" "$@" | ||
fi | ||
done |
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