Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.tencent.trpc.core.exception.TRpcException;
import com.tencent.trpc.core.rpc.RpcClientContext;
import com.tencent.trpc.core.rpc.TRpcProxy;
import com.tencent.trpc.proto.support.DefResponseFutureManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -45,7 +44,6 @@ public void after() {
container.stop();
}
ConfigManager.stopTest();
DefResponseFutureManager.reset();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.TimeUnit;

public class ConfigManager {
Expand All @@ -56,12 +55,6 @@ public class ConfigManager {
* Container startup listener
*/
private final Set<TRPCRunListener> tRPCRunListeners = Sets.newConcurrentHashSet();

/**
* Shutdown listeners for decoupled cleanup, using WeakHashMap to prevent classloader leaks
*/
private final Map<ShutdownListener, Boolean> shutdownListeners = new WeakHashMap<>();

/**
* Business initialization
*/
Expand Down Expand Up @@ -258,41 +251,6 @@ public void addTRPCRunListener(TRPCRunListener trpcRunListener) {
tRPCRunListeners.add(trpcRunListener);
}

/**
* Get all shutdown listeners loaded via SPI.
*
* @return set of shutdown listeners
*/
public void registerShutdownListener(ShutdownListener listener) {
if (listener != null) {
shutdownListeners.put(listener, Boolean.TRUE);
}
}

/**
* Unregister a shutdown listener.
*
* @param listener the shutdown listener to unregister
*/
public void unregisterShutdownListener(ShutdownListener listener) {
if (listener != null) {
shutdownListeners.remove(listener);
}
}

/**
* Notify all registered shutdown listeners.
*/
private void notifyShutdownListeners() {
shutdownListeners.keySet().forEach(listener -> {
try {
listener.onShutdown();
} catch (Exception e) {
logger.error("Error executing shutdown listener: {}", listener.getClass().getName(), e);
}
});
}

@Override
public String toString() {
return "ApplicationConfig {globalConfig=" + globalConfig + ", serverConfig=" + serverConfig
Expand Down Expand Up @@ -427,10 +385,6 @@ protected void stopInternal() throws Exception {
ExtensionLoader.destroyAllPlugin();
// 8) close client cluster
RpcClusterClientManager.close();

// Notify all shutdown listeners before actual shutdown
notifyShutdownListeners();

logger.info(">>>tRPC Server stopped");
}

Expand All @@ -440,4 +394,4 @@ public String toString() {
}
}

}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,4 @@ public static void registerMBean(Object object, ObjectName objectName) {
}
}

/**
* Unregister mbean
*
* @param objectName mbean object name {@link ObjectName}
*/
public static void unregisterMBean(ObjectName objectName) {
try {
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
if (mBeanServer.isRegistered(objectName)) {
mBeanServer.unregisterMBean(objectName);
}
} catch (Exception e) {
logger.warn("unregister mbean exception: ", e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ public void close(long timeoutMills) {
shutdownGraceful(timeoutMills);
}
}

// unregister MBean
if (this.forkJoinPoolMXBean != null) {
MBeanRegistryHelper.unregisterMBean(this.forkJoinPoolMXBean.getObjectName());
}
}

private void shutdownGraceful(long timeoutMills) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ public void close(long timeoutMills) {
shutdownGraceful(timeoutMills);
}
}
// unregister Mbean
if (this.threadPoolMXBean != null) {
MBeanRegistryHelper.unregisterMBean(this.threadPoolMXBean.getObjectName());
}
}

@Override
Expand Down
Loading
Loading