/** * Gets the domain portion of the JMX ObjectName to use when registering channels and protocols * * @return the domain. Will not return <code>null</code> after {@link #create()} * has been invoked. */ @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The domain portion of the JMX ObjectName to use when registering channels and protocols") public String getDomain() { return super.getDomain(); }
@ManagementProperty(use={ViewUse.CONFIGURATION}, description="Whether to expose channels we create via JMX") public boolean isExposeChannels() { return super.isExposeChannels(); }
@ManagementProperty(use={ViewUse.CONFIGURATION}, description="Whether to expose protocols via JMX as well if we expose channels") public boolean isExposeProtocols() { return super.isExposeProtocols(); }
checkStarted(); throw new IllegalArgumentException("Unknown stack_name " + stack_name); ProtocolData[] protocols = config.getConfiguration(); JChannel channel = initializeChannel(protocols, stack_name, forceSingletonStack); registerChannel(channel, id, stack_name, protocols);
private List<ObjectName> registerInJmx(JChannel ch, String channelId) throws Exception { List<ObjectName> allNames = null; if(isExposeChannels() && getServer() != null && channelId != null && channelId.length() > 0) { allNames = new ArrayList<ObjectName>(); ObjectName channelName = new ObjectName(getDomain() + ":type=channel,cluster=" + channelId); JmxConfigurator conf = new JmxConfigurator(); getServer().registerMBean(conf.asDynamicMBean(ch), channelName); allNames.add(channelName); if (isExposeProtocols()) { String baseName = getDomain() + ":type=protocol,cluster=" + channelId; ProtocolStack stack=ch.getProtocolStack(); List<Protocol> protocols=stack.getProtocols(); for(Protocol prot : protocols) { ObjectName prot_name=new ObjectName(baseName + ",protocol=" + prot.getName()); server.registerMBean(conf.asDynamicMBean(prot), prot_name); allNames.add(prot_name); } } } return allNames; }
boolean forceSingletonStack) throws ChannelException Map<String, String> tpProps = getTransportProperties(config); ". You should configure a singleton_name for this stack."); config = addSingletonName(config, singletonName); tpProps = getTransportProperties(config); fixChannelThreadManagement(channel); setChannelUniqueId(channel);
log.debug("Ignoring start call; current state is " + getStateString()); return; create(); startService();
/** * {@link #parse(InputStream) Parses} an input stream created from * <code>properties</code> and then adds the resulting protocol stack * configurations to the set available for use. * * @param properties URL which must contain XML content in the JGroups * <code>stacks.xml</code> format * @param replace <code>true</code> if a configuration with the same * stack name as an already registered configuration should * replace that configuration; <code>false</code> if it * should be discarded. */ public void setMultiplexerConfig(URL url, boolean replace) throws Exception { InputStream input=ConfiguratorFactory.getConfigStream(url); addConfigs(input, url.toString(), replace); }
/** * {@link #parse(Element) Parses <code>properties</code>} and then adds * the resulting protocol stack configurations to the set available for use. * * @param properties document root node for XML content in the JGroups * <code>stacks.xml</code> format * @param replace <code>true</code> if a configuration with the same * stack name as an already registered configuration should * replace that configuration; <code>false</code> if it * should be discarded. */ public void setMultiplexerConfig(Element properties, boolean replace) throws Exception { Map<String, ProtocolStackConfigInfo> map = ProtocolStackUtil.parse(properties); for (Map.Entry<String, ProtocolStackConfigInfo> entry : map.entrySet()) { addConfig(entry.getKey(), entry.getValue(), replace); } }
/** * Create a {@link Channel} using the specified stack. Channel will use a * shared transport. * * @param stack_name * The name of the stack to be used. All stacks are defined in * the configuration with which the factory is configured (see * {@link #setMultiplexerConfig(Object)} for example. If * clients attempt to create a Channel for an undefined stack * name an exception will be thrown. * * @return an implementation of Channel configured with a shared transport. * * @throws IllegalArgumentException if <code>stack_name</code> is * <code>null</code> or {@link #getConfig(String)} returns <code>null</code> * when <code>stack_name</code> is used. * * @throws Exception */ @Override public Channel createChannel(String stack_name) throws Exception { return createChannelFromRegisteredStack(stack_name, null, false); }
private synchronized void processInjectedStacks() { if (injectedStacks != null) { clearConfigurations(); stacks.putAll(injectedStacks); injectedStacks = null; } }
public Channel createChannel(Object properties) throws ChannelException checkStarted(); JChannel channel = initializeChannel(config, null, false); registerChannel(channel, null, null, config);
/** * {@link #parse(InputStream) Parses} an input stream created from * <code>properties</code> and then adds the resulting protocol stack * configurations to the set available for use. * * @param properties object that can be {@link ConfiguratorFactory#getConfigStream(Object) converted into a stream} * which must contain XML content in the JGroups * <code>stacks.xml</code> format * @param replace <code>true</code> if a configuration with the same * stack name as an already registered configuration should * replace that configuration; <code>false</code> if it * should be discarded. */ public void setMultiplexerConfig(Object properties, boolean replace) throws Exception { InputStream input=ConfiguratorFactory.getConfigStream(properties); addConfigs(input, properties.toString(), replace); }
private void addConfigs(InputStream input, String source, boolean replace) throws Exception { if(input == null) { throw new FileNotFoundException(source); } Map<String, ProtocolStackConfigInfo> map = null; try { map = ProtocolStackUtil.parse(input); } catch(Exception ex) { throw new Exception("failed parsing " + source, ex); } finally { Util.close(input); } for (Map.Entry<String, ProtocolStackConfigInfo> entry : map.entrySet()) { addConfig(entry.getKey(), entry.getValue(), replace); } }
public Channel createMultiplexerChannel(String stack_name, String id) throws Exception return createChannelFromRegisteredStack(stack_name, id, true);
/** * {@link #parse(InputStream) Parses} an input stream created from * <code>properties</code> and then adds the resulting protocol stack * configurations to the set available for use. * * @param properties file which must contain XML content in the JGroups * <code>stacks.xml</code> format * @param replace <code>true</code> if a configuration with the same * stack name as an already registered configuration should * replace that configuration; <code>false</code> if it * should be discarded. */ public void setMultiplexerConfig(File properties, boolean replace) throws Exception { InputStream input=ConfiguratorFactory.getConfigStream(properties); addConfigs(input, properties.toString(), replace); }
/** * {@link #parse(InputStream) Parses} an input stream created from * <code>properties</code> and then adds the resulting protocol stack * configurations to the set available for use. * * @param properties string that can be {@link ConfiguratorFactory#getConfigStream(String) converted into a stream} * which must contain XML content in the JGroups * <code>stacks.xml</code> format * @param replace <code>true</code> if a configuration with the same * stack name as an already registered configuration should * replace that configuration; <code>false</code> if it * should be discarded. */ @Override public void setMultiplexerConfig(String properties, boolean replace) throws Exception { InputStream input=ConfiguratorFactory.getConfigStream(properties); addConfigs(input, properties, replace); }