MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / Close

Method Close

client/tablesessionpool.go:174–189  ·  view source on GitHub ↗

Close closes the PooledTableSession, releasing it back to the pool. Returns: - err: An error if there is an issue with session closure or cleanup.

()

Source from the content-addressed store, hash-verified

172// Returns:
173// - err: An error if there is an issue with session closure or cleanup.
174func (s *PooledTableSession) Close() error {
175 if atomic.CompareAndSwapInt32(&s.closed, 0, 1) {
176 if s.session.config.Database != s.sessionPool.config.Database && s.sessionPool.config.Database != "" {
177 err := s.session.ExecuteNonQueryStatement("use " + s.sessionPool.config.Database)
178 if err != nil {
179 log.Println("Failed to change back database by executing: use ", s.sessionPool.config.Database)
180 s.sessionPool.dropSession(s.session)
181 s.session = Session{}
182 return nil
183 }
184 }
185 s.sessionPool.PutBack(s.session)
186 s.session = Session{}
187 }
188 return nil
189}

Callers

nothing calls this directly

Calls 3

dropSessionMethod · 0.80
PutBackMethod · 0.80

Tested by

no test coverage detected