Bu konuyu ilk defa burada gördüm. Nesneyi mutable olarak yarattıktan sonra belli bir noktada freeze() metodunu çağırıyoruz ve bundan sonra nesne immutable oluyor.
Java
Orçun Çolak'ın her şeyden bir parça notları
3 Şubat 2026 Salı
Eventual Immutability
Giriş
14 Mart 2025 Cuma
JEP 491 - Synchronize Virtual Threads without Pinning.
Giriş
Açıklaması şöyle
Improve the scalability of Java code that uses synchronized methods and statements by arranging for virtual threads that block in such constructs to release their underlying platform threads for use by other virtual threads. This will eliminate nearly all cases of virtual threads being pinned to platform threads, which severely restricts the number of virtual threads available to handle an application's workload.
synchronized block kullanıyorsak Virtual Thread pinned oluyor. Bu JEP ile artık olmuyor
20 Ocak 2025 Pazartesi
IntelliJ Idea Comment İçin Code Style
Comment At Firt Column
Cevap burada
- Settings | Editor | Code Style | Java | Code Generation | Comment Code | Line comment at first column -> Uncheck
- Settings | Editor | Code Style | Java | Code Generation | Comment Code | Block comment at first column -> Uncheck
- Settings | Editor | Code Style | Java | Wrapping and Braces | Keep when reformatting | Comment at first column -> Uncheck
Ayrıca Method Call Argument uzunsa ayrı satıra gelsin diye
- Settings | Editor | Code Style | Java | Wrapping and Braces | Method Call Arguments | -> Wrap if long
Ayrıca Chained method calls her biri ayrı satıra gelsin diye
- Settings | Editor | Code Style | Java | Wrapping and Braces | Chanied Method Calls | -> Wrap always
14 Ocak 2025 Salı
javadoc komutu
Örnek
Şöyle yaparız. docs/index.html dosyasını oluşturur
javadoc --enable-preview --source 22 -d docs Calculator.java
29 Aralık 2024 Pazar
JMeter CLI
CLI vs Non-CLI
Açıklaması şöyle
JMeter has two modes: CLI and Non-CLI. .... CLI mode doesn't have any user interface. But Non-CLI mode has a user interface where you can point-and-click and interact with the JMeter.Non-CLI mode should be used for recording, scripting, and smoke testing. This mode utilizes more resources (CPU and memory). CLI mode must be used for load testing, stress testing, and other forms of performance testing as well as for CI/CD pipelines. This mode doesn't eat up more resources as there is no user interface to load and render.
Örnek
Şöyle yaparız
jmeter -n -t test_plan.jmx -l test_results.jtl
12 Aralık 2024 Perşembe
Java record İle Yapılamayacak Şeyler
1. Records Cannot Extend Another Class
2. Records Cannot Be Extended
Örnek
Şu kod derlenmez
public class PremiumRecord extends InsuranceRecord {…}
3. Records Cannot Have Additional Instance Fields
Örnek
Şu kod derlenmez
public record InsuranceRecord(String type, float premium) {
private String policyNumber; // This won't compile
}4. Private Canonical Constructors Are Not Allowed
Örnek
Şu kod derlenmez
public record InsuranceRecord(String type, float premium) {
private InsuranceRecord(String type, float premium) {
this.type = type;
this.premium = premium;
}
public static InsuranceRecord newInstance(String type, float premium) {
return new InsuranceRecord(type, premium);
}
}
5. Records Cannot Have Setters
Örnek
Şu kod derlenmez
public record InsuranceRecord(String type, float premium) {
public void setType(String type) {
this.type = type; // Won't compile
}
}
3 Haziran 2024 Pazartesi
@Serial Anotasyonu
Giriş
Bu anotasyon sadece kodda var yani byte code'a girmiyor. Açıklaması şöyleşöyle
This annotation exists purely to engage better compile-time type checking. It is analogous in this way to the @Override annotation, which exists purely to capture design intent, so that humans and tools have more information to work with.
Kaydol:
Yorumlar (Atom)