expectit in threads

46 views
Skip to first unread message

Dmitrijs Galockins

unread,
Mar 7, 2017, 10:53:58 AM3/7/17
to Yet another Expect for Java
Hello.

I am new in Java and i have a question.
If i create Expectit objects in multiple threads, and send/expect ssh/telnet data, will it be safe? 

Thank You

Alexey Gavrilov

unread,
Mar 8, 2017, 1:54:44 PM3/8/17
to Dmitrijs Galockins, Yet another Expect for Java
Hi,

Generally speaking you should NOT share the Expect instance across multiple threads. This is not thread safe.
You may have an Expect instance associated with one input stream in a separate tread. That would be technically safe as long as underlying input stream is safe. I’m not sure though that’s a good idea.

Please read this note as well:

I might be able to help if you can give me a bit more details.

Thanks,
- Alexey

--
You received this message because you are subscribed to the Google Groups "Yet another Expect for Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-expecti...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

d.gal...@gmail.com

unread,
Mar 10, 2017, 1:56:10 AM3/10/17
to Yet another Expect for Java, dim...@gmail.com, Alexey1....@gmail.com
Thank you for your answer.
I think I understood the basic idea. One instance - one thread.
I need to collect text configurations from 3-4k devices, but telnet is really slow protocol. I want to try multithreading.
Thank you for the help.

Reply all
Reply to author
Forward
0 new messages