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

Анна Власова, 496: Threads + CQL + CQLex + TwitterStream + ModuleTests #72

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

annnvl
Copy link
Contributor

@annnvl annnvl commented Dec 16, 2015

No description provided.

numberOfThreads = num;
}

private final int myNumber;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сначала пишут все поля, потом все методы, исправьте и в других местах

while (myNumber != currentThread) {
Thread.yield();
}
System.out.println("Thread-" + (myNumber + 1) + "\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

println за вас строчку переводит, не нужно \n добавлять

@asmekal
Copy link
Contributor

asmekal commented Dec 17, 2015

Блокирующую очередь нужно протестировать

synchronized List<T> take(int n, long timeout) {
timeout += System.currentTimeMillis();
while ((data.size() < n) && (timeout - System.currentTimeMillis()) > 0) {
Thread.yield();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это слишком общая функция, поток будет просыпаться чаще чем нужно.
Для синхронизации лучше использовать блоки synchronized и методы
Object.wait(long timeout) / notifyAll(), или может что-то еще, но потоки должны просыпаться по нашему указанию, а не т любого шороха.

@annnvl annnvl changed the title Анна Власова, 496, Threads Анна Власова, 496, Threads + CQL Dec 19, 2015
@annnvl annnvl changed the title Анна Власова, 496, Threads + CQL Анна Власова, 496, Threads + CQL + ex Dec 19, 2015
@annnvl annnvl changed the title Анна Власова, 496, Threads + CQL + ex Анна Власова, 496, Threads + CQL + ex + TwitterStream Dec 19, 2015
@annnvl annnvl changed the title Анна Власова, 496, Threads + CQL + ex + TwitterStream Анна Власова, 496, Threads + CQL + CQLex + TwitterStream Dec 19, 2015
@annnvl annnvl changed the title Анна Власова, 496, Threads + CQL + CQLex + TwitterStream Анна Власова, 496: Threads + CQL + CQLex + TwitterStream Dec 19, 2015
@annnvl annnvl changed the title Анна Власова, 496: Threads + CQL + CQLex + TwitterStream Анна Власова, 496: Threads + CQL + CQLex + TwitterStream + ModuleTests Dec 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants