-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of ssh://github.com/shardingjdbc/sharding-jdbc int…
…o dev
- Loading branch information
Showing
8 changed files
with
62 additions
and
31 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
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
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
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 |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
import io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.operation.DeleteCurrentBranchOperation; | ||
import io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.operation.DeleteCurrentOperation; | ||
import io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.operation.UpdateOperation; | ||
import io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.section.Connection; | ||
import org.apache.zookeeper.CreateMode; | ||
import org.apache.zookeeper.KeeperException; | ||
import org.slf4j.Logger; | ||
|
@@ -50,9 +51,13 @@ public void createCurrentOnly(final String key, final String value, final Create | |
String path = getProvider().getRealPath(key); | ||
try { | ||
getProvider().create(path, value, createMode); | ||
} catch (KeeperException.SessionExpiredException e) { | ||
LOGGER.warn("AsyncRetryStrategy SessionExpiredException createCurrentOnly:{}", path); | ||
AsyncRetryCenter.INSTANCE.add(new CreateCurrentOperation(getProvider(), path, value, createMode)); | ||
} catch (KeeperException e) { | ||
if (Connection.needRetry(e)) { | ||
This comment has been minimized.
Sorry, something went wrong.
WillemJiang
Member
|
||
LOGGER.warn("AsyncRetryStrategy SessionExpiredException createCurrentOnly:{}", path); | ||
AsyncRetryCenter.INSTANCE.add(new CreateCurrentOperation(getProvider(), path, value, createMode)); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
} | ||
|
||
|
@@ -61,9 +66,13 @@ public void update(final String key, final String value) throws KeeperException, | |
String path = getProvider().getRealPath(key); | ||
try { | ||
getProvider().update(path, value); | ||
} catch (KeeperException.SessionExpiredException e) { | ||
LOGGER.warn("AsyncRetryStrategy SessionExpiredException update:{}", path); | ||
AsyncRetryCenter.INSTANCE.add(new UpdateOperation(getProvider(), path, value)); | ||
} catch (KeeperException e) { | ||
if (Connection.needRetry(e)) { | ||
LOGGER.warn("AsyncRetryStrategy SessionExpiredException update:{}", path); | ||
AsyncRetryCenter.INSTANCE.add(new UpdateOperation(getProvider(), path, value)); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
} | ||
|
||
|
@@ -72,39 +81,55 @@ public void deleteOnlyCurrent(final String key) throws KeeperException, Interrup | |
String path = getProvider().getRealPath(key); | ||
try { | ||
getProvider().delete(path); | ||
} catch (KeeperException.SessionExpiredException e) { | ||
LOGGER.warn("AsyncRetryStrategy SessionExpiredException deleteOnlyCurrent:{}", path); | ||
AsyncRetryCenter.INSTANCE.add(new DeleteCurrentOperation(getProvider(), path)); | ||
} catch (KeeperException e) { | ||
if (Connection.needRetry(e)) { | ||
LOGGER.warn("AsyncRetryStrategy SessionExpiredException deleteOnlyCurrent:{}", path); | ||
AsyncRetryCenter.INSTANCE.add(new DeleteCurrentOperation(getProvider(), path)); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void createAllNeedPath(final String key, final String value, final CreateMode createMode) throws KeeperException, InterruptedException { | ||
try { | ||
super.createAllNeedPath(key, value, createMode); | ||
} catch (KeeperException.SessionExpiredException e) { | ||
LOGGER.warn("AllAsyncRetryStrategy SessionExpiredException CreateAllNeedOperation:{}", key); | ||
AsyncRetryCenter.INSTANCE.add(new CreateAllNeedOperation(getProvider(), key, value, createMode)); | ||
} catch (KeeperException e) { | ||
if (Connection.needRetry(e)) { | ||
LOGGER.warn("AllAsyncRetryStrategy SessionExpiredException CreateAllNeedOperation:{}", key); | ||
AsyncRetryCenter.INSTANCE.add(new CreateAllNeedOperation(getProvider(), key, value, createMode)); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void deleteAllChildren(final String key) throws KeeperException, InterruptedException { | ||
try { | ||
super.deleteAllChildren(key); | ||
} catch (KeeperException.SessionExpiredException e) { | ||
LOGGER.warn("AllAsyncRetryStrategy SessionExpiredException deleteAllChildren:{}", key); | ||
AsyncRetryCenter.INSTANCE.add(new DeleteAllChildrenOperation(getProvider(), key)); | ||
} catch (KeeperException e) { | ||
if (Connection.needRetry(e)) { | ||
LOGGER.warn("AllAsyncRetryStrategy SessionExpiredException deleteAllChildren:{}", key); | ||
AsyncRetryCenter.INSTANCE.add(new DeleteAllChildrenOperation(getProvider(), key)); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void deleteCurrentBranch(final String key) throws KeeperException, InterruptedException { | ||
try { | ||
super.deleteCurrentBranch(key); | ||
} catch (KeeperException.SessionExpiredException e) { | ||
LOGGER.warn("AllAsyncRetryStrategy SessionExpiredException deleteCurrentBranch:{}", key); | ||
AsyncRetryCenter.INSTANCE.add(new DeleteCurrentBranchOperation(getProvider(), key)); | ||
} catch (KeeperException e) { | ||
if (Connection.needRetry(e)) { | ||
LOGGER.warn("AllAsyncRetryStrategy SessionExpiredException deleteCurrentBranch:{}", key); | ||
AsyncRetryCenter.INSTANCE.add(new DeleteCurrentBranchOperation(getProvider(), key)); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
} | ||
} |
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 method doesn't throw the KeeperException, please update the java doc.