-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
57 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 30 additions & 23 deletions
53
...at/ac/tuwien/infosys/aic13/cloudscale/service/impl/SentimentAnalysisServiceDummyImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
package at.ac.tuwien.infosys.aic13.cloudscale.service.impl; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import at.ac.tuwien.infosys.aic13.cloudscale.service.SentimentAnalysisService; | ||
import at.ac.tuwien.infosys.aic13.cloudscale.workers.DummyWorker; | ||
import at.ac.tuwien.infosys.aic13.publicdto.PublicSentimentQuery; | ||
import at.ac.tuwien.infosys.aic13.publicdto.PublicSentimentQueryResult; | ||
|
||
public class SentimentAnalysisServiceDummyImpl extends SentimentAnalysisService { | ||
@Override | ||
public void runSentimentAnalysis(){ | ||
SentimentAnalysisRunner runner = new SentimentAnalysisRunner(); | ||
Thread t = new Thread(runner); | ||
t.start(); | ||
} | ||
|
||
private class SentimentAnalysisRunner implements Runnable{ | ||
|
||
@Override | ||
public void run() { | ||
PublicSentimentQuery publicQuery = getNextQuery(); | ||
if(publicQuery == null) return; | ||
|
||
// Creating and starting a worker... this runs through AOP eaving n cloudscale. | ||
DummyWorker worker = new DummyWorker(); | ||
PublicSentimentQueryResult publicResult = worker.doTheAnalysisStuff(publicQuery); | ||
publicResult.setQueryId(publicQuery.getQueryId()); | ||
writeResult(publicResult); | ||
|
||
} | ||
|
||
} | ||
|
||
private static final Logger log = LoggerFactory.getLogger(SentimentAnalysisServiceDummyImpl.class); | ||
|
||
@Override | ||
public void runSentimentAnalysis(){ | ||
SentimentAnalysisRunner runner = new SentimentAnalysisRunner(); | ||
Thread t = new Thread(runner); | ||
t.setDaemon(true); | ||
t.start(); | ||
} | ||
|
||
private class SentimentAnalysisRunner implements Runnable{ | ||
|
||
@Override | ||
public void run() { | ||
PublicSentimentQuery publicQuery = getNextQuery(); | ||
if(publicQuery == null) return; | ||
|
||
// Creating and starting a worker... this runs through AOP eaving n cloudscale. | ||
DummyWorker worker = new DummyWorker(); | ||
PublicSentimentQueryResult publicResult = worker.doTheAnalysisStuff(publicQuery); | ||
publicResult.setQueryId(publicQuery.getQueryId()); | ||
writeResult(publicResult); | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters