protected void triggerStartAsyncNetworkBridgeCreation() throws IOException { brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() { final String originalName = Thread.currentThread().getName(); Thread.currentThread().setName("triggerStartAsyncNetworkBridgeCreation: " + "remoteBroker=" + remoteBroker + ", localBroker= " + localBroker); try { // First we collect the info data from both the local and remote ends collectBrokerInfos(); // Once we have all required broker info we can attempt to start // the local and then remote sides of the bridge. doStartLocalAndRemoteBridges(); } finally { Thread.currentThread().setName(originalName); } } }); }
@Override public void serviceRemoteException(Throwable error) { if (!disposed.get()) { if (error instanceof SecurityException || error instanceof GeneralSecurityException) { LOG.error("Network connection between {} and {} shutdown due to a remote error: {}", new Object[]{ localBroker, remoteBroker, error }); } else { LOG.warn("Network connection between {} and {} shutdown due to a remote error: {}", new Object[]{ localBroker, remoteBroker, error }); } LOG.debug("The remote Exception was: {}", error, error); brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() { ServiceSupport.dispose(getControllingService()); } }); fireBridgeFailed(error); } }
LOG.debug("The local Exception was: {}", error, error); brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() {
protected Connection createConnection(Transport transport) throws IOException { // prefer to use task runner from broker service as stop task runner, as we can then // tie it to the lifecycle of the broker service return new ManagedTransportConnection(this, transport, getBroker(), isDisableAsyncDispatch() ? null : getTaskRunnerFactory(), getBrokerService().getTaskRunnerFactory(), managementContext, connectorName); }
for (final ActiveMQDestination destination : matchingDestinations) { if (concurrent.getCount() > 0) { brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() {
@Override public void onAccept(final Transport transport) { try { brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() { try { if (!brokerService.isStopping()) { Connection connection = createConnection(transport); connection.start(); } else { throw new BrokerStoppedException("Broker " + brokerService + " is being stopped"); } } catch (Exception e) { String remoteHost = transport.getRemoteAddress(); ServiceSupport.dispose(transport); onAcceptError(e, remoteHost); } } }); } catch (Exception e) { String remoteHost = transport.getRemoteAddress(); ServiceSupport.dispose(transport); onAcceptError(e, remoteHost); } }
final CountDownLatch sendShutdown = new CountDownLatch(1); brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() {
protected Connection createConnection(Transport transport) throws IOException { // prefer to use task runner from broker service as stop task runner, as we can then // tie it to the lifecycle of the broker service TransportConnection answer = new TransportConnection(this, transport, broker, disableAsyncDispatch ? null : taskRunnerFactory, brokerService.getTaskRunnerFactory()); boolean statEnabled = this.getStatistics().isEnabled(); answer.getStatistics().setEnabled(statEnabled); answer.setMessageAuthorizationPolicy(messageAuthorizationPolicy); return answer; }
brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() {
/** * Factory method to create the core region broker onto which interceptors * are added * * @throws Exception */ protected Broker createRegionBroker() throws Exception { if (destinationInterceptors == null) { destinationInterceptors = createDefaultDestinationInterceptor(); } configureServices(destinationInterceptors); DestinationInterceptor destinationInterceptor = new CompositeDestinationInterceptor(destinationInterceptors); if (destinationFactory == null) { destinationFactory = new DestinationFactoryImpl(this, getTaskRunnerFactory(), getPersistenceAdapter()); } return createRegionBroker(destinationInterceptor); }
private void ackAdvisory(Message message) throws IOException { demandConsumerDispatched++; if (demandConsumerDispatched > (demandConsumerInfo.getPrefetchSize() * (configuration.getAdvisoryAckPercentage() / 100f))) { final MessageAck ack = new MessageAck(message, MessageAck.STANDARD_ACK_TYPE, demandConsumerDispatched); ack.setConsumerId(demandConsumerInfo.getConsumerId()); brokerService.getTaskRunnerFactory().execute(new Runnable() { @Override public void run() { try { remoteBroker.oneway(ack); } catch (IOException e) { LOG.warn("Failed to send advisory ack " + ack, e); } } }); demandConsumerDispatched = 0; } }
connector.setBrokerService(broker); connector.setUri(location); connector.setTaskRunnerFactory(broker.getTaskRunnerFactory()); connector.start(); CONNECTORS.put(host, connector);
public TransportConnector startTransportConnector(TransportConnector connector) throws Exception { connector.setBrokerService(this); connector.setTaskRunnerFactory(getTaskRunnerFactory()); MessageAuthorizationPolicy policy = getMessageAuthorizationPolicy(); if (policy != null) { connector.setMessageAuthorizationPolicy(policy); } if (isUseJmx()) { connector = registerConnectorMBean(connector); } connector.getStatistics().setEnabled(enableStatistics); connector.start(); return connector; }
protected Broker createRegionBroker(DestinationInterceptor destinationInterceptor) throws IOException { RegionBroker regionBroker; if (isUseJmx()) { try { regionBroker = new ManagedRegionBroker(this, getManagementContext(), getBrokerObjectName(), getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } catch(MalformedObjectNameException me){ LOG.warn("Cannot create ManagedRegionBroker due " + me.getMessage(), me); throw new IOException(me); } } else { regionBroker = new RegionBroker(this, getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } destinationFactory.setRegionBroker(regionBroker); regionBroker.setKeepDurableSubsActive(keepDurableSubsActive); regionBroker.setBrokerName(getBrokerName()); regionBroker.getDestinationStatistics().setEnabled(enableStatistics); regionBroker.setAllowTempAutoCreationOnSend(isAllowTempAutoCreationOnSend()); if (brokerId != null) { regionBroker.setBrokerId(brokerId); } return regionBroker; }
protected Connection createConnection(Transport transport) throws IOException { // prefer to use task runner from broker service as stop task runner, as we can then // tie it to the lifecycle of the broker service return new ManagedTransportConnection(this, transport, getBroker(), isDisableAsyncDispatch() ? null : getTaskRunnerFactory(), getBrokerService().getTaskRunnerFactory(), managementContext, connectorName); }
protected Connection createConnection(Transport transport) throws IOException { // prefer to use task runner from broker service as stop task runner, as we can then // tie it to the lifecycle of the broker service return new ManagedTransportConnection(this, transport, getBroker(), isDisableAsyncDispatch() ? null : getTaskRunnerFactory(), getBrokerService().getTaskRunnerFactory(), managementContext, connectorName); }
protected Connection createConnection(Transport transport) throws IOException { // prefer to use task runner from broker service as stop task runner, as we can then // tie it to the lifecycle of the broker service return new ManagedTransportConnection(this, transport, getBroker(), isDisableAsyncDispatch() ? null : getTaskRunnerFactory(), getBrokerService().getTaskRunnerFactory(), managementContext, connectorName); }
protected Connection createConnection(Transport transport) throws IOException { // prefer to use task runner from broker service as stop task runner, as we can then // tie it to the lifecycle of the broker service TransportConnection answer = new TransportConnection(this, transport, broker, disableAsyncDispatch ? null : taskRunnerFactory, brokerService.getTaskRunnerFactory()); boolean statEnabled = this.getStatistics().isEnabled(); answer.getStatistics().setEnabled(statEnabled); answer.setMessageAuthorizationPolicy(messageAuthorizationPolicy); return answer; }
protected Connection createConnection(Transport transport) throws IOException { // prefer to use task runner from broker service as stop task runner, as we can then // tie it to the lifecycle of the broker service TransportConnection answer = new TransportConnection(this, transport, broker, disableAsyncDispatch ? null : taskRunnerFactory, brokerService.getTaskRunnerFactory()); boolean statEnabled = this.getStatistics().isEnabled(); answer.getStatistics().setEnabled(statEnabled); answer.setMessageAuthorizationPolicy(messageAuthorizationPolicy); return answer; }
protected Connection createConnection(Transport transport) throws IOException { // prefer to use task runner from broker service as stop task runner, as we can then // tie it to the lifecycle of the broker service TransportConnection answer = new TransportConnection(this, transport, broker, disableAsyncDispatch ? null : taskRunnerFactory, brokerService.getTaskRunnerFactory()); boolean statEnabled = this.getStatistics().isEnabled(); answer.getStatistics().setEnabled(statEnabled); answer.setMessageAuthorizationPolicy(messageAuthorizationPolicy); return answer; }