Adding code for article tracked under BAEL-3573. (#8999)
Co-authored-by: CHANDRAKANT Kumar <kumar.chandrakant@soprabanking.com>
This commit is contained in:
committed by
GitHub
parent
b56b71cf5f
commit
b4610e110f
+22
@@ -0,0 +1,22 @@
|
||||
package com.baeldung.concurrent;
|
||||
|
||||
public class MyCounter {
|
||||
|
||||
private int count;
|
||||
|
||||
public void increment() {
|
||||
int temp = count;
|
||||
count = temp + 1;
|
||||
}
|
||||
|
||||
public synchronized void incrementWithWait() throws InterruptedException {
|
||||
int temp = count;
|
||||
wait(100);
|
||||
count = temp + 1;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework" level="WARN" />
|
||||
<logger name="org.springframework.transaction" level="WARN" />
|
||||
|
||||
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
||||
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user