$ show vesoft-inc/nebula-java
This repository is the official Java client for Nebula Graph, a distributed graph database. It provides connectivity to Nebula Graph's graph, meta, and storage services through Thrift-based RPC. The client supports connection pooling, session management, SSL/TLS encryption, and HTTP/2 transport. Key features include load balancing across database nodes, automatic reconnection, and type-safe wrappers for Nebula's data types (values, vertices, edges, paths, geospatial). The architecture separates concerns into graph client (query execution), meta client (schema/cluster management), and storage client (direct data access). Examples demonstrate usage patterns for session pooling, SSL configuration, and storage scanning.
The LLM identified 5 files worth highlighting for reuse:
Implements round-robin load balancing with periodic health checks for Nebula Graph nodes. Uses ScheduledExecutorService for server monitoring and tracks failed connections. Isolated networking concern reusable in any Thrift-based client requiring server selection and failure detection.
Manages thread-safe allocation and return of Nebula Graph sessions. Uses CopyOnWriteArrayList and BitSet for efficient session tracking with automatic eviction of invalid sessions. Demonstrates advanced concurrent pooling techniques without external dependencies, safely extractable for session management in other RPC clients.
Provides schema-driven encoding/decoding for Nebula Graph's binary protocol data types. Handles complex types (geospatial, duration, containers) via reflection and Thrift-generated schemas. Isolated data conversion layer reusable for any project needing to serialize/deserialize Nebula types with schema evolution support.
Utility for parsing and validating host:port strings with IPv6 support. Includes methods for address formatting, port extraction, and host validation. Simple, dependency-free networking helper safely reusable in any Java network application requiring address manipulation.
Abstracts Nebula Value type with type-safe accessors for all supported data types (temporal, spatial, numeric, string, null). Provides conversion methods and wrapper implementations for specific types. Demonstrates skill in handling variant types through clean Java interface, reusable for any client needing to process Nebula query results.