From bc14ec8ce5fc0601605571fb322fa6e69116954d Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Wed, 10 Apr 2024 10:25:41 +0200 Subject: [PATCH] Sync protofiles & remove heartbeat --- .../db/protointerface/ClientManager.java | 24 ------------------- .../polypheny/db/protointerface/PIPlugin.java | 17 ++----------- .../polyprism/connection_responses.proto | 5 ---- 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/ClientManager.java b/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/ClientManager.java index 426cdc56e3..3a317e29f3 100644 --- a/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/ClientManager.java +++ b/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/ClientManager.java @@ -57,12 +57,6 @@ public ClientManager( PIPlugin.ProtoInterface protoInterface ) { this.clients = new ConcurrentHashMap<>(); this.authenticator = protoInterface.getAuthenticator(); this.transactionManager = protoInterface.getTransactionManager(); - if ( protoInterface.isRequiresHeartbeat() ) { - this.heartbeatInterval = protoInterface.getHeartbeatInterval(); - this.cleanupTimer = new Timer(); - cleanupTimer.schedule( createNewCleanupTask(), 0, heartbeatInterval + HEARTBEAT_TOLERANCE ); - } - this.heartbeatInterval = 0; this.monitoringPage = protoInterface.getMonitoringPage(); monitoringPage.setClientManager( this ); } @@ -169,22 +163,4 @@ public PIClient getClient( String clientUUID ) throws PIServiceException { return clients.get( clientUUID ); } - - private TimerTask createNewCleanupTask() { - Runnable runnable = this::unregisterInactiveClients; - return new TimerTask() { - @Override - public void run() { - runnable.run(); - } - }; - } - - - private void unregisterInactiveClients() { - List inactiveClients = clients.values().stream() - .filter( c -> !c.returnAndResetIsActive() ).toList(); - inactiveClients.forEach( this::unregisterConnection ); - } - } diff --git a/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/PIPlugin.java b/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/PIPlugin.java index 3c5ac42dd5..98e150caa7 100644 --- a/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/PIPlugin.java +++ b/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/PIPlugin.java @@ -62,18 +62,12 @@ public static class ProtoInterface extends QueryInterface implements PropertyCha public static final String INTERFACE_NAME = "Proto Interface"; public static final String INTERFACE_DESCRIPTION = "proto-interface query interface supporting the PolySQL dialect."; public static final List AVAILABLE_PLAIN_SETTINGS = ImmutableList.of( - new QueryInterfaceSettingInteger( "port", false, true, false, 20590 ), - new QueryInterfaceSettingBoolean( "requires heartbeat", false, true, false, false ), - new QueryInterfaceSettingLong( "heartbeat interval", false, true, false, 300000L ) + new QueryInterfaceSettingInteger( "port", false, true, false, 20590 ) ); public static final List AVAILABLE_UNIX_SETTINGS = ImmutableList.of( new QueryInterfaceSettingString( "path", false, true, false, "polypheny-prism.sock" ) ); - @Getter - private final boolean requiresHeartbeat; - @Getter - private final long heartbeatInterval; @Getter private final TransactionManager transactionManager; @Getter @@ -91,7 +85,7 @@ enum Transport { } - private Transport transport; + private final Transport transport; private ProtoInterface( TransactionManager transactionManager, Authenticator authenticator, String uniqueName, Transport transport, Map settings ) { @@ -99,13 +93,6 @@ private ProtoInterface( TransactionManager transactionManager, Authenticator aut this.authenticator = authenticator; this.transactionManager = transactionManager; this.transport = transport; - if ( getAvailableSettings().stream().anyMatch( s -> s.name.equals( "requires heartbeat" ) ) ) { - this.requiresHeartbeat = Boolean.getBoolean( settings.get( "requires heartbeat" ) ); - this.heartbeatInterval = Long.parseLong( settings.get( "heartbeat interval" ) ); - } else { - this.requiresHeartbeat = false; - this.heartbeatInterval = 0; - } this.monitoringPage = new MonitoringPage( uniqueName, INTERFACE_NAME ); } diff --git a/plugins/proto-interface/src/main/proto/polyprism/connection_responses.proto b/plugins/proto-interface/src/main/proto/polyprism/connection_responses.proto index 67df0d9a2e..15af555955 100644 --- a/plugins/proto-interface/src/main/proto/polyprism/connection_responses.proto +++ b/plugins/proto-interface/src/main/proto/polyprism/connection_responses.proto @@ -24,11 +24,6 @@ message ConnectionResponse { int32 major_api_version = 2; // The minor version number of the server’s API. Provides finer granularity about the server’s capabilities. int32 minor_api_version = 3; - /* - Specifies the interval in milliseconds at which the client should send heartbeat signals to maintain the connection. - If not provided, the connection does not require a heartbeat to remain valid. - */ - optional int64 heartbeat_interval = 4; } /*