-
Notifications
You must be signed in to change notification settings - Fork 137
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
[io] Refactor of ThreadIO #48
base: master
Are you sure you want to change the base?
Conversation
The ThreadIO service replaces the System streams so that the output and input on a thread associated with a command can be captured. Unfortunately, this occupies the singletons of System.in/out/err. There are many others that want to use the same mechanism. This change introduces a SystemIO service that dispatches the System streams to any number of listeners. The ThreadIO is modified to use this service. By default, the Gogo runtime will register its own SystemIO service. However, it is possible to disable this with the "org.apache.felix.gogo.systemio.timeout" (SystemIO.TIMEOUT) framework property. If this is set to a numeric value, it will indicate that Gogo should look for an external service. The numeric value indicates the amount of time Gogo should wait for this service. 30000 is a common value. Additionally, there is an onClose method added to the session so that it is possible to get a callback when the session closes. Gogo commands can use this to cancel any activity related to a session. The lambda is weakly referenced so it is necessary that the command keeps a strong reference to the callback. Signed-off-by: Peter Kriens <[email protected]>
33f089b
to
f55963e
Compare
I just tested the branch and it works like a charm 👍. I strongly believe that this is a great enhancement to Gogo runtime. |
To help me understand, maybe to improve the documentation, could you
explain a use case?
- Ray
…On Wed, Mar 31, 2021 at 9:43 AM Amit Kumar Mondal ***@***.***> wrote:
I just tested the branch and it works like a charm 👍. I strongly believe
that this is a great enhancement to Gogo runtime.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#48 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABD2TGIFRF7JG7TVQX6BF3TGMRJZANCNFSM4RG7RW3A>
.
--
*Raymond Augé* ***@***.***)
Senior Software Architect *Liferay, Inc.* (@liferay)
OSGi Fellow
|
@rotty3000 What I noticed earlier that if I start a local Felix runtime in Eclipse with Gogo and simultaneously connect the runtime using Telnet, all commands executed in the Telnet console get captured by |
👍
…On Wed, Mar 31, 2021 at 10:53 AM Amit Kumar Mondal ***@***.***> wrote:
@rotty3000 <https://github.com/rotty3000> What I noticed earlier that if
I start a local Felix runtime in Eclipse with Gogo and simultaneously
connect the runtime using Telnet, all commands executed in the Telnet
console get captured by ThreadIO, and the execution result gets
dispatched to all available streams. The result gets displayed not only on
the Telnet console but also on the Eclipse IDE console. In my opinion, the
result should not have been displayed in IDE if the command is executed on
Telnet and vice versa. This is why, after discussing with @pkriens
<https://github.com/pkriens>, it has been decided that it would have
great to disable the use of ThreadIO on demand which @pkriens
<https://github.com/pkriens> accomplished in this PR by introducing the
SystemIO service. In my scenario, I just needed to export a custom
implementation of SystemIO with the framework property
org.apache.felix.gogo.systemio.timeout set to a proper timeout value
(i.e. 20000 milliseconds).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#48 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABD2TGBSXU3RAT4JSJL3H3TGMZNNANCNFSM4RG7RW3A>
.
--
*Raymond Augé* ***@***.***)
Senior Software Architect *Liferay, Inc.* (@liferay)
OSGi Fellow
|
The ThreadIO service replaces the System streams so that the output and input on a thread associated with a command can be captured.
Unfortunately, this occupies the singletons of System.in/out/err. There are many others that want to use the same mechanism.
This change introduces a SystemIO service that dispatches the System streams to any number of listeners. The ThreadIO is modified to use this service.
By default, the Gogo runtime will register its own SystemIO service. However, it is possible to disable this with the "org.apache.felix.gogo.systemio.timeout" (SystemIO.TIMEOUT) framework property. If this is set to a numeric value, it will indicate that Gogo should look for an external service. The numeric value indicates the amount of time Gogo should wait for this service. 30000 is a common value.
Additionally, there is an onClose method added to the session so that it is possible to get a callback when the session closes. Gogo commands can use this to cancel any activity related to a session. The lambda is weakly referenced so it is necessary that the command keeps a strong reference to the callback.
Signed-off-by: Peter Kriens [email protected]