Skip to content

Commit

Permalink
8323670: A few client tests intermittently throw ConcurrentModificati…
Browse files Browse the repository at this point in the history
…onException

Reviewed-by: aivanov, serb
  • Loading branch information
Tejesh R committed Feb 1, 2024
1 parent ac1cd31 commit 70e7cdc
Showing 1 changed file with 44 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -341,64 +341,66 @@ private void run0() {
// execute the whole block on the COM thread
runnable = ShellFolder.invoke(new Callable<DoChangeContents>() {
public DoChangeContents call() {
int newSize = newFileCache.size();
int oldSize = fileCache.size();

if (newSize > oldSize) {
//see if interval is added
int start = oldSize;
int end = newSize;
for (int i = 0; i < oldSize; i++) {
if (!newFileCache.get(i).equals(fileCache.get(i))) {
start = i;
for (int j = i; j < newSize; j++) {
if (newFileCache.get(j).equals(fileCache.get(i))) {
end = j;
break;
synchronized (fileCache) {
int newSize = newFileCache.size();
int oldSize = fileCache.size();

if (newSize > oldSize) {
//see if interval is added
int start = oldSize;
int end = newSize;
for (int i = 0; i < oldSize; i++) {
if (!newFileCache.get(i).equals(fileCache.get(i))) {
start = i;
for (int j = i; j < newSize; j++) {
if (newFileCache.get(j).equals(fileCache.get(i))) {
end = j;
break;
}
}
break;
}
break;
}
}

if (start >= 0 && end > start) {
List<File> listStart_OldSize = new Vector<>(fileCache.subList(start, oldSize));
if (newFileCache.subList(end, newSize).equals(listStart_OldSize)) {
if (start >= 0 && end > start
&& newFileCache.subList(end, newSize)
.equals(fileCache.subList(start, oldSize))) {
if (loadThread.isInterrupted()) {
return null;
}
return new DoChangeContents(newFileCache.subList(start, end), start, null, 0, fid);
return new DoChangeContents(newFileCache.subList(start, end),
start, null, 0, fid);
}
}
} else if (newSize < oldSize) {
//see if interval is removed
int start = -1;
int end = -1;
for (int i = 0; i < newSize; i++) {
if (!newFileCache.get(i).equals(fileCache.get(i))) {
start = i;
end = i + oldSize - newSize;
break;
} else if (newSize < oldSize) {
//see if interval is removed
int start = -1;
int end = -1;
for (int i = 0; i < newSize; i++) {
if (!newFileCache.get(i).equals(fileCache.get(i))) {
start = i;
end = i + oldSize - newSize;
break;
}
}
}

if (start >= 0 && end > start) {
List<File> listEnd_OldSize = new Vector<>(fileCache.subList(end, oldSize));
if (listEnd_OldSize.equals(newFileCache.subList(start, newSize))) {
if (start >= 0 && end > start
&& fileCache.subList(end, oldSize)
.equals(newFileCache.subList(start, newSize))) {
if (loadThread.isInterrupted()) {
return null;
}
return new DoChangeContents(null, 0, new Vector<>(fileCache.subList(start, end)), start, fid);
return new DoChangeContents(null, 0,
new Vector<>(fileCache.subList(start, end)), start, fid);
}
}
}
if (!fileCache.equals(newFileCache)) {
if (loadThread.isInterrupted()) {
cancelRunnables();
if (!fileCache.equals(newFileCache)) {
if (loadThread.isInterrupted()) {
cancelRunnables();
}
return new DoChangeContents(newFileCache, 0, fileCache, 0, fid);
}
return new DoChangeContents(newFileCache, 0, fileCache, 0, fid);
return null;
}
return null;
}
});

Expand Down

7 comments on commit 70e7cdc

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aivanov-jdk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk22u

@openjdk
Copy link

@openjdk openjdk bot commented on 70e7cdc Apr 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aivanov-jdk the backport was successfully created on the branch backport-aivanov-jdk-70e7cdcb in my personal fork of openjdk/jdk22u. To create a pull request with this backport targeting openjdk/jdk22u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 70e7cdcb from the openjdk/jdk repository.

The commit being backported was authored by Tejesh R on 1 Feb 2024 and was reviewed by Alexey Ivanov and Sergey Bylokhov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk22u:

$ git fetch https://github.com/openjdk-bots/jdk22u.git backport-aivanov-jdk-70e7cdcb:backport-aivanov-jdk-70e7cdcb
$ git checkout backport-aivanov-jdk-70e7cdcb
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk22u.git backport-aivanov-jdk-70e7cdcb

@TheRealMDoerr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 70e7cdc May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr the backport was successfully created on the branch backport-TheRealMDoerr-70e7cdcb in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 70e7cdcb from the openjdk/jdk repository.

The commit being backported was authored by Tejesh R on 1 Feb 2024 and was reviewed by Alexey Ivanov and Sergey Bylokhov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-TheRealMDoerr-70e7cdcb:backport-TheRealMDoerr-70e7cdcb
$ git checkout backport-TheRealMDoerr-70e7cdcb
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-TheRealMDoerr-70e7cdcb

@TheRealMDoerr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 70e7cdc Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr the backport was successfully created on the branch backport-TheRealMDoerr-70e7cdcb-master in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 70e7cdcb from the openjdk/jdk repository.

The commit being backported was authored by Tejesh R on 1 Feb 2024 and was reviewed by Alexey Ivanov and Sergey Bylokhov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git backport-TheRealMDoerr-70e7cdcb-master:backport-TheRealMDoerr-70e7cdcb-master
$ git checkout backport-TheRealMDoerr-70e7cdcb-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git backport-TheRealMDoerr-70e7cdcb-master

Please sign in to comment.