Tabnine Logo
BrokerInfo
Code IndexAdd Tabnine to your IDE (free)

How to use
BrokerInfo
in
org.apache.activemq.command

Best Java code snippets using org.apache.activemq.command.BrokerInfo (Showing top 20 results out of 315)

Refine searchRefine arrow

  • DataInput
  • DataOutput
  • BrokerService
  • TransportConnector
  • CountDownLatch
origin: apache/activemq

  /**
   * Write the booleans that this object uses to a BooleanStream
   */
  public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {

    BrokerInfo info = (BrokerInfo)o;

    super.looseMarshal(wireFormat, o, dataOut);
    looseMarshalCachedObject(wireFormat, (DataStructure)info.getBrokerId(), dataOut);
    looseMarshalString(info.getBrokerURL(), dataOut);
    looseMarshalObjectArray(wireFormat, info.getPeerBrokerInfos(), dataOut);
    looseMarshalString(info.getBrokerName(), dataOut);
    dataOut.writeBoolean(info.isSlaveBroker());
    dataOut.writeBoolean(info.isMasterBroker());
    dataOut.writeBoolean(info.isFaultTolerantConfiguration());
    dataOut.writeBoolean(info.isDuplexConnection());
    dataOut.writeBoolean(info.isNetworkConnection());
    looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);

  }
}
origin: apache/activemq

/**
 * @return a new object instance
 */
public DataStructure createObject() {
  return new BrokerInfo();
}
origin: apache/activemq

info.setBrokerId((org.apache.activemq.command.BrokerId)looseUnmarsalCachedObject(wireFormat, dataIn));
info.setBrokerURL(looseUnmarshalString(dataIn));
if (dataIn.readBoolean()) {
  short size = dataIn.readShort();
  org.apache.activemq.command.BrokerInfo value[] = new org.apache.activemq.command.BrokerInfo[size];
  for (int i = 0; i < size; i++) {
                                           dataIn);
  info.setPeerBrokerInfos(value);
} else {
  info.setPeerBrokerInfos(null);
info.setBrokerName(looseUnmarshalString(dataIn));
info.setSlaveBroker(dataIn.readBoolean());
info.setMasterBroker(dataIn.readBoolean());
info.setFaultTolerantConfiguration(dataIn.readBoolean());
info.setDuplexConnection(dataIn.readBoolean());
info.setNetworkConnection(dataIn.readBoolean());
info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn));
origin: apache/activemq

public BrokerInfo copy() {
  BrokerInfo copy = new BrokerInfo();
  copy(copy);
  return copy;
}
origin: apache/activemq

public void addPeerBroker(BrokerInfo info) {
  if (isMatchesClusterFilter(info.getBrokerName())) {
    synchronized (peerBrokers) {
      getPeerBrokers().addLast(info.getBrokerURL());
    }
  }
}
origin: apache/activemq

@Override
public synchronized void addBroker(Connection connection, BrokerInfo info) {
  BrokerInfo existing = brokerInfos.get(info.getBrokerId());
  if (existing == null) {
    existing = info.copy();
    existing.setPeerBrokerInfos(null);
    brokerInfos.put(info.getBrokerId(), existing);
  }
  existing.incrementRefCount();
  LOG.debug("{} addBroker: {} brokerInfo size: {}", new Object[]{ getBrokerName(), info.getBrokerName(), brokerInfos.size() });
  addBrokerInClusterUpdate(info);
}
origin: apache/activemq

/**
 * Returns the broker name if one is available or null if one is not
 * available yet.
 */
public String getBrokerName() {
  try {
    brokerInfoReceived.await(5, TimeUnit.SECONDS);
    if (brokerInfo == null) {
      return null;
    }
    return brokerInfo.getBrokerName();
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    return null;
  }
}
origin: apache/activemq

  props = MarshallingSupport.stringToProperties(remoteBrokerInfo.getNetworkProperties());
  IntrospectionSupport.getProperties(configuration, props, null);
  if (configuration.getExcludedDestinations() != null) {
if (safeWaitUntilStarted()) {
  setupStaticDestinations();
  staticDestinationsLatch.countDown();
origin: apache/activemq

synchronized (this) {
  if (!isCreatedByDuplex()) {
    BrokerInfo brokerInfo = new BrokerInfo();
    brokerInfo.setBrokerName(configuration.getBrokerName());
    brokerInfo.setBrokerURL(configuration.getBrokerURL());
    brokerInfo.setNetworkConnection(true);
    brokerInfo.setDuplexConnection(configuration.isDuplex());
    brokerInfo.setNetworkProperties(str);
    brokerInfo.setBrokerId(this.localBrokerId);
    remoteBroker.oneway(brokerInfo);
    if (configuration.isSyncDurableSubs() &&
    remoteBroker.oneway(demandConsumerInfo);
  startedLatch.countDown();
origin: apache/activemq

@Override
public Response processBrokerInfo(BrokerInfo info) {
  if (info.isSlaveBroker()) {
    LOG.error(" Slave Brokers are no longer supported - slave trying to attach is: {}", info.getBrokerName());
  } else if (info.isNetworkConnection() && !info.isDuplexConnection()) {
    try {
      NetworkBridgeConfiguration config = getNetworkConfiguration(info);
      LOG.error("Failed to respond to network bridge creation from broker {}", info.getBrokerId(), e);
      return null;
  } else if (info.isNetworkConnection() && info.isDuplexConnection()) {
      String duplexNetworkConnectorId = config.getName() + "@" + info.getBrokerId();
      CopyOnWriteArrayList<TransportConnection> connections = this.connector.getConnections();
      synchronized (connections) {
        for (Iterator<TransportConnection> iter = connections.iterator(); iter.hasNext(); ) {
            c.stopAsync();
            c.getStopped().await(1, TimeUnit.SECONDS);
        duplexName = duplexName.substring(duplexName.lastIndexOf("#"));
      info.setDuplexConnection(false);
      duplexBridge.setCreatedByDuplex(true);
      duplexBridge.duplexStart(this, brokerInfo, info);
origin: pierre/meteo

protected void serviceRemoteBrokerInfo(Command command) throws IOException {
  synchronized (brokerInfoMutex) {
    BrokerInfo remoteBrokerInfo = (BrokerInfo)command;
    remoteBrokerId = remoteBrokerInfo.getBrokerId();
    remoteBrokerPath[0] = remoteBrokerId;
    remoteBrokerName = remoteBrokerInfo.getBrokerName();
    if (localBrokerId != null) {
      if (localBrokerId.equals(remoteBrokerId)) {
        if (LOG.isTraceEnabled()) {
          LOG.trace(configuration.getBrokerName() + " disconnecting remote loop back connection: " + remoteBrokerName);
        }
        ServiceSupport.dispose(this);
      }
    }
    if (LOG.isTraceEnabled()) {
      LOG.trace("counting down remoteBrokerNameKnownLatch with: " + command);
    }
    remoteBrokerNameKnownLatch.countDown();
  }
}
origin: pierre/meteo

protected void serviceLocalBrokerInfo(Command command) throws InterruptedException {
  synchronized (brokerInfoMutex) {
    localBrokerId = ((BrokerInfo)command).getBrokerId();
    localBrokerPath[0] = localBrokerId;
    localBrokerIdKnownLatch.countDown();
    if (remoteBrokerId != null) {
      if (remoteBrokerId.equals(localBrokerId)) {
        if (LOG.isTraceEnabled()) {
          LOG.trace(configuration.getBrokerName() + " disconnecting local loop back connection.");
        }
        waitStarted();
        ServiceSupport.dispose(this);
      }
    }
  }
}
origin: apache/activemq

  /**
   * Write the booleans that this object uses to a BooleanStream
   */
  public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {

    BrokerInfo info = (BrokerInfo)o;

    super.looseMarshal(wireFormat, o, dataOut);
    looseMarshalCachedObject(wireFormat, (DataStructure)info.getBrokerId(), dataOut);
    looseMarshalString(info.getBrokerURL(), dataOut);
    looseMarshalObjectArray(wireFormat, info.getPeerBrokerInfos(), dataOut);
    looseMarshalString(info.getBrokerName(), dataOut);
    dataOut.writeBoolean(info.isSlaveBroker());
    dataOut.writeBoolean(info.isMasterBroker());
    dataOut.writeBoolean(info.isFaultTolerantConfiguration());

  }
}
origin: apache/activemq

/**
 * Un-marshal an object instance from the data input stream
 * 
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
  super.looseUnmarshal(wireFormat, o, dataIn);
  BrokerInfo info = (BrokerInfo)o;
  info.setBrokerId((org.apache.activemq.command.BrokerId)looseUnmarsalCachedObject(wireFormat, dataIn));
  info.setBrokerURL(looseUnmarshalString(dataIn));
  if (dataIn.readBoolean()) {
    short size = dataIn.readShort();
    org.apache.activemq.command.BrokerInfo value[] = new org.apache.activemq.command.BrokerInfo[size];
    for (int i = 0; i < size; i++) {
      value[i] = (org.apache.activemq.command.BrokerInfo)looseUnmarsalNestedObject(wireFormat, dataIn);
    }
    info.setPeerBrokerInfos(value);
  } else {
    info.setPeerBrokerInfos(null);
  }
  info.setBrokerName(looseUnmarshalString(dataIn));
  info.setSlaveBroker(dataIn.readBoolean());
  info.setMasterBroker(dataIn.readBoolean());
  info.setFaultTolerantConfiguration(dataIn.readBoolean());
}
origin: apache/activemq

@Override
public void start() throws Exception {
  broker = brokerService.getBroker();
  brokerInfo.setBrokerName(broker.getBrokerName());
  brokerInfo.setBrokerId(broker.getBrokerId());
  brokerInfo.setPeerBrokerInfos(broker.getPeerBrokerInfos());
  brokerInfo.setFaultTolerantConfiguration(broker.isFaultTolerantConfiguration());
  brokerInfo.setBrokerURL(broker.getBrokerService().getDefaultSocketURIString());
  getServer().setAcceptListener(new TransportAcceptListener() {
    @Override
    public void onAccept(final Transport transport) {
  getServer().setBrokerInfo(brokerInfo);
  getServer().start();
  DiscoveryAgent da = getDiscoveryAgent();
origin: apache/activemq

@Test
public void addPeerBrokerWithoutFilter() throws Exception {
  underTest.setBrokerService(new BrokerService());
  final String validName = "west";
  BrokerInfo brokerInfo = new BrokerInfo();
  brokerInfo.setBrokerURL(validName);
  brokerInfo.setBrokerName(validName);
  assertFalse(underTest.getPeerBrokers().contains(validName));
  underTest.addPeerBroker(brokerInfo);
  assertTrue(underTest.getPeerBrokers().contains(validName));
  final String validName2 = "east";
  brokerInfo = new BrokerInfo();
  brokerInfo.setBrokerURL(validName2);
  brokerInfo.setBrokerName(validName2);
  assertFalse(underTest.getPeerBrokers().contains(validName2));
  underTest.addPeerBroker(brokerInfo);
  assertTrue(underTest.getPeerBrokers().contains(validName2));
}
origin: pierre/meteo

protected void startBridge() throws Exception {
  connectionInfo = new ConnectionInfo();
  connectionInfo.setConnectionId(new ConnectionId(idGenerator.generateId()));
  connectionInfo.setClientId(idGenerator.generateId());
  connectionInfo.setUserName(userName);
  connectionInfo.setPassword(password);
  connectionInfo.setBrokerMasterConnector(true);
  sessionInfo = new SessionInfo(connectionInfo, 1);
  producerInfo = new ProducerInfo(sessionInfo, 1);
  producerInfo.setResponseRequired(false);
  if (connector != null) {
    brokerInfo = connector.getBrokerInfo();
  } else {
    brokerInfo = new BrokerInfo();
  }
  brokerInfo.setBrokerName(broker.getBrokerName());
  brokerInfo.setPeerBrokerInfos(broker.getBroker().getPeerBrokerInfos());
  brokerInfo.setSlaveBroker(true);
  brokerInfo.setPassiveSlave(broker.isPassiveSlave());
  restartBridge();
  LOG.info("Slave connection between " + localBroker + " and " + remoteBroker + " has been established.");
}
origin: apache/activemq

remoteBrokerId = remoteBrokerInfo.getBrokerId();
if (localBrokerId.equals(remoteBrokerId)) {
  LOG.trace("{} disconnecting remote loop back connector for: {}, with id: {}", new Object[]{
remoteBrokerName = remoteBrokerInfo.getBrokerName();
if (configuration.isUseBrokerNamesAsIdSeed()) {
  idGenerator = new IdGenerator(brokerService.getBrokerName() + "->" + remoteBrokerName);
origin: apache/activemq

@Override
public synchronized void removeBroker(Connection connection, BrokerInfo info) {
  if (info != null) {
    BrokerInfo existing = brokerInfos.get(info.getBrokerId());
    if (existing != null && existing.decrementRefCount() == 0) {
      brokerInfos.remove(info.getBrokerId());
    }
    LOG.debug("{} removeBroker: {} brokerInfo size: {}", new Object[]{ getBrokerName(), info.getBrokerName(), brokerInfos.size()});
    // When stopping don't send cluster updates since we are the one's tearing down
    // our own bridges.
    if (!brokerService.isStopping()) {
      removeBrokerInClusterUpdate(info);
    }
  }
}
origin: apache/activemq-artemis

public void sendBrokerInfo(OpenWireConnection connection) throws Exception {
 BrokerInfo brokerInfo = new BrokerInfo();
 brokerInfo.setBrokerName(getBrokerName());
 brokerInfo.setBrokerId(new BrokerId("" + server.getNodeID()));
 brokerInfo.setPeerBrokerInfos(null);
 brokerInfo.setFaultTolerantConfiguration(false);
 brokerInfo.setBrokerURL(connection.getLocalAddress());
 //cluster support yet to support
 brokerInfo.setPeerBrokerInfos(null);
 connection.dispatch(brokerInfo);
}
org.apache.activemq.commandBrokerInfo

Javadoc

When a client connects to a broker, the broker send the client a BrokerInfo so that the client knows which broker node he's talking to and also any peers that the node has in his cluster. This is the broker helping the client out in discovering other nodes in the cluster.

Most used methods

  • getBrokerId
  • getBrokerName
  • <init>
  • getBrokerURL
  • setBrokerName
  • setBrokerURL
  • setBrokerId
  • setFaultTolerantConfiguration
  • setPeerBrokerInfos
  • getNetworkProperties
  • isDuplexConnection
  • isNetworkConnection
  • isDuplexConnection,
  • isNetworkConnection,
  • isSlaveBroker,
  • setDuplexConnection,
  • setNetworkConnection,
  • setNetworkProperties,
  • copy,
  • getBrokerUploadUrl,
  • getConnectionId,
  • getPeerBrokerInfos

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getSystemService (Context)
  • setRequestProperty (URLConnection)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now