forked from valkey-io/valkey-glide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create working Gradle project that uses protobuf library for JNI sock…
…et client
- Loading branch information
1 parent
5cac01a
commit f5c74d2
Showing
8 changed files
with
8,471 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
java/benchmarks/src/main/java/javababushka/benchmarks/BenchmarkingApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package javababushka.benchmarks; | ||
|
||
import connection_request.ConnectionRequestOuterClass.ConnectionRequest; | ||
import java.io.IOException; | ||
import java.net.StandardProtocolFamily; | ||
import java.net.UnixDomainSocketAddress; | ||
import java.nio.channels.SocketChannel; | ||
import javababushka.client.RedisClient; | ||
|
||
public class BenchmarkingApp { | ||
|
||
// main application entrypoint | ||
public static void main(String[] args) throws InterruptedException { | ||
RedisClient client = new RedisClient(); | ||
RedisClient.startSocketListenerExternal(client); | ||
System.out.println("After starting socket listener"); | ||
|
||
int timeout = 0; | ||
int maxTimeout = 1000; | ||
while (client.socketPath == null && timeout < maxTimeout) { | ||
timeout++; | ||
Thread.sleep(250); | ||
} | ||
|
||
UnixDomainSocketAddress socketAddress = UnixDomainSocketAddress.of(client.socketPath); | ||
try { | ||
SocketChannel channel = SocketChannel.open(StandardProtocolFamily.UNIX); | ||
channel.connect(socketAddress); | ||
ConnectionRequest request = ConnectionRequest.newBuilder().build(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
Oops, something went wrong.