Is sardine put thread safe

77 views
Skip to first unread message

Aaron Boxer

unread,
Jan 9, 2014, 11:45:58 PM1/9/14
to sardi...@googlegroups.com
Hello,

Suppose I share the same Sardine object amongst threads, and I call
put from each thread, is this safe?

Thanks!

Aaron

Jon Stevens

unread,
Jan 10, 2014, 1:15:58 AM1/10/14
to sardi...@googlegroups.com
I wouldn't share instances of the Sardine object across threads. Just make a new instance each time, the overhead isn't that much.

jon



--
You received this message because you are subscribed to the Google Groups "sardine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sardine-dav...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Aaron Boxer

unread,
Jan 10, 2014, 2:20:07 PM1/10/14
to sardi...@googlegroups.com


On Friday, January 10, 2014 1:15:58 AM UTC-5, Jon Stevens wrote:
I wouldn't share instances of the Sardine object across threads. Just make a new instance each time, the overhead isn't that much.

jon

Thanks, Jon.  I did notice that it takes a few seconds to initialize the Sardine object. So, I would rather not do that if I can avoid it.

Jon Stevens

unread,
Jan 10, 2014, 2:32:16 PM1/10/14
to sardi...@googlegroups.com, sardi...@googlegroups.com
A few seconds to instantiate an object is pretty ludicrous. Show me the proof.

Jon

Aaron Boxer

unread,
Jan 10, 2014, 3:51:53 PM1/10/14
to sardi...@googlegroups.com


On Friday, January 10, 2014 2:32:16 PM UTC-5, Jon Stevens wrote:
A few seconds to instantiate an object is pretty ludicrous. Show me the proof.



Actually, I did a little more testing: the very first call to

 sardine = SardineFactory.begin(user, password);

takes about a second.  Subsequent calls are fast.  So, I guess the one time initialization takes some time.




Jon Stevens

unread,
Jan 10, 2014, 9:24:11 PM1/10/14
to sardi...@googlegroups.com
I have a hard time believing that since some of the tests run within .016 seconds on my machine. The code behind .begin() is pretty simple. 

That said, I did just fine a small optimization that you should try out. Try master. =)

jon



Aaron Boxer

unread,
Jan 13, 2014, 11:58:07 AM1/13/14
to sardi...@googlegroups.com


On Friday, January 10, 2014 9:24:11 PM UTC-5, Jon Stevens wrote:
I have a hard time believing that since some of the tests run within .016 seconds on my machine. The code behind .begin() is pretty simple. 

That said, I did just fine a small optimization that you should try out. Try master. =)


Thanks, Jon.  I am on the master branch.  I am using the begin(user,password) call, so perhaps authentication is slowing it down?


 
Reply all
Reply to author
Forward
0 new messages