private void Initialize() { var port = PortUtility.GetFreeTcpPort(); // TODO : Need to move Execute logic to J2NET var classPaths = string.Join(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ";" : ":", jarPath, DriverPath); _process = JavaRuntime.Execute($"-XX:G1PeriodicGCInterval=5000 -cp \"{classPaths}\" com.chequer.jdbcnet.bridge.Main -p {port}"); PortUtility.WaitForOpen(port); _channel = new Channel($"{host}:{port}", ChannelCredentials.Insecure); Driver = new DriverService.DriverServiceClient(_channel); Reader = new ReaderService.ReaderServiceClient(_channel); Statement = new StatementService.StatementServiceClient(_channel); Database = new DatabaseService.DatabaseServiceClient(_channel); var loadDriverResponse = Driver.loadDriver(new LoadDriverRequest { ClassName = DriverClass }); DriverMajorVersion = loadDriverResponse.MajorVersion; DriverMinorVersion = loadDriverResponse.MinorVersion; }
private DriverServiceClient( IConfigurationSerializer configurationSerializer, [Parameter(Value = typeof(DriverServicePort))] int driverServicePort) { _configurationSerializer = configurationSerializer; Logger.Log(Level.Info, "Binding to driver service at port {0}", driverServicePort); var driverServiceChannel = new Channel("127.0.0.1", driverServicePort, ChannelCredentials.Insecure); _driverServiceStub = new DriverService.DriverServiceClient(driverServiceChannel); Logger.Log(Level.Info, "Channel state {0}", driverServiceChannel.State); }