public void destroyBridge(final String name) throws Exception { Bridge bridge; synchronized (this) { bridge = bridges.remove(name); if (bridge != null) { bridge.stop(); managementService.unregisterBridge(name); } } if (bridge != null) { bridge.flushExecutor(); } }
@Override public BridgeMetrics getBridgeMetrics(String nodeId) { final MessageFlowRecord record = records.get(nodeId); return record != null && record.getBridge() != null ? record.getBridge().getMetrics() : null; }
@Override public void start() throws Exception { clearIO(); try { bridge.start(); } finally { blockOnIO(); } }
bridge.stop(); bridge.flushExecutor(); bridge.start(); bridge.stop(); bridge.flushExecutor(); bridge.start();
public void clear() { for (Bridge bridge : bridges.values()) { try { bridge.stop(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); } } bridges.clear(); for (ClusterConnection clusterConnection : clusterConnections.values()) { try { clusterConnection.stop(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.failedToStopClusterConnection(e); } } clearClusterConnections(); }
@Override public Map<String, String> getNodes() { synchronized (recordsGuard) { Map<String, String> nodes = new HashMap<>(); for (Entry<String, MessageFlowRecord> entry : records.entrySet()) { RemotingConnection fwdConnection = entry.getValue().getBridge().getForwardingConnection(); if (fwdConnection != null) { nodes.put(entry.getKey(), fwdConnection.getRemoteAddress()); } } return nodes; } }
private void pauseClusteringBridges(ActiveMQServer server) throws Exception { for (ClusterConnection clusterConnection : server.getClusterManager().getClusterConnections()) { for (MessageFlowRecord record : ((ClusterConnectionImpl) clusterConnection).getRecords().values()) { record.getBridge().pause(); } } }
@Override public boolean isNodeActive(String nodeId) { MessageFlowRecord rec = records.get(nodeId); if (rec == null) { return false; } return rec.getBridge().isConnected(); }
@Override public boolean isStarted() { clearIO(); try { return bridge.isStarted(); } finally { blockOnIO(); } }
@Override public synchronized void registerBridge(final Bridge bridge, final BridgeConfiguration configuration) throws Exception { bridge.setNotificationService(this); ObjectName objectName = objectNameBuilder.getBridgeObjectName(configuration.getName()); BridgeControl control = new BridgeControlImpl(bridge, storageManager, configuration); registerInJMX(objectName, control); registerInRegistry(ResourceNames.BRIDGE + configuration.getName(), control); }
bridge.stop(); bridge.flushExecutor(); bridge.start();
logger.debug("Setting up notificationConsumer between " + this.clusterConnection.getConnector() + " and " + flowRecord.getBridge().getForwardingConnection() + " clusterConnection = " + this.clusterConnection.getName() +
record.getBridge().pause();
bridge.stop(); bridge.flushExecutor(); bridge.start();
@Override public long getMessagesAcknowledged() { clearIO(); try { return bridge.getMetrics().getMessagesAcknowledged(); } finally { blockOnIO(); } }
@Override public void stop() throws Exception { clearIO(); try { bridge.stop(); bridge.flushExecutor(); } finally { blockOnIO(); } }
bridge.start();
@Override public long getMessagesPendingAcknowledgement() { clearIO(); try { return bridge.getMetrics().getMessagesPendingAcknowledgement(); } finally { blockOnIO(); } }