Comments (12)
I guess, backport to 3.1 is ok, as long as we don't change the behavior. I will try to add a basic implementation that you can enrich if needed.
from oncrpc4j.
The rpcgen is updated as well.
from oncrpc4j.
I will try to publish the jars over the weekend
from oncrpc4j.
The jars should be online.
from oncrpc4j.
Looks like a reasonable request. However, the OncRpcClient
is there just to provide a sensible defaults. If initialization done by the builder, then where is the added value of
OncRpcClient
?
var clnt = new OncRpcSvcBuilder()
.withoutAutoPublish()
.withTCP()
.withClientMode()
.withWorkerThreadIoStrategy()
.withSelectorThreadPoolSize(1)
.withWorkerThreadPoolSize(1)
.withRpcService(new OncRpcProgram(PROGNUM, PROGVER), upper)
.withSSLContext(sslClientContext)
.withServiceName("clnt")
.build();
clnt.start();
RpcTransport t = clnt.connect(svc.getInetSocketAddress(IpProtocolType.TCP));
clntCall = new RpcCall(PROGNUM, PROGVER, new RpcAuthTypeNone(), t);
The problem with OncRpcSvcBuilder
is that it allows to build an invalid service for the client. Maybe a special OncRpcClientBuilder
will be a better option, that will take care that internally used OncRpcSvcBuilder
built correctly, something like:
public class OncRpcClient {
// package only
OncRpcClient(OncRpcSvc svc) {...}
}
public class OncRpcClientBuilder {
svcBuilder = new OncRpcSvcBuilder()
.withClientMode()
.withoutAutoPublish()
public OncRpcClientBuilder withSelectorThreadPoolSize(int n) {
svcBuilder.withSelectorThreadPoolSize(1);
return this;
}
public OncRpcClient build() {
return new OncRpcClient(svcBuilder.build());
}
}
What do you think?
from oncrpc4j.
@kofemann Yes, using a OncRpcClientBuilder does seem better based on the concern you shared. I had attempted to address that in my proposal by setting .withClientMode()
on the builder once it was passed to the new constructor, but I'm new to using any of the dCache
projects so didn't immediately recognize the other things that are probably server-specific such as auto publish and withRpcService
.
If you are willing to make the change that might be better than if I were to do it since you have a good idea of how it needs to be done to make sure users don't end up with an unusable client. If you'd like me to take a stab at it based on your OncRpcClientBuilder idea, let me know and I'll create a PR for mainline following the things you brought up in your post.
Either way though, I'm wondering if you'd be willing to backport it to a version 3.1.2? The project where we're using this is still on Java 8, so we can't go to 3.2 and later quite yet. If that's not possible, I'll probably need to explore taking a fork to 3.1.2 for this.
from oncrpc4j.
Thank you!
As long as it gives a way to set both selectorThreadPoolSize
and workerThreadPoolSize
then I don't think I'll need any other change. The thing that was causing us trouble was when the thread pool size was automatically set based on number of CPU cores.
And just to add, if you decide you'd rather add a constructor that takes those two additional things rather than implement a builder, that would be fine too and is up to you. The idea of using a builder is appealing just in case there is anything else I need to adjust in the future, but I don't currently have a need for anything more than those two additional values.
from oncrpc4j.
could you check that commit kofemann@42fb509 does what you need
from oncrpc4j.
That looks great! I think I would also need a corresponding change to jrpcgen.java in the dumpClient() method beginning at about line 1955.
from oncrpc4j.
Thank you very much. That looks good to me.
from oncrpc4j.
@kofemann Can I help with any next steps toward a release (and the 3.1 backport we talked about)?
from oncrpc4j.
The jars should be online.
Thanks so much for all of your work on that! Using version 3.1.2 now in our project.
from oncrpc4j.
Related Issues (20)
- worker thread not respawn if die due to RuntimeException or Error
- Can we restrict number of open connection at client side itself HOT 3
- add support for RPC over TLS HOT 2
- handle 16 groups limit with AUTH_SYS
- Jrpcgen is not able to detect ifdef in .x file. Is there any issue ?? HOT 3
- Jrpcgen is throwing error while generating server and client stubs HOT 2
- Port number HOT 3
- Regarding jrpcgen HOT 2
- Reagrding connection open time HOT 1
- Version number of rpc server HOT 3
- Multiple version numbers of rpc program on different Linux machines HOT 3
- Owner name unspecified
- License question HOT 10
- Replace dcache custom Uid/GidPrincipals with alternatives from JDK
- Class Bytes: "get" methods do not check array size
- A single SSLFilter filter shared for all connections HOT 1
- OncRpcSvc constructor builds transports with hard-coded same-thread-io-strategy, rather than the one specified. HOT 3
- Charset parameter for getting/setting string values? HOT 1
- Add enum generation support for x file enumerations HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oncrpc4j.