-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix stderr exception on ssh connection
fix update stat queue contention change default start param
- Loading branch information
ortis
committed
Jul 4, 2018
1 parent
7ea83bc
commit f44dd85
Showing
11 changed files
with
222 additions
and
78 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
71 changes: 71 additions & 0 deletions
71
src/main/java/org/ortis/mochimo/farm_manager/farm/StatisticsUpdateTask.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,71 @@ | ||
|
||
package org.ortis.mochimo.farm_manager.farm; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
import org.ortis.mochimo.farm_manager.farm.miner.Miner; | ||
|
||
public class StatisticsUpdateTask implements Callable<Void> | ||
{ | ||
private final Miner miner; | ||
|
||
private Object owner; | ||
private final Object lock = new Object(); | ||
|
||
public StatisticsUpdateTask(final Miner miner) | ||
{ | ||
this.miner = miner; | ||
|
||
} | ||
|
||
public boolean acquire(final Object bidder) | ||
{ | ||
synchronized (this.lock) | ||
{ | ||
|
||
if (this.owner == null) | ||
{ | ||
this.owner = bidder; | ||
return true; | ||
} else | ||
return false; | ||
|
||
} | ||
} | ||
|
||
@Override | ||
public Void call() throws Exception | ||
{ | ||
this.miner.updateStatistics(); | ||
|
||
return null; | ||
} | ||
|
||
public Miner getMiner() | ||
{ | ||
return miner; | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return this.miner.hashCode(); | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) | ||
{ | ||
if (o == this.miner) | ||
return true; | ||
|
||
if (o instanceof StatisticsUpdateTask) | ||
{ | ||
final StatisticsUpdateTask task = (StatisticsUpdateTask) o; | ||
|
||
return task.getMiner().equals(this.miner); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
} |
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
Oops, something went wrong.