Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brycezhongqing committed Oct 8, 2024
1 parent 873f9a6 commit f727ff8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@
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)
protected ConnectionManager(ZooKeeperAnnouncer[] servers)
{
_servers = servers;
_zkConnectString = zkConnectString;
_zkSessionTimeout = zkSessionTimeout;
_zkBasePath = zkBasePath;
}

abstract public void start(Callback<None> callback);

abstract public void shutdown(final Callback<None> callback);

abstract public String getAnnouncementTargetIdentifier();

public void markDownAllServers(final Callback<None> callback)
{
Callback<None> markDownCallback;
Expand Down Expand Up @@ -94,21 +90,4 @@ public ZooKeeperAnnouncer[] getAnnouncers()
{
return _servers;
}

abstract public boolean isSessionEstablished();

public String getZooKeeperConnectString()
{
return _zkConnectString;
}

public int getZooKeeperSessionTimeout()
{
return _zkSessionTimeout;
}

public String getZooKeeperBasePath()
{
return _zkBasePath;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ public ZooKeeperConnectionManager(ZKPersistentConnection zkConnection,
ZKStoreFactory<UriProperties,ZooKeeperEphemeralStore<UriProperties>> factory,
ZooKeeperAnnouncer... servers)
{
super(servers,
zkConnection.getZKConnection().getConnectString(),
zkConnection.getZKConnection().getTimeout(),
zkBasePath);
super(servers);
_zkBasePath = zkBasePath;
_zkConnection = zkConnection;
_factory = factory;
Expand All @@ -98,10 +95,7 @@ public ZooKeeperConnectionManager(String zkConnectString, int zkSessionTimeout,
ZKStoreFactory<UriProperties,ZooKeeperEphemeralStore<UriProperties>> factory,
ZooKeeperAnnouncer... servers)
{
super(servers,
zkConnectString,
zkSessionTimeout,
zkBasePath);
super(servers);
_zkConnectString = zkConnectString;
_zkSessionTimeout = zkSessionTimeout;
_zkBasePath = zkBasePath;
Expand Down Expand Up @@ -189,6 +183,7 @@ protected None convertResponse(None none) throws Exception
zkCloseCallback.onSuccess(None.none());
}
}

private class Listener implements ZKPersistentConnection.EventListener
{
@Override
Expand Down Expand Up @@ -301,8 +296,28 @@ public interface ZKStoreFactory<P, Z extends ZooKeeperStore<P>>
}

@Override
public String getAnnouncementTargetIdentifier()
{
return getZooKeeperConnectString();
}

public boolean isSessionEstablished()
{
return _sessionEstablished;
}

public String getZooKeeperConnectString()
{
return _zkConnectString;
}

public int getZooKeeperSessionTimeout()
{
return _zkSessionTimeout;
}

public String getZooKeeperBasePath()
{
return _zkBasePath;
}
}

0 comments on commit f727ff8

Please sign in to comment.