public BitmessageContext build() { nonNull("inventory", inventory); nonNull("nodeRegistry", nodeRegistry); nonNull("networkHandler", networkHandler); nonNull("addressRepo", addressRepo); nonNull("messageRepo", messageRepo); if (proofOfWorkEngine == null) { proofOfWorkEngine = new MultiThreadedPOWEngine(); } return new BitmessageContext(this); }
public BitmessageContext build() { nonNull("inventory", inventory); nonNull("nodeRegistry", nodeRegistry); nonNull("networkHandler", networkHandler); nonNull("addressRepo", addressRepo); nonNull("messageRepo", messageRepo); nonNull("proofOfWorkRepo", proofOfWorkRepository); if (proofOfWorkEngine == null) { proofOfWorkEngine = new MultiThreadedPOWEngine(); } if (labeler == null) { labeler = new DefaultLabeler(); } if (customCommandHandler == null) { customCommandHandler = new CustomCommandHandler() { @Override public MessagePayload handle(CustomMessage request) { throw new IllegalStateException( "Received custom request, but no custom command handler configured."); } }; } return new BitmessageContext(this); }