There is a system that allows users to work with files in the browser. The stack is standard: Java, Spring, React, Postgres. Files are stored in the file system on the backend, file metadata in the database. The team implemented a feature - renaming a file. This method is essentially key for renaming a file on the backend. A review is needed to identify potential issues in the existing code and suggest ways to fix them. @Transactional public void process(String oldName, String newName) { Long id = exec("select id from file where name='" + oldName + "'"); processFile(oldName, newName); // renaming the file on disk exec("update file set name='" + newName + "' where id = " + id); }
Java
What is the time complexity of obtaining an element by its index in an array list?
Does Kafka topic have FIFO property?
Tell us about your testing coverage and approach to testing in your team.
How did you configure the logic for reading from Dead Letter Queue and where is the ack (manual acknowledgement) done?
What indexes have you had to use (including covering indexes)?
How do Virtual Threads work?
Task: Given two lists, output the elements of the first list that are not in the second. Write a solution in Java.
What types of relationships in Hibernate do you know and how to describe them? What entity states exist?
Why should countStock be synchronous rather than asynchronous?
Features of using @Transactional in Spring. Transaction isolation levels.
Did you have to work on a state machine for this task?
Did all team members participate in the code review process?
Have you encountered the problem of distributed transactions? Tell us about the Saga pattern.
What is the purpose of the volatile keyword?
Name three differences between REST and SOAP.
Tell about design patterns — why they are needed, what groups, examples.
How does Kafka work with multiple application instances? What is a consumer group, partitions, rebalancing?
What is the difference between using Hibernate and direct interaction with the database via JDBC?
Choose a design pattern for a logging system (in DB, text file, via request)