org.apache.activemq.util.IOExceptionSupport Java Examples

The following examples show how to use org.apache.activemq.util.IOExceptionSupport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TcpTransportFactory.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Override
public TransportServer doBind(final URI location) throws IOException {
   try {
      Map<String, String> options = new HashMap<>(URISupport.parseParameters(location));

      ServerSocketFactory serverSocketFactory = createServerSocketFactory();
      TcpTransportServer server = createTcpTransportServer(location, serverSocketFactory);
      server.setWireFormatFactory(createWireFormatFactory(options));
      IntrospectionSupport.setProperties(server, options);
      Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
      server.setTransportOption(transportOptions);
      server.bind();

      return server;
   } catch (URISyntaxException e) {
      throw IOExceptionSupport.create(e);
   }
}
 
Example #2
Source File: TcpFaultyTransportFactory.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Override
public TransportServer doBind(final URI location) throws IOException {
   try {
      Map<String, String> options = new HashMap<>(URISupport.parseParameters(location));

      ServerSocketFactory serverSocketFactory = createServerSocketFactory();
      TcpFaultyTransportServer server = createTcpFaultyTransportServer(location, serverSocketFactory);
      server.setWireFormatFactory(createWireFormatFactory(options));
      IntrospectionSupport.setProperties(server, options);
      Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
      server.setTransportOption(transportOptions);
      server.bind();

      return server;
   } catch (URISyntaxException e) {
      throw IOExceptionSupport.create(e);
   }
}
 
Example #3
Source File: KubernetesDiscoveryAgentFactory.java    From activemq-k8s-discovery with Apache License 2.0 5 votes vote down vote up
protected DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException {
    try {
        Map<String, String> options = URISupport.parseParameters(uri);
        KubernetesDiscoveryAgent rc = new KubernetesDiscoveryAgent();
        IntrospectionSupport.setProperties(rc, options);
        LOG.info("Succesfully created Kubernetes discovery agent from URI: {}", uri);

        return rc;
        
    } catch (Throwable e) {
        LOG.error("Could not create Kubernetes discovery agent: " + uri, e);
        throw IOExceptionSupport.create("Could not create Kubernetes discovery agent: " + uri, e);
    }
}
 
Example #4
Source File: KubeDiscoveryAgentFactory.java    From openshift-ping with Apache License 2.0 5 votes vote down vote up
@Override
protected DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException {
    try {
        LOGGER.info("Creating Kubernetes discovery agent for {}.", uri.toString());
        final Map<String, String> options = URISupport.parseParameters(uri);
        uri = URISupport.removeQuery(uri);
        final OpenShiftDiscoveryAgent agent = new OpenShiftDiscoveryAgent(new KubePeerAddressResolver(
                uri.getHost(), uri.getPort()));
        IntrospectionSupport.setProperties(agent, options);
        return agent;
    } catch (Throwable e) {
        throw IOExceptionSupport.create("Could not create discovery agent: " + uri, e);
    }
}
 
Example #5
Source File: DNSDiscoveryAgentFactory.java    From openshift-ping with Apache License 2.0 5 votes vote down vote up
@Override
protected DiscoveryAgent doCreateDiscoveryAgent(URI uri) throws IOException {
    try {
        LOGGER.info("Creating DNS discovery agent for {}.", uri.toString());
        final Map<String, String> options = URISupport.parseParameters(uri);
        uri = URISupport.removeQuery(uri);
        final OpenShiftDiscoveryAgent agent = new OpenShiftDiscoveryAgent(new DNSPeerResolver(uri.getHost(), uri.getPort()));
        IntrospectionSupport.setProperties(agent, options);
        return agent;
    } catch (Throwable e) {
        throw IOExceptionSupport.create("Could not create discovery agent: " + uri, e);
    }
}