Skip to content

Commit a8da749

Browse files
authored
Add files via upload
1 parent 7ade2f7 commit a8da749

File tree

93 files changed

+1585
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1585
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"formatVersion": 3,
3+
"id": "root",
4+
"ideas": {
5+
"1": {
6+
"title": "Concurrency and Parallelization",
7+
"id": 1,
8+
"attr": {
9+
"position": [
10+
-219,
11+
-38,
12+
1
13+
],
14+
"style": {
15+
"width": 256,
16+
"fontMultiplier": 1.25,
17+
"backgroundColor": "#FF0000",
18+
"text": {
19+
"color": "#FFFFFF"
20+
}
21+
}
22+
},
23+
"ideas": {
24+
"1": {
25+
"title": "How to Add Concurrency",
26+
"id": "2.e4a833605fb111eab7c4b5664a1da10d",
27+
"attr": {
28+
"style": {
29+
"width": 159,
30+
"backgroundColor": "#000000",
31+
"text": {
32+
"color": "#FFFFFF"
33+
}
34+
},
35+
"position": [
36+
240,
37+
-134,
38+
3
39+
]
40+
}
41+
},
42+
"11": {
43+
"title": "Schedulers",
44+
"id": "3.e4a833605fb111eab7c4b5664a1da10d",
45+
"attr": {
46+
"position": [
47+
293,
48+
-51,
49+
4
50+
],
51+
"style": {
52+
"width": 159,
53+
"backgroundColor": "#000000",
54+
"text": {
55+
"color": "#FFFFFF"
56+
}
57+
}
58+
}
59+
},
60+
"21": {
61+
"title": "subscribeOn()",
62+
"id": "4.e4a833605fb111eab7c4b5664a1da10d",
63+
"attr": {
64+
"position": [
65+
299,
66+
29,
67+
5
68+
],
69+
"style": {
70+
"width": 159,
71+
"backgroundColor": "#000000",
72+
"text": {
73+
"color": "#FFFFFF"
74+
}
75+
}
76+
}
77+
},
78+
"31": {
79+
"title": "observeOn()",
80+
"id": "5.e4a833605fb111eab7c4b5664a1da10d",
81+
"attr": {
82+
"position": [
83+
298,
84+
98,
85+
8
86+
],
87+
"style": {
88+
"width": 159,
89+
"backgroundColor": "#000000",
90+
"text": {
91+
"color": "#FFFFFF"
92+
}
93+
}
94+
}
95+
},
96+
"41": {
97+
"title": "The FlatMap",
98+
"id": "7.e4a833605fb111eab7c4b5664a1da10d",
99+
"attr": {
100+
"position": [
101+
262,
102+
177,
103+
9
104+
],
105+
"style": {
106+
"width": 159,
107+
"backgroundColor": "#000000",
108+
"text": {
109+
"color": "#FFFFFF"
110+
}
111+
}
112+
}
113+
}
114+
}
115+
}
116+
},
117+
"attr": {
118+
"theme": "default"
119+
},
120+
"title": "Concurrency and Parallelization"
121+
}

classpath

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10+
<attributes>
11+
<attribute name="test" value="true"/>
12+
<attribute name="optional" value="true"/>
13+
<attribute name="maven.pomderived" value="true"/>
14+
</attributes>
15+
</classpathentry>
16+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
17+
<attributes>
18+
<attribute name="module" value="true"/>
19+
<attribute name="maven.pomderived" value="true"/>
20+
</attributes>
21+
</classpathentry>
22+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
23+
<attributes>
24+
<attribute name="maven.pomderived" value="true"/>
25+
</attributes>
26+
</classpathentry>
27+
<classpathentry kind="output" path="target/classes"/>
28+
</classpath>

con intro.key

681 KB
Binary file not shown.

con intro.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Welcome back.
2+
3+
In this section we'll see how we can add concurrency in our synchronized observable chains..
4+
5+
so Lets quickly set up the agenda for this section.
6+
7+
We'll start with adding concurrency, then Schedulers, where we gonna talk about different schedulers provided by rxJava..
8+
after that we will understand subscribeOn and observerOn in bit detail.
9+
10+
and then the flat map, which we have also covered in combining observables section, here we will see how it can be useful for running the emissions parallelly.
11+
12+
so lets gets started, see you in the next.

pom.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>Reactive-Programming</groupId>
6+
<artifactId>Reactive-Programmingg</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>Reactive-Programming</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>3.8.1</version>
22+
<scope>test</scope>
23+
</dependency>
24+
25+
<dependency>
26+
<groupId>io.reactivex.rxjava3</groupId>
27+
<artifactId>rxjava</artifactId>
28+
<version>3.0.0-RC9</version>
29+
</dependency>
30+
31+
</dependencies>
32+
</project>

project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Reactive-Programmingg</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/test/java=UTF-8
4+
encoding/<project>=UTF-8
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=9
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
12+
org.eclipse.jdt.core.compiler.release=enabled
13+
org.eclipse.jdt.core.compiler.source=9
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package com.basicsstrong.reactive.section1;
2+
3+
import java.util.ArrayList;
4+
5+
6+
public class Book implements SubjectLibrary {
7+
8+
private String name;
9+
private String type;
10+
private String author;
11+
private double price;
12+
private String inStock;
13+
private ArrayList<Observer> obsList = new ArrayList<Observer>();
14+
15+
public Book(String name, String type, String author, double price, String inStock) {
16+
this.name = name;
17+
this.type = type;
18+
this.author = author;
19+
this.price = price;
20+
this.inStock = inStock;
21+
}
22+
23+
public String getName() {
24+
return name;
25+
}
26+
27+
public void setName(String name) {
28+
this.name = name;
29+
}
30+
31+
public String getType() {
32+
return type;
33+
}
34+
35+
public void setType(String type) {
36+
this.type = type;
37+
}
38+
39+
public String getAuthor() {
40+
return author;
41+
}
42+
43+
public void setAuthor(String author) {
44+
this.author = author;
45+
}
46+
47+
public double getPrice() {
48+
return price;
49+
}
50+
51+
public void setPrice(double price) {
52+
this.price = price;
53+
}
54+
55+
public String getInStock() {
56+
return inStock;
57+
}
58+
59+
public void setInStock(String inStock) {
60+
this.inStock = inStock;
61+
System.out.println("Availability changed from Sold out to Back in stock \n");
62+
notifyObserver();
63+
}
64+
65+
public ArrayList<Observer> getObsList() {
66+
return obsList;
67+
}
68+
69+
public void setObsList(ArrayList<Observer> obsList) {
70+
this.obsList = obsList;
71+
}
72+
73+
@Override
74+
public void subscribeObserver(Observer ob) {
75+
76+
obsList.add(ob);
77+
}
78+
79+
@Override
80+
public void unsubscribeObserver(Observer ob) {
81+
obsList.remove(ob);
82+
83+
}
84+
85+
@Override
86+
public void notifyObserver() {
87+
System.out.println(
88+
"Book name : " +this.name +
89+
",Book Type : "+ this.type +
90+
",Price : " + this.price+
91+
",Author : "+ this.author+
92+
", is now "+this.inStock+". So, please notify all users.\n"
93+
);
94+
95+
for(Observer o : obsList)
96+
{
97+
o.update(this.inStock);
98+
}
99+
100+
}
101+
102+
}

0 commit comments

Comments
 (0)