Skip to content

Commit fa33db8

Browse files
committed
Maven Structure added to the previous project
1 parent ae7cf19 commit fa33db8

33 files changed

Lines changed: 285 additions & 253 deletions

File tree

JavaMultiThreadingCodes/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**/.git/*
2+
**/target/*
3+
/.idea/*
4+
/out/*
5+
*.iml
6+
**/META-INF/*
7+
**/nb-configuration.xml
8+
**/hibernate.configs.xml

JavaMultiThreadingCodes/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.mehdi</groupId>
8+
<artifactId>JavaMultiThreading</artifactId>
9+
<version>1.0</version>
10+
<build>
11+
<plugins>
12+
<plugin>
13+
<groupId>org.apache.maven.plugins</groupId>
14+
<artifactId>maven-compiler-plugin</artifactId>
15+
<configuration>
16+
<source>7</source>
17+
<target>7</target>
18+
</configuration>
19+
</plugin>
20+
</plugins>
21+
</build>
22+
23+
24+
</project>

JavaMultiThreadingCodes/src/CallableAndFuture_13/App.java renamed to JavaMultiThreadingCodes/src/main/java/CallableAndFuture_13/App.java

File renamed without changes.

JavaMultiThreadingCodes/src/CallableAndFuture_13/App2.java renamed to JavaMultiThreadingCodes/src/main/java/CallableAndFuture_13/App2.java

File renamed without changes.

JavaMultiThreadingCodes/src/CallableAndFuture_13/CallableTester.java renamed to JavaMultiThreadingCodes/src/main/java/CallableAndFuture_13/CallableTester.java

File renamed without changes.

JavaMultiThreadingCodes/src/CountDownLatch_6/App.java renamed to JavaMultiThreadingCodes/src/main/java/CountDownLatch_6/App.java

File renamed without changes.

JavaMultiThreadingCodes/src/Deadlock_11/Account.java renamed to JavaMultiThreadingCodes/src/main/java/Deadlock_11/Account.java

File renamed without changes.
Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
package Deadlock_11;
2-
3-
/**
4-
* <a href="https://wikipedia.org/wiki/Deadlock">Deadlock</a>
5-
* can occur in a situation when a thread is waiting for an object's lock,
6-
* that is acquired by another thread and the second thread is waiting for an
7-
* object lock that is acquired by first thread. Since, both threads are waiting
8-
* for each other to release the lock, the condition is called deadlock. If you
9-
* make sure that all locks are always taken in the same order by any thread,
10-
* deadlocks cannot occur.
11-
* <br><br>
12-
* Codes with minor comments are from
13-
* <a href="http://www.caveofprogramming.com/youtube/">
14-
* <em>http://www.caveofprogramming.com/youtube/</em>
15-
* </a>
16-
* <br>
17-
* also freely available at
18-
* <a href="https://www.udemy.com/java-multithreading/?couponCode=FREE">
19-
* <em>https://www.udemy.com/java-multithreading/?couponCode=FREE</em>
20-
* </a>
21-
*
22-
* @author Z.B. Celik <celik.berkay@gmail.com>
23-
*/
24-
public class App {
25-
26-
public static void main(String[] args) throws Exception {
27-
final Runner runner = new Runner();
28-
Thread t1 = new Thread(new Runnable() {
29-
public void run() {
30-
try {
31-
runner.firstThread();
32-
} catch (InterruptedException ignored) {}
33-
}
34-
});
35-
36-
Thread t2 = new Thread(new Runnable() {
37-
public void run() {
38-
try {
39-
runner.secondThread();
40-
} catch (InterruptedException ignored) {}
41-
}
42-
});
43-
44-
t1.start();
45-
t2.start();
46-
t1.join();
47-
t2.join();
48-
runner.finished();
49-
}
50-
}
1+
package Deadlock_11;
2+
3+
/**
4+
* <a href="https://wikipedia.org/wiki/Deadlock">Deadlock</a>
5+
* can occur in a situation when a thread is waiting for an object's lock,
6+
* that is acquired by another thread and the second thread is waiting for an
7+
* object lock that is acquired by first thread. Since, both threads are waiting
8+
* for each other to release the lock, the condition is called deadlock. If you
9+
* make sure that all locks are always taken in the same order by any thread,
10+
* deadlocks cannot occur.
11+
* <br><br>
12+
* Codes with minor comments are from
13+
* <a href="http://www.caveofprogramming.com/youtube/">
14+
* <em>http://www.caveofprogramming.com/youtube/</em>
15+
* </a>
16+
* <br>
17+
* also freely available at
18+
* <a href="https://www.udemy.com/java-multithreading/?couponCode=FREE">
19+
* <em>https://www.udemy.com/java-multithreading/?couponCode=FREE</em>
20+
* </a>
21+
*
22+
* @author Z.B. Celik <celik.berkay@gmail.com>
23+
*/
24+
public class App {
25+
26+
public static void main(String[] args) throws Exception {
27+
final Runner runner = new Runner();
28+
Thread t1 = new Thread(new Runnable() {
29+
public void run() {
30+
try {
31+
runner.firstThread();
32+
} catch (InterruptedException ignored) {}
33+
}
34+
});
35+
36+
Thread t2 = new Thread(new Runnable() {
37+
public void run() {
38+
try {
39+
runner.secondThread();
40+
} catch (InterruptedException ignored) {}
41+
}
42+
});
43+
44+
t1.start();
45+
t2.start();
46+
t1.join();
47+
t2.join();
48+
runner.finished();
49+
}
50+
}

JavaMultiThreadingCodes/src/Deadlock_11/Runner.java renamed to JavaMultiThreadingCodes/src/main/java/Deadlock_11/Runner.java

File renamed without changes.

JavaMultiThreadingCodes/src/Deadlock_11/SimpleDeadLock.java renamed to JavaMultiThreadingCodes/src/main/java/Deadlock_11/SimpleDeadLock.java

File renamed without changes.

0 commit comments

Comments
 (0)