Skip to content
Open
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/compiler.xml
.idea/misc.xml
.idea/modules.xml
.idea/spring-mvc-async-progress.iml
.idea/encodings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.codepotion.examples.asyncExample;
package de.codepotion.examples.async;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.codepotion.examples.asyncExample;
package de.codepotion.examples.async;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
Expand All @@ -7,7 +7,7 @@
* Created by Frenos on 18.08.2016.
*/
@Service
public class asyncService {
public class AsyncService {
@Async
public void doWork(Runnable runnable) {
System.out.println("Got runnable " + runnable);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.codepotion.examples.asyncExample;
package de.codepotion.examples.async;

import de.codepotion.examples.asyncExample.jobs.ExampleJob;
import de.codepotion.examples.async.jobs.ExampleJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.messaging.simp.SimpMessagingTemplate;
Expand All @@ -11,6 +11,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.ArrayList;

/**
Expand All @@ -20,18 +21,18 @@
public class WebController {

private static int jobNumber;
private final asyncService myService;
private final AsyncService myService;
@Qualifier("taskExecutor")
@Autowired
private ThreadPoolTaskExecutor myExecutor;

@Autowired
private SimpMessagingTemplate template;

private ArrayList<ExampleJob> myJobList = new ArrayList<>(5);
private List<ExampleJob> myJobList = new ArrayList<>(5);

@Autowired
WebController(asyncService myService) {
WebController(AsyncService myService) {
this.myService = myService;
}

Expand All @@ -52,7 +53,7 @@ public void startWork() {
@RequestMapping(value = "/status")
@ResponseBody
@SubscribeMapping("initial")
ArrayList<ExampleJob> fetchStatus() {
List<ExampleJob> fetchStatus() {
return this.myJobList;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.codepotion.examples.asyncExample.Configuration;
package de.codepotion.examples.async.configuration;

import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.codepotion.examples.asyncExample.jobs;
package de.codepotion.examples.async.jobs;

/**
* Created by Frenos on 18.08.2016.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.codepotion.examples.asyncExample.jobs;
package de.codepotion.examples.async.jobs;

import de.codepotion.examples.asyncExample.Messages.JobprogressMessage;
import de.codepotion.examples.async.messages.JobProgressMessage;
import org.springframework.messaging.simp.SimpMessagingTemplate;

import java.util.Random;
Expand Down Expand Up @@ -51,8 +51,8 @@ public void run() {
sendProgress();
}

public void sendProgress() {
JobprogressMessage temp = new JobprogressMessage(jobName);
private void sendProgress() {
JobProgressMessage temp = new JobProgressMessage(jobName);
temp.setProgress(progress.get());
temp.setState(state);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package de.codepotion.examples.asyncExample.Messages;
package de.codepotion.examples.async.messages;

/**
* Created by Frenos on 23.08.2016.
*/
public class JobprogressMessage {
public class JobProgressMessage {
private String jobName;
private String state;
private int progress;

public JobprogressMessage(String jobName)
public JobProgressMessage(String jobName)
{
this.jobName = jobName;
}
Expand Down
20 changes: 4 additions & 16 deletions src/main/resources/static/css/bootstrap.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.