MCPcopy Create free account
hub / github.com/crate/crate / close

Method close

server/src/main/java/io/crate/session/Session.java:979–1010  ·  view source on GitHub ↗

Close a portal or prepared statement From PostgreSQL ExtendedQuery protocol spec: The Close message closes an existing prepared statement or portal and releases resources. It is not an error to issue Close against a nonexistent statement or portal name. [..] Note t

(byte type, String name)

Source from the content-addressed store, hash-verified

977 * @param name name of the prepared statement or the portal (depending on type)
978 */
979 public void close(byte type, String name) {
980 if (LOGGER.isDebugEnabled()) {
981 LOGGER.debug("method=close type={} name={}", (char) type, name);
982 }
983
984 switch (type) {
985 case 'P': {
986 Portal portal = portals.remove(name);
987 if (portal != null) {
988 portal.closeActiveConsumer();
989 }
990 return;
991 }
992 case 'S': {
993 PreparedStmt preparedStmt = preparedStatements.remove(name);
994 if (preparedStmt != null) {
995 Iterator<Map.Entry<String, Portal>> it = portals.entrySet().iterator();
996 while (it.hasNext()) {
997 var entry = it.next();
998 var portal = entry.getValue();
999 if (portal.preparedStmt().equals(preparedStmt)) {
1000 portal.closeActiveConsumer();
1001 it.remove();
1002 }
1003 }
1004 }
1005 return;
1006 }
1007 default:
1008 throw new IllegalArgumentException("Invalid type: " + type + ", valid types are: [P, S]");
1009 }
1010 }
1011
1012 @Override
1013 public void close() {

Calls 14

closeActiveConsumerMethod · 0.80
removeMethod · 0.65
iteratorMethod · 0.65
nextMethod · 0.65
getValueMethod · 0.65
equalsMethod · 0.65
valuesMethod · 0.65
closeMethod · 0.65
runMethod · 0.65
entrySetMethod · 0.45
hasNextMethod · 0.45