use of org.fisco.bcos.web3j.protocol.channel.ChannelEthereumService in project web3sdk by FISCO-BCOS.
the class CallContractTest method main.
public static void main(String[] args) throws Exception {
try {
// init the Service
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
Service service = context.getBean(Service.class);
service.setGroupId(Integer.parseInt(args[0]));
// run the daemon service
service.run();
// init the client keys
credentials = GenCredential.create();
logger.info("-----> start test in CallContractTest!");
ChannelEthereumService channelEthereumService = new ChannelEthereumService();
channelEthereumService.setTimeout(10 * 1000);
channelEthereumService.setChannelService(service);
web3j = Web3j.build(channelEthereumService, Integer.parseInt(args[0]));
if (args.length == 2) {
String address = args[1];
CallContract callContract = new CallContract(credentials, web3j);
System.out.println("************************ Test call & sendTrandation ************************");
testSyncCallContract(callContract, address);
testAsyncCallContract(callContract, address);
System.out.println("************************ Test decode ************************");
testDecode(callContract, address);
System.out.println("Test CallContract successfully.");
} else {
System.out.println("Please input group id and contract address.");
}
} catch (Exception e) {
System.out.println(e.getLocalizedMessage());
System.exit(1);
}
System.exit(0);
}
use of org.fisco.bcos.web3j.protocol.channel.ChannelEthereumService in project web3sdk by FISCO-BCOS.
the class PerformanceDTTest method initialize.
public void initialize(String groupId) throws Exception {
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
Service service = context.getBean(Service.class);
service.setGroupId(Integer.parseInt(groupId));
service.run();
ChannelEthereumService channelEthereumService = new ChannelEthereumService();
channelEthereumService.setChannelService(service);
Web3AsyncThreadPoolSize.web3AsyncCorePoolSize = 3000;
Web3AsyncThreadPoolSize.web3AsyncPoolSize = 2000;
ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(500);
web3 = Web3j.build(channelEthereumService, 15 * 100, scheduledExecutorService, Integer.parseInt(groupId));
credentials = GenCredential.create();
transactionManager = Contract.getTheTransactionManager(web3, credentials);
}
Aggregations