A file with an error was committed. How to fix this situation?
Java
What is sharding?
Tell about your mentoring experience with juniors — what was the essence and what were the difficulties?
How would you rate yourself now: middle, senior, or on a 10-point scale?
Read the code and identify errors ```java @Component public class AuthorSearchService { @Autowired private AuthorRepository authorRepository; @Autowired private StatisticsRepository statisticsRepository; private AlertRestClient arc = new AlertRestClient(); // The query can contain either the full name or part of it, e.g., "Vadim Pavlo" or "pavlo" @Transactional public List<Author> search(String query) { List<Author> authors = authorRepository.findByNameContainingIgnoreCase(query); Statistics s = statisticsRepository.findById(query).orElse(null); if (s == null) s = new Statistics(query); s.setNumbers(s.getNumbers() + 1); statisticsRepository.save(s); if (s.getNumbers() > 1000 && authors.size() > 1000) { System.out.println("too popular search with too much data, sending an alert..."); arc.send(query, s.getNumbers(), authors.size()); } return authors; } } @Entity @Data public class Author { @Id @GeneratedValue private Long id; private String name; @OneToMany(mappedBy = "author") private List<Book> books; public Author(String name) { this.name = name; } } ```
What is transactional load? What was the transactional load in your system?
Do you think story points are truly useful or just a formality for managers?
@Service @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) class MyService { public String getMessage() { return "Hello from MyService! Instance: " + this.hashCode(); } } @RestController public class MyRestController { @Autowired private MyService myService; @GetMapping("/api/hello") public String hello() { return myService.getMessage(); } } curl [link] Hello from MyService! Instance: 56149 curl [link] Hello from MyService! Instance: ???????
What are schedulers in Reactor?
What design patterns have you used in your project?
class Task { private static int counter = 0; public static void main(String[] args) throws Exception { var thread1 = new Thread(() -> increase()); var thread2 = new Thread(() -> increase()); thread1.start(); thread2.start(); thread1.join(); thread2.join(); System.out.println(counter); } private static void increase() { for (int i = 0; i < 5000; i++) { counter++; } } }
What databases have you used in your career?
How to construct dynamic queries when filter conditions are unknown in advance (e.g., 10 optional fields)?
What is the difference between orchestration and choreography?
Why are you looking for a new job?
How would you organize auditing of service calls, for example, Service A was called a million times, Service B — a hundred times in a day. How would you solve this task?
What other collections do you know besides HashMap that can be used?
What is the Strategy pattern, how is it used, and how does it compare to switch-case?
What are transactions? Explain the reasons for use and the properties of ACID.
// 3 public class Variables { public static void main(String[] args) { A a = new A(); a.val = 1; inc(a); System.out.println(a.val); set(a); System.out.println(a.val); } public static class A { public int val; } public static void inc(A a) { a.val++; } public static void set(A a) { a = new A(); a.val = 10; } }