streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smashew <>
Subject [GitHub] incubator-streams pull request: Streams 86
Date Mon, 19 May 2014 19:45:02 GMT
Github user smashew commented on a diff in the pull request:
    --- Diff: streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/
    @@ -246,9 +281,15 @@ public void prepare(Object o) {
             includeEntitiesEnabled = Optional.fromNullable(new Boolean(Boolean.parseBoolean(config.getIncludeEntities()))).or(true);
             client = getTwitterClient();
    +        try {
    +            lock.writeLock().lock();
    +            providerQueue = constructQueue();
    +        } finally {
    +            lock.writeLock().unlock();
    --- End diff --
    Synchronizing on the class would be cumbersome. Presumes that only 1 stream that uses
this class would ever be in use. So, it'd affect threads outside of the one stream being run.
Given the circumstances, the local variable lock is appropriate, but should probably be final
to ensure it isn't accidentally re-created after this classes instance is created.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message