On Sun, Jan 20, 2019 at 2:24 PM Mike Jumper <mjum...@apache.org> wrote:

> On Fri, Jan 18, 2019 at 12:52 PM Nick Couchman <vn...@apache.org> wrote:
>
>> On Fri, Jan 18, 2019 at 2:37 PM Mike Jumper <mjum...@apache.org> wrote:
>> ...
>> >
>> > A compat layer would be pretty tricky.
>> >
>> > If we can somehow modify the API changes such that things are inherently
>> > compatible, then fairly easy. Maybe something can be done with default
>> > methods now that we're Java 8+?
>> >
>>
>> So, for a change like this (to the Connectable interface):
>>
>> https://github.com/apache/guacamole-client/commit/dfd43327618bd625bac7ce4fd35f9ccfe729ec6e#diff-1d2cb5f9d0009ea051d8a6211b20aaea
>>
>> ....something like this:
>>
>> https://github.com/necouchman/guacamole-client/commit/d53a6c3be576526ace6acf0432cab2480785a0ae
>>
>> ??
>>
>>
> Something similar to that, yes. We would need default implementations for
> both old and new versions of connect():
>
>
> https://github.com/mike-jumper/guacamole-client/commit/4a1527b1d4311bbf9d76468141dc68d02a90efa4
>
> We would still run into trouble with the SimpleConnection class for any
> downstream uses which override the old connect(). Those overrides would
> suddenly cease to have any effect. Further, if such a downstream use also
> uses SimpleAuthenticationProvider, they might expect the provided
> GuacamoleConfiguration to already have tokens applied (the old behavior)
> rather than dynamically applied upon connect() (the new behavior).
>
> Maybe it's not possible without a compatibility layer...
>

I think we can allow the old connect() to be overridden and still work as
intended by leveraging thread-local storage. We could use a thread-local
variable to effectively pass the tokens received by the new connect() such
that they are available internally by SimpleConnection's implementation of
the old connect(). With the new version internally leveraging the old,
users which override either will see the behavior they expect.

The GuacamoleConfiguration returned by getConfiguration() would still no
longer have tokens applied, unlike past releases where tokens were baked in
before each instance of SimpleConnection was created, but perhaps that's a
reasonable enough sacrifice?

- Mike

Reply via email to