001/* 002 * Copyright 2022-2026 Revetware LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.soklet; 018 019import javax.annotation.concurrent.ThreadSafe; 020 021/** 022 * Thread-safe listener registration returned by an MCP subscription-event or 023 * task-event publisher. 024 * <p> 025 * Closing a registration is idempotent. It unsubscribes only its listener and 026 * does not close the application-owned publisher. A delivery already selected 027 * or in flight when close takes effect may begin or finish after 028 * {@link #close()} returns; no later delivery may be selected for that 029 * registration. Soklet invokes {@code close()} asynchronously and never 030 * overlaps invocations for the same registration. If an invocation throws, 031 * Soklet may retry it until one invocation succeeds; after a successful 032 * invocation, Soklet does not invoke it again. An in-flight invocation may 033 * outlive the server's bounded shutdown wait, in which case cleanup remains 034 * residual state and restart cannot proceed until the invocation completes 035 * successfully. 036 * 037 * @author <a href="https://www.revetkn.com">Mark Allen</a> 038 */ 039@ThreadSafe 040public interface McpSubscriptionEventRegistration extends AutoCloseable { 041 /** Idempotently unregisters the associated listener. */ 042 @Override 043 void close(); 044}