Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore the old constructor to avoid incompatible issue #1029

Merged
merged 10 commits into from
Oct 18, 2024
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.59.1] - 2024-10-17
- Restore the old constructor to avoid incompatible issue

## [29.59.0] - 2024-10-07
- Add support for announcing/deannoucing service only to INDIS

Expand Down Expand Up @@ -5746,7 +5749,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.59.0...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.59.1...master
[29.59.1]: https://github.com/linkedin/rest.li/compare/v29.59.0...v29.59.1
[29.59.0]: https://github.com/linkedin/rest.li/compare/v29.58.11...v29.59.0
[29.58.11]: https://github.com/linkedin/rest.li/compare/v29.58.10...v29.58.11
[29.58.10]: https://github.com/linkedin/rest.li/compare/v29.58.9...v29.58.10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,78 @@ public class ZooKeeperAnnouncer implements D2ServiceDiscoveryEventHelper
// Field to store the dark warm-up time duration in seconds, defaults to zero
private int _warmupDuration;

/**
* @deprecated Use the constructor {@link #ZooKeeperAnnouncer(LoadBalancerServer)} instead.
*/
@Deprecated
public ZooKeeperAnnouncer(ZooKeeperServer server)
{
this(server, true);
}

public ZooKeeperAnnouncer(LoadBalancerServer server)
{
this(server, true);
}

/**
* @deprecated Use the constructor {@link #ZooKeeperAnnouncer(LoadBalancerServer, boolean)} instead.
*/
@Deprecated
public ZooKeeperAnnouncer(ZooKeeperServer server, boolean initialIsUp)
{
this(server, initialIsUp, DEFAULT_DARK_WARMUP_ENABLED, DEFAULT_DARK_WARMUP_CLUSTER_NAME, DEFAULT_DARK_WARMUP_DURATION, (ScheduledExecutorService) null);
}

public ZooKeeperAnnouncer(LoadBalancerServer server, boolean initialIsUp)
{
this(server, initialIsUp, DEFAULT_DARK_WARMUP_ENABLED, DEFAULT_DARK_WARMUP_CLUSTER_NAME, DEFAULT_DARK_WARMUP_DURATION, (ScheduledExecutorService) null);
}

/**
* @deprecated Use the constructor {@link #ZooKeeperAnnouncer(LoadBalancerServer, boolean, boolean, String, int, ScheduledExecutorService)} instead.
*/
@Deprecated
public ZooKeeperAnnouncer(ZooKeeperServer server, boolean initialIsUp,
boolean isDarkWarmupEnabled, String warmupClusterName, int warmupDuration,
ScheduledExecutorService executorService)
{
this(server, initialIsUp, isDarkWarmupEnabled, warmupClusterName, warmupDuration, executorService,
new LogOnlyServiceDiscoveryEventEmitter()); // default to use log-only event emitter
}

public ZooKeeperAnnouncer(LoadBalancerServer server, boolean initialIsUp,
boolean isDarkWarmupEnabled, String warmupClusterName, int warmupDuration, ScheduledExecutorService executorService)
{
this(server, initialIsUp, isDarkWarmupEnabled, warmupClusterName, warmupDuration, executorService,
new LogOnlyServiceDiscoveryEventEmitter()); // default to use log-only event emitter
}

/**
* @deprecated Use the constructor {@link #ZooKeeperAnnouncer(LoadBalancerServer, boolean, boolean, String, int, ScheduledExecutorService, ServiceDiscoveryEventEmitter)} instead.
*/
@Deprecated
public ZooKeeperAnnouncer(ZooKeeperServer server, boolean initialIsUp,
boolean isDarkWarmupEnabled, String warmupClusterName, int warmupDuration, ScheduledExecutorService executorService, ServiceDiscoveryEventEmitter eventEmitter)
{
_server = server;
// initialIsUp is used for delay mark up. If it's false, there won't be markup when the announcer is started.
_isUp = initialIsUp;
_isWarmingUp = false;
_isRetryWarmup = false;
_pendingMarkDown = new ArrayDeque<>();
_pendingMarkUp = new ArrayDeque<>();
_pendingWarmupMarkDown = new ArrayDeque<>();

_isDarkWarmupEnabled = isDarkWarmupEnabled;
_warmupClusterName = warmupClusterName;
_warmupDuration = warmupDuration;
_executorService = executorService;
_eventEmitter = eventEmitter;

server.setServiceDiscoveryEventHelper(this);
}

public ZooKeeperAnnouncer(LoadBalancerServer server, boolean initialIsUp,
boolean isDarkWarmupEnabled, String warmupClusterName, int warmupDuration, ScheduledExecutorService executorService, ServiceDiscoveryEventEmitter eventEmitter)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,75 @@ protected None convertResponse(None none) throws Exception
}
}

/**
* deprecated, use {@link ConnectionManager#markDownAllServers(Callback)} instead.
*/
@Deprecated
public void markDownAllServers(final Callback<None> callback)
brycezhongqing marked this conversation as resolved.
Show resolved Hide resolved
{
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);
}
}

/**
* deprecated, use {@link ConnectionManager#markUpAllServers(Callback)} instead.
*/
public void markUpAllServers(final Callback<None> callback)
brycezhongqing marked this conversation as resolved.
Show resolved Hide resolved
{
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);
}
}

private class Listener implements ZKPersistentConnection.EventListener
{
@Override
Expand Down Expand Up @@ -295,6 +364,15 @@ public interface ZKStoreFactory<P, Z extends ZooKeeperStore<P>>
Z createStore(ZKConnection connection, String path);
}

/**
* @deprecated Use {@link #ConnectionManager#getAnnouncers()} instead.
*/
@Deprecated
public ZooKeeperAnnouncer[] getAnnouncers()
{
return _servers;
}

@Override
public String getAnnouncementTargetIdentifier()
{
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=29.59.0
version=29.59.1
group=com.linkedin.pegasus
brycezhongqing marked this conversation as resolved.
Show resolved Hide resolved
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down
Loading