Hello James.
I have not investigated this, yet, but I am experiencing out of memory errors when serializing a larger array (35000) of beans to json. The beans are not complex and the jvm is configured with plenty of memory. Have you experienced anything like that or know of any memory leaks that you fixed recently (as you made changes to the serializer as discussed below)? I am still on the Jazz version of Juno and wanted to check if this was something you already encountered before I dive into it (or work around it by paging the serialization).

Thanks a lot and best regards,
Peter.



______________________________________________________________


Inactive hide details for James Bognar ---03/09/2017 06:35:29 PM---Update.... I'm close to delivering this.James Bognar ---03/09/2017 06:35:29 PM---Update.... I'm close to delivering this.

From: James Bognar <james.bognar@salesforce.com>
To: dev@juneau.incubator.apache.org
Date: 03/09/2017 06:35 PM
Subject: Re: Adding builder classes for serializers and parsers.





Update....

I'm close to delivering this.

Here's what it will look like to create a new serializer:

JsonSerializer n = new JsonSerializerBuilder(s)
  .quoteChar('\'')
  .useWhitespace(false)
  .build();

Shortcut methods are provided for common builder setters.
This is an equivalent to the above:

JsonSerializer n = new JsonSerializerBuilder(s).sq().ws().build();

To clone, a builder() method has been added to serializers and parsers:

JsonSerializer n = JsonSerializer.DEFAULT.builder().sq().ws().build();


I've introduced RestClientBuilder, SerializerGroupBuilder, and
ParserGroupBuilder classes as well.


On Fri, Mar 3, 2017 at 2:02 PM, James Bognar <james.bognar@salesforce.com>
wrote:

> > Would the builder be able to take a parameter? So to clone the
> serializer s but change the UseWhitespace setting:
>
> Yea...I can include that.
>
> You'll also be able to specify a subclass in the build method...
> JsonSerializer n = new JsonSerializerBuilder().useWhitespace(false).build(
> JsonSerializer.Simple.class);
>
> On Fri, Mar 3, 2017 at 1:20 PM, Craig Russell <craig.russell@oracle.com>
> wrote:
>
>> From left field…
>>
>> > On Mar 3, 2017, at 5:14 AM, James Bognar <jamesbognar@apache.org>
>> wrote:
>> >
>> > Hi all,
>> >
>> > I'm thinking about changing the way serializers and parsers are
>> constructed
>> > by creating builder classes.  I wanted to run it by the team first
>> though.
>> >
>> > Creating a custom serializer would look like this...
>> >
>> > JsonSerializer s = new
>> > JsonSerializerBuilder().useWhitespace(true).trimNulls(true).build();
>>
>> I like this pattern. I’m not a huge fan of setXXX when xxx is a perfectly
>> good understandable concept
>>
>> > ...instead of...
>> > JsonSerializer s = new
>> > JsonSerializer().setUseWhitespace(true).setTrimNulls(true).lock();
>> >
>> > With this approach I can make the fields final and eliminate the
>> read-write
>> > locks from the classes.
>> >
>> > The DEFAULT serializers and parsers are not going away.  You won't be
>> able
>> > to clone and modify them anymore though.
>> >
>> > Any thoughts?
>>
>> Would the builder be able to take a parameter? So to clone the serializer
>> s but change the UseWhitespace setting:
>>
>> JsonSerializer n = new
>> JsonSerializerBuilder(s).useWhitespace(false).build();
>>
>> Craig
>>
>> Craig L Russell
>> clr@apache.org
>>
>>
>>
>
>
> --
> James Bognar
>



--
James Bognar