Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决并发空指针问题 #28

Closed
wants to merge 1 commit into from

Conversation

@ityouknow
Copy link

commented Oct 12, 2017

详细内容见 #27

@stonyz

This comment has been minimized.

Copy link

commented Nov 21, 2017

本身设计上是要求自己保证线程安全的。 还有其它方法都要加synchronized, 如truncate_file, modify_file等等。并且重用也有风险

而且由于不支持断线重连(如server端重启了),TrackerServer里面的socket不是null, 这样StorageClient其实已经不能用了。。外面加try-catch貌似可行? 所以StorageClient重用风险很大。

故基于当前的代码库,唯一的办法,就是每次用的时候new一个。 外加try catch, 出错的话重传。

@ityouknow

This comment has been minimized.

Copy link
Author

commented Dec 17, 2017

@stonyz 正解!

@huyang168

This comment has been minimized.

Copy link

commented Dec 28, 2017

竟然重新NEW了, 为什么还要加Synchronized同步锁,storageServer每次也是新的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.