Skip to content

Commit 2128798

Browse files
committed
fixed ArangoCollection.rename() thread safety
1 parent 9875539 commit 2128798

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

core/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,7 @@ public CollectionPropertiesEntity changeProperties(final CollectionPropertiesOpt
466466

467467
@Override
468468
public synchronized CollectionEntity rename(final String newName) {
469-
final CollectionEntity result = executor.execute(renameRequest(newName), CollectionEntity.class);
470-
name = result.getName();
471-
return result;
469+
return executor.execute(renameRequest(newName), CollectionEntity.class);
472470
}
473471

474472
@Override

core/src/main/java/com/arangodb/internal/InternalArangoCollection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public abstract class InternalArangoCollection<A extends InternalArangoDB<E>, D
6161
private static final String TRANSACTION_ID = "x-arango-trx-id";
6262

6363
private final D db;
64-
protected volatile String name;
64+
protected final String name;
6565

6666
protected InternalArangoCollection(final D db, final String name) {
6767
super(db.executor, db.serde);

docs/v7_detailed_changes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ The class `com.arangodb.DbName` has been removed. The database names can now be
342342
Support to unicode characters in data definition names (databases, collections, views, indexes) has been added, see
343343
[Support to unicode data definition names](v7_java.md#unicode-characters-in-data-definition-names).
344344

345+
`com.arangodb.ArangoCollection.rename(String)` does not change anymore the collection name of the instance
346+
of `ArangoCollection` on which it is invoked. To interact with the renamed collection, a new instance
347+
of `ArangoCollection` with the new name must be created.
345348

346349
## API entities
347350

0 commit comments

Comments
 (0)