cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Lifecycle Functions in seabolt

@technige could you explain just for my understanding at which point is the corresponding functionality in java driver to the 2 lifecycle functions Bolt_startup and Bolt_shutdown called? I assume those functions are meant to be called once per process. Does Java driver control this via a singleton which is instantiated on first driver usage? How about shutdown?

3 REPLIES 3

Hi @klobuczek,

We've using these lifecycle methods in gobolt (which wraps seabolt into a go connector), relevant source code is available lifecycle.go which are being called by the connector connector_seabolt.go#L92 and connector_seabolt.go#L61.

So, yes these are designed to be called once per process. Atomic counters would be a good way of tracking active driver instances and calling Bolt_startup when it's incremented to 1 and Bolt_shutdown when it's decremented to 0 would be appropriate as demonstrated in the above referenced code.

So in case you have multiple driver instances in a process those lifecycle methods should still be called only once?

Yes, that's right. It's the place where we do process wide initialization like openssl, winsocks, etc.