-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
periodic storage driver service stdout reporting
- Loading branch information
Andrey Kurilov
committed
Jan 10, 2017
1 parent
0429b03
commit 5e2c665
Showing
20 changed files
with
266 additions
and
162 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
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
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
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
47 changes: 47 additions & 0 deletions
47
model/src/main/java/com/emc/mongoose/model/ServiceTaskDispatcher.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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.emc.mongoose.model; | ||
|
||
import com.emc.mongoose.common.concurrent.Daemon; | ||
|
||
import java.rmi.RemoteException; | ||
import java.util.Map; | ||
|
||
/** | ||
Created by kurila on 30.11.16. | ||
*/ | ||
public final class ServiceTaskDispatcher | ||
implements Runnable { | ||
|
||
private final Map<? extends Daemon, Runnable> dispatchTasks; | ||
|
||
public ServiceTaskDispatcher(final Map<? extends Daemon, Runnable> dispatchTasks) { | ||
this.dispatchTasks = dispatchTasks; | ||
} | ||
|
||
@Override | ||
public final void run() { | ||
try { | ||
while(true) { | ||
Runnable nextDispatchTask; | ||
for(final Daemon taskOwner : dispatchTasks.keySet()) { | ||
nextDispatchTask = dispatchTasks.get(taskOwner); | ||
if(nextDispatchTask != null) { | ||
try { | ||
nextDispatchTask.run(); | ||
} catch(final Exception e) { | ||
if( | ||
taskOwner != null && !taskOwner.isInterrupted() && | ||
!taskOwner.isClosed() | ||
) { | ||
e.printStackTrace(System.err); | ||
} | ||
} | ||
Thread.sleep(1); | ||
} | ||
} | ||
} | ||
} catch(final InterruptedException | RemoteException ignored) { | ||
} finally { | ||
dispatchTasks.clear(); | ||
} | ||
} | ||
} |
Oops, something went wrong.