forked from tronprotocol/java-tron
-
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
1 parent
8436506
commit 9637bc0
Showing
149 changed files
with
9,396 additions
and
9,072 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ language: java | |
jdk: oraclejdk8 | ||
|
||
script: | ||
- ./gradlew check | ||
- ./gradlew test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Sat Jan 06 16:37:04 CST 2018 | ||
#Thu Jan 11 19:13:19 CET 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-all.zip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
package org.tron.application; | ||
|
||
import com.google.inject.Injector; | ||
|
||
import org.tron.peer.Peer; | ||
|
||
public class CliApplication extends Application { | ||
|
||
private Peer peer; | ||
private Peer peer; | ||
|
||
public CliApplication(Injector injector) { | ||
super(injector); | ||
} | ||
public CliApplication(Injector injector) { | ||
super(injector); | ||
} | ||
|
||
public Peer getPeer() { | ||
return peer; | ||
} | ||
public Peer getPeer() { | ||
return peer; | ||
} | ||
|
||
public void setPeer(Peer peer) { | ||
this.peer = peer; | ||
} | ||
public void setPeer(Peer peer) { | ||
this.peer = peer; | ||
} | ||
} |
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,52 +1,52 @@ | ||
package org.tron.application; | ||
|
||
import static org.tron.core.Constant.BLOCK_DB_NAME; | ||
import static org.tron.core.Constant.TRANSACTION_DB_NAME; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Provides; | ||
import com.google.inject.Singleton; | ||
import javax.inject.Named; | ||
|
||
import org.tron.consensus.client.Client; | ||
import org.tron.consensus.server.Server; | ||
import org.tron.core.Constant; | ||
import org.tron.storage.leveldb.LevelDbDataSourceImpl; | ||
|
||
import javax.inject.Named; | ||
|
||
import static org.tron.core.Constant.BLOCK_DB_NAME; | ||
import static org.tron.core.Constant.TRANSACTION_DB_NAME; | ||
|
||
public class Module extends AbstractModule { | ||
|
||
@Override | ||
protected void configure() { | ||
|
||
} | ||
|
||
@Provides | ||
@Singleton | ||
public Client buildClient() { | ||
return new Client(); | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
public Server buildServer() { | ||
return new Server(); | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
@Named("transaction") | ||
public LevelDbDataSourceImpl buildTransactionDb() { | ||
LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Constant.NORMAL,TRANSACTION_DB_NAME); | ||
db.initDB(); | ||
return db; | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
@Named("block") | ||
public LevelDbDataSourceImpl buildBlockDb() { | ||
LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Constant.NORMAL,BLOCK_DB_NAME); | ||
db.initDB(); | ||
return db; | ||
} | ||
@Override | ||
protected void configure() { | ||
|
||
} | ||
|
||
@Provides | ||
@Singleton | ||
public Client buildClient() { | ||
return new Client(); | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
public Server buildServer() { | ||
return new Server(); | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
@Named("transaction") | ||
public LevelDbDataSourceImpl buildTransactionDb() { | ||
LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Constant.NORMAL, TRANSACTION_DB_NAME); | ||
db.initDB(); | ||
return db; | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
@Named("block") | ||
public LevelDbDataSourceImpl buildBlockDb() { | ||
LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Constant.NORMAL, BLOCK_DB_NAME); | ||
db.initDB(); | ||
return db; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
public interface Service { | ||
|
||
void start(); | ||
void stop(); | ||
void start(); | ||
|
||
void stop(); | ||
} |
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,38 +1,36 @@ | ||
package org.tron.application; | ||
|
||
import java.util.ArrayList; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class ServiceContainer implements Service { | ||
|
||
private ArrayList<Service> services; | ||
private static final Logger logger = LoggerFactory.getLogger("Services"); | ||
private ArrayList<Service> services; | ||
|
||
private static final Logger logger = LoggerFactory.getLogger("Services"); | ||
public ServiceContainer() { | ||
this.services = new ArrayList<>(); | ||
} | ||
|
||
public ServiceContainer() { | ||
this.services = new ArrayList<>(); | ||
} | ||
|
||
public void add(Service service) { | ||
this.services.add(service); | ||
} | ||
public void add(Service service) { | ||
this.services.add(service); | ||
} | ||
|
||
@Override | ||
public void start() { | ||
logger.debug("Starting services"); | ||
for (Service service : this.services) { | ||
logger.debug("Starting " + service.getClass().getSimpleName()); | ||
service.start(); | ||
} | ||
@Override | ||
public void start() { | ||
logger.debug("Starting services"); | ||
for (Service service : this.services) { | ||
logger.debug("Starting " + service.getClass().getSimpleName()); | ||
service.start(); | ||
} | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
for (Service service : this.services) { | ||
logger.debug("Stopping " + service.getClass().getSimpleName()); | ||
service.stop(); | ||
} | ||
@Override | ||
public void stop() { | ||
for (Service service : this.services) { | ||
logger.debug("Stopping " + service.getClass().getSimpleName()); | ||
service.stop(); | ||
} | ||
} | ||
} |
Oops, something went wrong.