Search in sources :

Example 21 with JmsHost

use of com.sun.enterprise.connectors.jms.config.JmsHost in project Payara by payara.

the class MQAddressList method getResolvedJmsHost.

private JmsHost getResolvedJmsHost(Server as) throws Exception {
    if (as == null) {
        return null;
    }
    if (logger.isLoggable(Level.FINE))
        logFine("getResolvedJmsHost " + as);
    // final JmsService jmsService     = Globals.get(JmsService.class);
    // JmsHost jmsHost                 = null;
    // if (JMSServiceType.LOCAL.toString().equals(jmsService.getType())	|| JMSServiceType.EMBEDDED.toString().equals(jmsService.getType())) {
    // jmsHost = getDefaultJmsHost(jmsService);
    // }
    // return ( jmsHost );
    JmsHost jmsHost = getResolvedLocalJmsHostInServer(as);
    JmsHost copy = createJmsHostCopy(jmsHost, as);
    String hostName = getNodeHostName(as);
    // "JMS_PROVIDER_PORT", "7676");
    String port = JmsRaUtil.getJMSPropertyValue(as);
    copy.setHost(hostName);
    copy.setPort(port);
    return copy;
}
Also used : JmsHost(com.sun.enterprise.connectors.jms.config.JmsHost)

Example 22 with JmsHost

use of com.sun.enterprise.connectors.jms.config.JmsHost in project Payara by payara.

the class MQAddressList method setupForCluster.

/**
 * Setup the address list after calculating the JMS hosts
 * belonging to the local appserver cluster members.
 * For LOCAL/EMBEDDED clusters the MQ broker corresponding
 * to "this" server instance needs to be placed ahead
 * of the other brokers of the other siblings in the AS
 * cluter to enable sticky connection balancing by MQ.
 */
private void setupForCluster() throws Exception {
    java.util.Map<String, JmsHost> hostMap = getResolvedLocalJmsHostsInMyCluster(true);
    // First add my jms host.
    JmsHost jmsHost = hostMap.get(myName);
    MQUrl myUrl = createUrl(jmsHost, nodeHost);
    urlList.add(myUrl);
    hostMap.remove(myName);
    // Add all buddies to URL.
    for (JmsHost host : hostMap.values()) {
        MQUrl url = createUrl(host);
        urlList.add(url);
    }
}
Also used : java.util(java.util) JmsHost(com.sun.enterprise.connectors.jms.config.JmsHost)

Example 23 with JmsHost

use of com.sun.enterprise.connectors.jms.config.JmsHost in project Payara by payara.

the class MQAddressList method createJmsHostCopy.

private JmsHost createJmsHostCopy(final JmsHost jmsHost, final Server server) {
    JmsHost jmsHostCopy = new JmsHostWrapper();
    try {
        jmsHostCopy.setAdminPassword(jmsHost.getAdminPassword());
        jmsHostCopy.setAdminUserName(jmsHost.getAdminUserName());
        jmsHostCopy.setName(jmsHost.getName());
        jmsHostCopy.setHost(jmsHost.getHost());
        jmsHostCopy.setPort(jmsHost.getPort());
    } catch (Exception tfe) {
        // todo: handle this exception
        tfe.printStackTrace();
    }
    return jmsHostCopy;
}
Also used : JmsHost(com.sun.enterprise.connectors.jms.config.JmsHost) IOException(java.io.IOException) PropertyVetoException(java.beans.PropertyVetoException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 24 with JmsHost

use of com.sun.enterprise.connectors.jms.config.JmsHost in project Payara by payara.

the class JMSConfigListener method getDefaultJmsHost.

private JmsHost getDefaultJmsHost(JmsService jmsService) {
    JmsHost jmsHost = null;
    String defaultJmsHostName = jmsService.getDefaultJmsHost();
    List<JmsHost> jmsHostsList = jmsService.getJmsHost();
    for (int i = 0; i < jmsHostsList.size(); i++) {
        JmsHost tmpJmsHost = (JmsHost) jmsHostsList.get(i);
        if (tmpJmsHost != null && tmpJmsHost.getName().equals(defaultJmsHostName))
            jmsHost = tmpJmsHost;
    }
    if (jmsHost == null && jmsHostsList.size() > 0)
        jmsHost = jmsHostsList.get(0);
    return jmsHost;
}
Also used : JmsHost(com.sun.enterprise.connectors.jms.config.JmsHost)

Aggregations

JmsHost (com.sun.enterprise.connectors.jms.config.JmsHost)24 JmsService (com.sun.enterprise.connectors.jms.config.JmsService)10 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)6 PropertyVetoException (java.beans.PropertyVetoException)6 ActionReport (org.glassfish.api.ActionReport)4 com.sun.enterprise.config.serverbeans (com.sun.enterprise.config.serverbeans)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ActiveJmsResourceAdapter (com.sun.enterprise.connectors.jms.system.ActiveJmsResourceAdapter)2 MQAddressList (com.sun.enterprise.connectors.jms.system.MQAddressList)2 DummyNetworkListener (com.sun.enterprise.v3.services.impl.DummyNetworkListener)2 GrizzlyService (com.sun.enterprise.v3.services.impl.GrizzlyService)2 Method (java.lang.reflect.Method)2 java.util (java.util)2 ResourceAdapter (javax.resource.spi.ResourceAdapter)2 NetworkListener (org.glassfish.grizzly.config.dom.NetworkListener)2 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)2 Property (org.jvnet.hk2.config.types.Property)2 Cluster (com.sun.enterprise.config.serverbeans.Cluster)1