Skip to content

Restoring "getBufferedAmount" in WSClient. - #76

Merged
Davidiusdadi merged 2 commits into
TooTallNate:masterfrom
detro:master
Mar 8, 2012
Merged

Davidiusdadi merged 2 commits into
TooTallNate:masterfrom
detro:master

Conversation

@detro

@detro detro commented Mar 5, 2012

Copy link
Copy Markdown
Contributor

No description provided.

@Davidiusdadi

Copy link
Copy Markdown
Collaborator

The fact that the implementation makes use of a queue at all is an implementation detail that might change over time.

It the future there may be multiple queues for several executors threads or data may be written directly in the send methods if necessary even though thats unlikely to happen.

However you can be sure that the data you send out will be send out via the socket as soon as possible.

I'd like know in which way you depend on this information.

@TooTallNate

Copy link
Copy Markdown
Owner

This looks good to me. Bonus points for filling out the JavaDoc information. Thanks!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

those changes are not necessary...

@Davidiusdadi

Copy link
Copy Markdown
Collaborator

Ok for those who want to do sophisticated bandwidth regulation those changes are indeed helpful.

The access to bufferQueueTotalAmount must be synchronized though.

@detro

detro commented Mar 5, 2012

Copy link
Copy Markdown
Contributor Author

I'll make it synch tomorrow and update this pull request.

Synchronize access to the "bufferedTotalQueueAmount" variable.
@detro

detro commented Mar 7, 2012

Copy link
Copy Markdown
Contributor Author

Done.

@Davidiusdadi

Copy link
Copy Markdown
Collaborator

thanks.
I think you should synchronize on bufferQueueTotalAmount though.
Even if you have to make bufferQueueTotalAmount an Integer.
There is no need to block the entire object during those operations.

@detro

detro commented Mar 8, 2012

Copy link
Copy Markdown
Contributor Author

I see. That actually makes absolute sense.

I'll update it.
Thanks

…ver it's internal semaphore, not the WebSocket instance one.
@detro

detro commented Mar 8, 2012

Copy link
Copy Markdown
Contributor Author

What do you think?
Is this ok?

I'm making full use of auto boxing/unboxing that Java offers.

@Davidiusdadi

Copy link
Copy Markdown
Collaborator

I think we can merge now, even tough i don't really see the need.

@detro

detro commented Mar 8, 2012

Copy link
Copy Markdown
Contributor Author

@Davidiusdadi If there is one thing I learned doing some Open Source development, is that your ideas are just a "starting point" for others to build on. Most of the time, you think to do X and Y with your idea. But other come along and make X+1, Y-1 and all sort of Z.

It's the beauty of open sourcing code: you produce something, other people either build on it or extend it to cover more scenario.

In this case the "bufferedAmount" is a property of the WS official specs: if not now, later on someone will come along explaining why they need it for reason Z+1.

Unless you can see an harm in this, just get along dude...

@Davidiusdadi

Copy link
Copy Markdown
Collaborator

Thanks for the inspiration

@detro

detro commented Mar 8, 2012

Copy link
Copy Markdown
Contributor Author

@Davidiusdadi I love your attitude man. It's like being punched for contributing.

@Davidiusdadi

Copy link
Copy Markdown
Collaborator

@detro I really respect your endurance. Hopefully we can work together on a feature we both endorse in the future.

Davidiusdadi added a commit that referenced this pull request Mar 8, 2012
Adding/Restoring "getBufferedAmount" in WSClient.
@Davidiusdadi
Davidiusdadi merged commit 020b066 into TooTallNate:master Mar 8, 2012
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