You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "cdxf (via GitHub)" <gi...@apache.org> on 2024/04/03 12:18:05 UTC
[I] [Java] How to register classes when using Fury Builder? [incubator-fury]
cdxf opened a new issue, #1458:
URL: https://github.com/apache/incubator-fury/issues/1458
I couldn't find any method in the builder to register classes. How can I register classes using the Fury builder?
```
ThreadSafeFury fury = Fury.builder().withLanguage(Language.JAVA)
.requireClassRegistration(true)
.buildThreadSafeFury();
```
Secondly, I'm unsure about when to use ```buildThreadSafeFury``` and when to instantiate ThreadLocalFury directly. The documentation doesn't provide clear guidance on this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] [Java] How to register classes when using Fury Builder? [incubator-fury]
Posted by "LiangliangSui (via GitHub)" <gi...@apache.org>.
LiangliangSui commented on issue #1458:
URL: https://github.com/apache/incubator-fury/issues/1458#issuecomment-2034781233
> I couldn't find any method in the builder to register classes. How can I register classes using the Fury builder?
`FuryBuilder` cannot register classes directly. You need to use `Fury#register(...)` to register. However, we can make `FuryBuilder` support registration. I will submit a PR to do this later.
> Secondly, I'm unsure about when to use buildThreadSafeFury and when to instantiate ThreadLocalFury directly. The documentation doesn't provide clear guidance on this.
The implementation principle of `buildThreadSafeFury` is also to directly instantiate the `ThreadLocalFury` object(see [code](https://github.com/apache/incubator-fury/blob/main/java/fury-core/src/main/java/org/apache/fury/config/FuryBuilder.java#L336-L350)), and pass a lambda expression to the constructor of `ThreadLocalFury` to create a Fury instance.
In the expression passed in when you instantiate `ThreadLocalFury` yourself, you can do some operations on the Fury instance by default. For example, you can register the `FooClass` class for each thread Fury instance, which is something buildThreadSafeFury cannot do.
Directly instantiating `ThreadLocalFury` is more flexible than `buildThreadSafeFury`.
There is currently no essential difference between the two implementations. In the future, we will use [`buildThreadSafeFuryPool`](https://github.com/apache/incubator-fury/blob/main/java/fury-core/src/main/java/org/apache/fury/config/FuryBuilder.java#L359-L361) as the default implementation of `buildThreadSafeFury`. #1335
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [I] [Java] How to register classes when using Fury Builder? [incubator-fury]
Posted by "cdxf (via GitHub)" <gi...@apache.org>.
cdxf closed issue #1458: [Java] How to register classes when using Fury Builder?
URL: https://github.com/apache/incubator-fury/issues/1458
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org