Skip to content

Commit 4bac3c5

Browse files
author
huzhenyuan
committed
resolve spring bean depdency problem
1 parent bacf920 commit 4bac3c5

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/main/java/org/tron/common/overlay/server/SyncPool.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,13 @@ public class SyncPool {
8080

8181
private PeerClient peerClient;
8282

83-
@Autowired
84-
public SyncPool(PeerClient peerClient) {
85-
this.peerClient = peerClient;
86-
}
87-
8883
public void init(PeerConnectionDelegate peerDel) {
8984
this.peerDel = peerDel;
9085

9186
channelManager = ctx.getBean(ChannelManager.class);
9287

88+
peerClient = ctx.getBean(PeerClient.class);
89+
9390
poolLoopExecutor.scheduleWithFixedDelay(() -> {
9491
try {
9592
fillUp();

src/test/java/org/tron/core/net/node/NodeImplTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void testDisconnectInactive() {
192192
peer3.setSyncBlockRequested(syncBlockRequested3);
193193

194194
// fetch failed
195-
SyncPool pool = new SyncPool(new PeerClient());
195+
SyncPool pool = new SyncPool();
196196
pool.addActivePeers(peer1);
197197
nodeImpl.setPool(pool);
198198
try {
@@ -203,7 +203,7 @@ public void testDisconnectInactive() {
203203
}
204204

205205
// sync failed
206-
pool = new SyncPool(new PeerClient());
206+
pool = new SyncPool();
207207
pool.addActivePeers(peer2);
208208
nodeImpl.setPool(pool);
209209
try {
@@ -214,7 +214,7 @@ public void testDisconnectInactive() {
214214
}
215215

216216
// should not disconnect
217-
pool = new SyncPool(new PeerClient());
217+
pool = new SyncPool();
218218
pool.addActivePeers(peer3);
219219
nodeImpl.setPool(pool);
220220
try {

0 commit comments

Comments
 (0)