-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update p2p connection and message packages
remove inventor and monitor packages Co-authored-by: Alva Swanson <[email protected]> Co-authored-by: Alejandro García <[email protected]> Co-authored-by: jmacxx <[email protected]> Co-authored-by: HenrikJannsen <[email protected]>
- Loading branch information
1 parent
0f41c8d
commit e0db452
Showing
79 changed files
with
1,323 additions
and
5,318 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
27 changes: 27 additions & 0 deletions
27
common/src/main/java/haveno/common/proto/network/GetDataResponsePriority.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,27 @@ | ||
/* | ||
* This file is part of Haveno. | ||
* | ||
* Haveno is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* Haveno is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package haveno.common.proto.network; | ||
|
||
/** | ||
* Represents priority used at truncating data set at getDataResponse if total data exceeds limits. | ||
*/ | ||
public enum GetDataResponsePriority { | ||
LOW, | ||
MID, | ||
HIGH | ||
} |
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
62 changes: 62 additions & 0 deletions
62
common/src/main/java/haveno/common/util/SingleThreadExecutorUtils.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,62 @@ | ||
/* | ||
* This file is part of Haveno. | ||
* | ||
* Haveno is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* Haveno is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package haveno.common.util; | ||
|
||
import com.google.common.util.concurrent.ListeningExecutorService; | ||
import com.google.common.util.concurrent.MoreExecutors; | ||
import com.google.common.util.concurrent.ThreadFactoryBuilder; | ||
|
||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.ThreadFactory; | ||
|
||
public class SingleThreadExecutorUtils { | ||
public static ExecutorService getSingleThreadExecutor(Class<?> aClass) { | ||
String name = aClass.getSimpleName(); | ||
return getSingleThreadExecutor(name); | ||
} | ||
|
||
public static ExecutorService getNonDaemonSingleThreadExecutor(Class<?> aClass) { | ||
String name = aClass.getSimpleName(); | ||
return getSingleThreadExecutor(name, false); | ||
} | ||
|
||
public static ExecutorService getSingleThreadExecutor(String name) { | ||
return getSingleThreadExecutor(name, true); | ||
} | ||
|
||
public static ListeningExecutorService getSingleThreadListeningExecutor(String name) { | ||
return MoreExecutors.listeningDecorator(getSingleThreadExecutor(name)); | ||
} | ||
|
||
public static ExecutorService getSingleThreadExecutor(ThreadFactory threadFactory) { | ||
return Executors.newSingleThreadExecutor(threadFactory); | ||
} | ||
|
||
private static ExecutorService getSingleThreadExecutor(String name, boolean isDaemonThread) { | ||
final ThreadFactory threadFactory = getThreadFactory(name, isDaemonThread); | ||
return Executors.newSingleThreadExecutor(threadFactory); | ||
} | ||
|
||
private static ThreadFactory getThreadFactory(String name, boolean isDaemonThread) { | ||
return new ThreadFactoryBuilder() | ||
.setNameFormat(name) | ||
.setDaemon(isDaemonThread) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.