Skip to content

Commit

Permalink
fixed synchronized this
Browse files Browse the repository at this point in the history
  • Loading branch information
agapple committed Dec 4, 2017
1 parent 2fd0dc1 commit 7e29d66
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ protected TableSqlUnit getSqlUnit(Record record) {
List<String> names = Arrays.asList(record.getSchemaName(), record.getTableName());
TableSqlUnit sqlUnit = selectSqlCache.get(names);
if (sqlUnit == null) {
synchronized (names) {
synchronized (this) {
sqlUnit = selectSqlCache.get(names);
if (sqlUnit == null) { // double-check
sqlUnit = new TableSqlUnit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected TableSqlUnit getSqlUnit(Record record) {
List<String> names = Arrays.asList(record.getSchemaName(), record.getTableName());
TableSqlUnit sqlUnit = applierSqlCache.get(names);
if (sqlUnit == null) {
synchronized (names) {
synchronized (this) {
sqlUnit = applierSqlCache.get(names);
if (sqlUnit == null) { // double-check
sqlUnit = new TableSqlUnit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected TableSqlUnit getInsertSqlUnit(IncrementRecord record) {
List<String> names = Arrays.asList(record.getSchemaName(), record.getTableName());
TableSqlUnit sqlUnit = insertSqlCache.get(names);
if (sqlUnit == null) {
synchronized (names) {
synchronized (this) {
sqlUnit = insertSqlCache.get(names);
if (sqlUnit == null) { // double-check
sqlUnit = new TableSqlUnit();
Expand Down Expand Up @@ -225,7 +225,7 @@ protected TableSqlUnit getUpdateSqlUnit(IncrementRecord record) {
List<String> names = Arrays.asList(record.getSchemaName(), record.getTableName());
TableSqlUnit sqlUnit = updateSqlCache.get(names);
if (sqlUnit == null) {
synchronized (names) {
synchronized (this) {
sqlUnit = updateSqlCache.get(names);
if (sqlUnit == null) { // double-check
sqlUnit = new TableSqlUnit();
Expand Down Expand Up @@ -291,7 +291,7 @@ protected TableSqlUnit getDeleteSqlUnit(IncrementRecord record) {
List<String> names = Arrays.asList(record.getSchemaName(), record.getTableName());
TableSqlUnit sqlUnit = deleteSqlCache.get(names);
if (sqlUnit == null) {
synchronized (names) {
synchronized (this) {
sqlUnit = deleteSqlCache.get(names);
if (sqlUnit == null) { // double-check
sqlUnit = new TableSqlUnit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ protected TableSqlUnit getMasterSqlUnit(IncrementRecord record) {
List<String> names = Arrays.asList(record.getSchemaName(), record.getTableName());
TableSqlUnit sqlUnit = masterSqlCache.get(names);
if (sqlUnit == null) {
synchronized (names) {
synchronized (this) {
sqlUnit = masterSqlCache.get(names);
if (sqlUnit == null) { // double-check
sqlUnit = new TableSqlUnit();
Expand Down

0 comments on commit 7e29d66

Please sign in to comment.