Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions acyclic-visitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The bad:
* Parallel hierarchy of visitors has to be created for all members in visitable class hierarchy.

## Related patterns
* [Visitor Pattern](../visitor/README.md)
* [Visitor Pattern](../visitor/)

## Credits
* [Acyclic Visitor](http://condor.depaul.edu/dmumaugh/OOT/Design-Principles/acv.pdf)
* [Acyclic Visitor](http://condor.depaul.edu/dmumaugh/OOT/Design-Principles/acv.pdf)
11 changes: 0 additions & 11 deletions aggregator-microservices/aggregator-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,8 @@
<version>1.22.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>aggregator-service</artifactId>
<packaging>jar</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
Expand Down Expand Up @@ -74,7 +64,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/
package com.iluwatar.aggregator.microservices;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
Expand Down Expand Up @@ -49,8 +50,10 @@ public String getProductTitle() {
try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) {
response = EntityUtils.toString(httpResponse.getEntity());
}
} catch (IOException e) {
LOGGER.error("Exception caught.", e);
} catch (ClientProtocolException cpe) {
LOGGER.error("ClientProtocolException Occured", cpe);
} catch (IOException ioe) {
LOGGER.error("IOException Occurred", ioe);
}
return response;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/
package com.iluwatar.aggregator.microservices;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
Expand Down Expand Up @@ -49,8 +50,10 @@ public int getProductInventories() {
try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) {
response = EntityUtils.toString(httpResponse.getEntity());
}
} catch (IOException e) {
LOGGER.error("Exception caught.", e);
} catch (ClientProtocolException cpe) {
LOGGER.error("ClientProtocolException Occured", cpe);
} catch (IOException ioe) {
LOGGER.error("IOException Occurred", ioe);
}
return Integer.parseInt(response);
}
Expand Down
9 changes: 0 additions & 9 deletions aggregator-microservices/information-microservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@
<artifactId>information-microservice</artifactId>
<packaging>jar</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
Expand All @@ -65,7 +57,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
Expand Down
12 changes: 1 addition & 11 deletions aggregator-microservices/inventory-microservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,9 @@
<version>1.22.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>inventory-microservice</artifactId>
<packaging>jar</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
Expand All @@ -65,7 +56,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
Expand Down
10 changes: 0 additions & 10 deletions api-gateway/api-gateway-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>api-gateway-service</artifactId>
<packaging>jar</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
Expand Down Expand Up @@ -73,7 +64,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
Expand Down
11 changes: 0 additions & 11 deletions api-gateway/image-microservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,9 @@
<groupId>com.iluwatar</groupId>
<version>1.22.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>image-microservice</artifactId>
<packaging>jar</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
Expand All @@ -65,7 +55,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
Expand Down
9 changes: 0 additions & 9 deletions api-gateway/price-microservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@
<artifactId>price-microservice</artifactId>
<packaging>jar</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
Expand All @@ -65,7 +57,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
Expand Down
5 changes: 5 additions & 0 deletions async-method-invocation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public enum Instruction {

LITERAL(1),
SET_HEALTH(2),
SET_WISDOM (3),
SET_WISDOM(3),
SET_AGILITY(4),
PLAY_SOUND(5),
SPAWN_PARTICLES(6),
GET_HEALTH(7),
GET_AGILITY(8),
GET_WISDOM(9),
ADD(10),
DIVIDE (11);
DIVIDE(11);

private int value;

Expand Down
1 change: 0 additions & 1 deletion caching/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum CachingPolicy {

private String policy;

private CachingPolicy(String policy) {
CachingPolicy(String policy) {
this.policy = policy;
}

Expand Down
17 changes: 8 additions & 9 deletions commander/src/main/java/com/iluwatar/commander/Commander.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ private void updateQueue(QueueTask qt) throws InterruptedException {
//since payment time is lesser than queuetime it would have already failed..additional check not needed
LOG.trace("Order " + qt.order.id + ": Queue time for order over, failed..");
return;
} else if ((qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying))
|| (qt.taskType.equals(TaskType.Messaging) && ((qt.messageType == 1
&& !qt.order.messageSent.equals(MessageSent.NoneSent))
} else if (qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying)
|| qt.taskType.equals(TaskType.Messaging) && (qt.messageType == 1
&& !qt.order.messageSent.equals(MessageSent.NoneSent)
|| qt.order.messageSent.equals(MessageSent.PaymentFail)
|| qt.order.messageSent.equals(MessageSent.PaymentSuccessful)))
|| (qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle)) {
|| qt.order.messageSent.equals(MessageSent.PaymentSuccessful))
|| qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle) {
LOG.trace("Order " + qt.order.id + ": Not queueing task since task already done..");
return;
}
Expand Down Expand Up @@ -576,8 +576,8 @@ private void doTasksInQueue() throws Exception {
|| qt.order.messageSent.equals(MessageSent.PaymentSuccessful)) {
tryDequeue();
LOG.trace("Order " + qt.order.id + ": This messaging task already done, dequeue..");
} else if ((qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent)
|| !qt.order.paid.equals(PaymentStatus.Trying)))) {
} else if (qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent)
|| !qt.order.paid.equals(PaymentStatus.Trying))) {
tryDequeue();
LOG.trace("Order " + qt.order.id + ": This messaging task does not need to be done, dequeue..");
} else if (qt.messageType == 0) {
Expand Down Expand Up @@ -606,8 +606,7 @@ private void doTasksInQueue() throws Exception {
} else {
Thread.sleep(queueTaskTime / 3);
tryDoingTasksInQueue();
}
return;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ T dequeue() throws IsEmptyException {
Node temp = front;
front = front.next;
size = size - 1;
return ((T) temp.value);
return (T) temp.value;
}
}

T peek() throws IsEmptyException {
if (isEmpty()) {
throw new IsEmptyException();
} else {
return ((T)front.value);
return (T)front.value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(3);
for (int i = 0; i < 3; i++) {
executorService.execute(() -> {
while (inventory.addItem(new Item())) {};
while (inventory.addItem(new Item())) {
LOGGER.info("Adding another item");
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public final void removeListener(final ThreadCompleteListener listener) {
this.eventListener = null;
}

private final void completed() {
private void completed() {
if (eventListener != null) {
eventListener.completedEventHandler(eventId);
}
Expand Down
1 change: 1 addition & 0 deletions exclude-pmd.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
com.iluwatar.servicelayer.common.BaseEntity=UnusedPrivateField
com.iluwatar.doublechecked.locking.App=EmptyStatementNotInLoop,EmptyWhileStmt
com.iluwatar.doublechecked.locking.InventoryTest=EmptyStatementNotInLoop,EmptyWhileStmt
domainapp.dom.modules.simple.QSimpleObject=UnusedFormalParameter
2 changes: 1 addition & 1 deletion flux/src/main/java/com/iluwatar/flux/action/Content.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public enum Content {

private String title;

private Content(String title) {
Content(String title) {
this.title = title;
}

Expand Down
5 changes: 5 additions & 0 deletions half-sync-half-async/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void main(String[] args) {
Injector injector = Guice.createInjector(new LotteryModule());
LotteryService service = injector.getInstance( LotteryService.class);
WireTransfers bank = injector.getInstance(WireTransfers.class);
try (final Scanner scanner = new Scanner(System.in)) {
try (Scanner scanner = new Scanner(System.in)) {
boolean exit = false;
while (!exit) {
printMainMenu();
Expand Down
Loading