Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我完成了什么:
只有在上传完成后才会下载。我有代码将其作为单独的 java 类来执行。我需要做的是。
每小时上传应该在第一个半小时内完成,只有上传完成,在接下来的 1/2 小时内下载应该完成。下载后再次上传应该完成。
看起来像一个典型的生产者/消费者同步问题:
您可以使用标志,也可以使用可观察/观察者模式来同步它。
You could set a Thread.wait() on each Thread. After you have finished a Thread call notify() to release and start working
Thread.wait()
notify()
If you are working with files take a look at this answer, you may be be able to use JNotify to listen to file system events, such as: