hacksong / jsonrpc4j

Automatically exported from code.google.com/p/jsonrpc4j
0 stars 0 forks source link

JsonRpcServer - many methods are private visibility #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On the JsonRpcServer class 
(https://code.google.com/p/jsonrpc4j/source/browse/trunk/jsonrpc4j/src/main/java
/com/googlecode/jsonrpc4j/JsonRpcServer.java), the handleNNN(), 
createSuccessResponse() and other such methods are all private.

Looking through the class, I don't see why it wouldn't make sense to make these 
protected so the class can be extended.

For example, on a project I'm working on I have a JsonRpcServer being used as 
part of a TCP socket server which is providing access to Java objects from a 
PHP client.  This works like a charm, except for one thing.  A number of the 
calls are for regular Java objects and the default Jackson serialization works 
fine.  However, in one case the particular call in question may be called 
hundreds or even thousands of times per second, and I need to make sure the 
serialization is fast.  In this case the raw data comes out of the database as 
Json already, so I can do the "serialization" process much faster (by just 
copying the json string from the database) than I can build a set of Java 
objects from the data and have Jackson reserialize it.  In order to implement 
this, I need to override invoke(Method, List), but I can't because it's private.

In the mean time I've just copied the JsonRpcServer class and am using my own 
renamed version, but this task would be much simpler if the various 
handleNNN(), createSuccessResponse(), etc. methods were protected instead of 
private.

I would submit a patch or something but the change is very simple and it seems 
this file is actively being worked on, so I don't think that would particularly 
help.

Original issue reported on code.google.com by bradpeab...@gmail.com on 1 Aug 2012 at 9:22

GoogleCodeExporter commented 9 years ago
Give me some time to give this adequate thought and I'll get back to you - 
seems fine to me at first glance though.

Original comment by br...@chee.rs on 3 Aug 2012 at 5:40

GoogleCodeExporter commented 9 years ago
Sounds good, thanks.  -Brad

Original comment by bradpeab...@gmail.com on 3 Aug 2012 at 8:49

GoogleCodeExporter commented 9 years ago
I'll add this to the next release

Original comment by brian.di...@gmail.com on 4 Aug 2012 at 2:42

GoogleCodeExporter commented 9 years ago
Included in the next release

Original comment by brian.di...@gmail.com on 6 Oct 2012 at 12:01