Commit 6d15525e authored by Vít Kabele's avatar Vít Kabele

Removed redundant public modifiers

parent 734ce441
......@@ -13,16 +13,16 @@ import java.util.concurrent.LinkedBlockingQueue;
class ATEManager {
// we need concurrent for waitForAllToProcessEpoch method
protected final ConcurrentMap<Long, AnalysisTaskExecutor> liveExecutors =
private final ConcurrentMap<Long, AnalysisTaskExecutor> liveExecutors =
new ConcurrentHashMap<Long, AnalysisTaskExecutor>();
protected final BlockingQueue<AnalysisTaskExecutor> endingExecutors =
private final BlockingQueue<AnalysisTaskExecutor> endingExecutors =
new LinkedBlockingQueue<AnalysisTaskExecutor>();
/**
* Retrieves executor. Creates new one if it does not exists.
*/
public AnalysisTaskExecutor getExecutor(long id) {
AnalysisTaskExecutor getExecutor(long id) {
AnalysisTaskExecutor ate = liveExecutors.get(id);
......@@ -39,7 +39,7 @@ class ATEManager {
/**
* Retrieves all live executors
*/
public Iterable<AnalysisTaskExecutor> getAllLiveExecutors() {
Iterable<AnalysisTaskExecutor> getAllLiveExecutors() {
return Collections.unmodifiableCollection(liveExecutors.values());
}
......@@ -47,7 +47,7 @@ class ATEManager {
/**
* Moves executor from live queue to the ending queue
*/
public void executorIsEnding(long id) {
void executorIsEnding(long id) {
AnalysisTaskExecutor removedATE = liveExecutors.remove(id);
......@@ -62,7 +62,7 @@ class ATEManager {
/**
* Changes global epoch in all executors
*/
public void globalEpochChange(long newEpoch) {
void globalEpochChange(long newEpoch) {
for(AnalysisTaskExecutor ate : liveExecutors.values()) {
ate.globalEpochChanged(newEpoch);
......@@ -76,7 +76,7 @@ class ATEManager {
/**
* Waits for all executors to process an epoch
*/
public void waitForAllToProcessEpoch(long epochToProcess) {
void waitForAllToProcessEpoch(long epochToProcess) {
try {
......@@ -98,7 +98,7 @@ class ATEManager {
/**
* Waits for all executors to end
*/
public void waitForAllToEnd() {
void waitForAllToEnd() {
try {
......@@ -120,7 +120,7 @@ class ATEManager {
/**
* Announces executor end. Can be called concurrently.
*/
public void executorEndConcurrentCallback(AnalysisTaskExecutor ate) {
void executorEndConcurrentCallback(AnalysisTaskExecutor ate) {
endingExecutors.remove(ate);
}
}
......@@ -11,11 +11,11 @@ public class AnalysisDispatcher {
// epoch and adds task for object free thread. The thread has to wait until
// all threads processed all tasks from this epoch and then can start
// with
protected long globalEpoch = 0;
private long globalEpoch = 0;
protected final ATEManager ateManager = new ATEManager();
private final ATEManager ateManager = new ATEManager();
protected final ObjectFreeTaskExecutor oftExec;
private final ObjectFreeTaskExecutor oftExec;
AnalysisDispatcher(final SHVMContext shvmContext) {
super();
......@@ -58,7 +58,7 @@ public class AnalysisDispatcher {
}
// called by analysis handler when thread ended on the application vm
public void threadEndedEvent(long threadId) {
void threadEndedEvent(long threadId) {
// create end of processing analysis task
AnalysisTask at = new AnalysisTask();
......
......@@ -9,24 +9,42 @@ import ch.usi.dag.dislreserver.AnalysisInvocation;
*/
class AnalysisTask {
protected boolean signalsEnd = false;
/**
* Used as mark at the end of queue.
*/
private boolean signalsEnd = false;
/**
* List of invocations in this task
*/
protected List<AnalysisInvocation> invocations;
protected long epoch;
/**
* The epoch determined by objectFree events
*/
long epoch;
/**
* Constructed task signals end of the processing
*/
public AnalysisTask() {
AnalysisTask() {
signalsEnd = true;
}
public AnalysisTask(List<AnalysisInvocation> invocations, long epoch) {
/**
* Construct non empty task.
*
* @param invocations List of analysis invocations
* @param epoch
*/
AnalysisTask(List<AnalysisInvocation> invocations, long epoch) {
super();
this.invocations = invocations;
this.epoch = epoch;
}
public boolean isSignalingEnd() {
boolean isSignalingEnd() {
return signalsEnd;
}
......
......@@ -21,11 +21,11 @@ class AnalysisTaskExecutor {
// work from lower epochs) or sets executorEpoch to processed event epoch
// NOTE: no epoch should have this value
private static final long THREAD_SHUTDOWN = -1;
private static final long THREAD_SHUTDOWN = -1;
final protected ATEManager ateManager;
private final ATEManager ateManager;
protected final AnalysisThread executingThread;
private final AnalysisThread executingThread;
// !! RULES !!
// Lock on "this" is protecting globalEpoch, executorEpoch, and taskQueue.
......@@ -38,19 +38,19 @@ class AnalysisTaskExecutor {
// globalEpoch and taskQueue changes, but it would require more
// sophisticated locking also.
protected long globalEpoch = 0;
private long globalEpoch = 0;
protected long executorEpoch = 0;
protected final Queue<AnalysisTask> taskQueue;
private long executorEpoch = 0;
private final Queue<AnalysisTask> taskQueue;
public AnalysisTaskExecutor(ATEManager ateManager) {
AnalysisTaskExecutor(ATEManager ateManager) {
super();
this.ateManager = ateManager;
this.taskQueue = new LinkedList<AnalysisTask>();
this.executingThread = new AnalysisThread(this);
}
public synchronized void addTask(AnalysisTask at) {
synchronized void addTask(AnalysisTask at) {
taskQueue.add(at);
// changed taskQueue -> according to the rules notifyAll
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment