Search in sources :

Example 1 with JmsHost

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

the class JmsHostWrapper method deepCopy.

public ConfigBeanProxy deepCopy(ConfigBeanProxy proxy) {
    JmsHostWrapper clone = new JmsHostWrapper();
    if (!(proxy instanceof JmsHost))
        return null;
    JmsHost host = (JmsHost) proxy;
    try {
        clone.setHost(host.getHost());
        clone.setPort(host.getPort());
        clone.setName(host.getName());
        clone.setAdminPassword(host.getAdminPassword());
        clone.setAdminUserName(host.getAdminUserName());
    } catch (PropertyVetoException e) {
    // todo : handle this exception
    }
    return null;
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) JmsHost(com.sun.enterprise.connectors.jms.config.JmsHost)

Example 2 with JmsHost

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

the class JmsProviderLifecycle method eagerStartupRequired.

private boolean eagerStartupRequired() {
    JmsService jmsService = getJmsService();
    if (jmsService == null)
        return false;
    List<JmsHost> jmsHostList = jmsService.getJmsHost();
    if (jmsHostList == null)
        return false;
    String defaultJmsHostName = jmsService.getDefaultJmsHost();
    JmsHost defaultJmsHost = null;
    for (JmsHost host : jmsHostList) {
        if (defaultJmsHostName != null && defaultJmsHostName.equals(host.getName())) {
            defaultJmsHost = host;
            break;
        }
    }
    if (defaultJmsHost == null && jmsHostList.size() > 0) {
        defaultJmsHost = jmsHostList.get(0);
    }
    boolean lazyInit = false;
    if (defaultJmsHost != null)
        lazyInit = Boolean.parseBoolean(defaultJmsHost.getLazyInit());
    // we don't manage lifecycle of remote brokers
    if (brokerType == BROKER_TYPE.REMOTE)
        return false;
    // Initialize on demand is currently enabled based on a system property
    String jmsInitializeOnDemand = System.getProperty(JMS_INITIALIZE_ON_DEMAND);
    // if the system property is true, don't do eager startup
    if ("true".equals(jmsInitializeOnDemand))
        return false;
    if (brokerType == BROKER_TYPE.EMBEDDED && (!lazyInit))
        return true;
    // local broker has eager startup by default
    if (brokerType == BROKER_TYPE.LOCAL)
        return true;
    return false;
}
Also used : JmsService(com.sun.enterprise.connectors.jms.config.JmsService) JmsHost(com.sun.enterprise.connectors.jms.config.JmsHost)

Example 3 with JmsHost

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

the class MQAddressList method getMasterBroker.

public String getMasterBroker(String clustername) {
    String masterbrk = null;
    // if (rep != null) {
    try {
        JmsHost mb = getMasterJmsHostInCluster(clustername);
        JmsService js = getJmsServiceForMasterBroker(clustername);
        MQUrl url = createUrl(mb, js);
        masterbrk = url.toString();
        if (logger.isLoggable(Level.FINE))
            logger.log(Level.FINE, "Master broker obtained is " + masterbrk);
    } catch (Exception e) {
        LogHelper.log(logger, Level.SEVERE, JMSLoggerInfo.GET_MASTER_FAILED, e);
    }
    // }
    return masterbrk;
}
Also used : JmsService(com.sun.enterprise.connectors.jms.config.JmsService) 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 4 with JmsHost

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

the class MQAddressList method getResolvedLocalJmsHostsInMyCluster.

public Map<String, JmsHost> getResolvedLocalJmsHostsInMyCluster(final boolean includeMe) {
    final Map<String, JmsHost> map = new HashMap<String, JmsHost>();
    Cluster cluster = getClusterForServer(myName);
    if (cluster != null) {
        final Server[] buddies = getServersInCluster(cluster);
        for (final Server as : buddies) {
            if (!includeMe && myName.equals(as.getName()))
                continue;
            JmsHost copy = null;
            try {
                copy = getResolvedJmsHost(as);
            } catch (Exception e) {
            // e.printStackTrace();
            }
            map.put(as.getName(), copy);
        }
    }
    return (map);
}
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 5 with JmsHost

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

the class MQAddressList method setupForStandaloneServerInstance.

/**
 * Gets the admin config context associated with this server instance
 * Usage Notice: Use this only for operations that are performed in DAS
 * and requires the admin config context
 */
/* private ConfigContext getAdminConfigContext() {
        return com.sun.enterprise.admin.server.core.AdminService.
                   getAdminService().getAdminContext().getAdminConfigContext();
    } */
/**
 * Setup addresslist for Standalone server instance in EE
 */
private void setupForStandaloneServerInstance() throws Exception {
    if (jmsService.getType().equals(ActiveJmsResourceAdapter.REMOTE)) {
        logFine("REMOTE Standalone server instance and hence use default setup");
        defaultSetup();
    } else {
        // For LOCAL or EMBEDDED standalone server instances, we need to resolve
        // the JMSHost
        logFine("LOCAL/EMBEDDED Standalone server instance");
        JmsHost host = getResolvedJmsHostForStandaloneServerInstance(this.targetName);
        MQUrl url = createUrl(host);
        urlList.add(url);
    }
}
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