|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgroups.JChannelFactory
org.jboss.ha.framework.server.JChannelFactory
public class JChannelFactory
Extension to the JGroups JChannelFactory that supports a number of JBoss AS-specific behaviors:
IpAddress
for the peer. Used to provide logical addresses
to cluster peers that remain consistent across channel and server restarts.org.jgroups.mux.MuxChannel
from
the createMultiplexerChannel
methods. Instead always returns
a channel with a shared transport protocol.
Field Summary | |
---|---|
protected static Logger |
log
|
static String |
UNSHARED_TRANSPORT_NAME_BASE
|
Constructor Summary | |
---|---|
JChannelFactory()
|
Method Summary | |
---|---|
void |
create()
Execute the create phase of the 4 step lifecycle. |
org.jgroups.Channel |
createChannel()
Always throws ChannelException ; this method is not supported. |
org.jgroups.Channel |
createChannel(Object properties)
|
org.jgroups.Channel |
createChannel(String stack_name)
Create a Channel using the specified stack. |
org.jgroups.Channel |
createMultiplexerChannel(String stack_name,
String id)
Creates and returns a shared transport Channel configured with the specified protocol stack configuration . |
org.jgroups.Channel |
createMultiplexerChannel(String stack_name,
String id,
boolean register_for_state_transfer,
String substate_id)
Creates and returns a shared transport Channel configured with the specified protocol stack configuration . |
void |
destroy()
Execute the destroy phase of the 4 step lifecycle. |
boolean |
getAddMissingSingletonName()
Gets whether createMultiplexerChannel(String, String) should
create a synthetic singleton name attribute for a channel's transport
protocol if one isn't configured. |
boolean |
getAssignLogicalAddresses()
Gets whether this factory should create a "logical address" (or use one set via setNodeName(String) and assign it to
any newly created Channel as JGroups "additional_data". |
protected ClassLoader |
getDefaultChannelThreadContextClassLoader()
Gets the classloader that channel threads should be set to if #getManageNewThreadClassloader() or getManageReleasedThreadClassLoader()
are true . |
boolean |
getManageNewThreadClassLoader()
Gets whether this factory should update the standard JGroups thread factories to ensure application classloaders do not leak to newly created channel threads. |
boolean |
getManageReleasedThreadClassLoader()
Gets whether this factory should update the standard JGroups thread pools to ensure application classloaders have not leaked to threads returned to the pool. |
int |
getNamingServicePort()
Gets the port on which this server's naming service is listening. |
InetAddress |
getNodeAddress()
Gets the address to which this server is bound; typically the value passed to -b when JBoss is started. |
String |
getNodeName()
Get any logical name assigned to this server; if not null this value will be the value of the logical address assigned
to the channels this factory creates. |
void |
postDeregister()
|
void |
postRegister(Boolean registrationDone)
|
void |
preDeregister()
|
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
|
void |
setAddMissingSingletonName(boolean addMissingSingletonName)
Sets whether createMultiplexerChannel(String, String) should
create a synthetic singleton name attribute for a channel's transport
protocol if one isn't configured. |
void |
setAssignLogicalAddresses(boolean logicalAddresses)
Sets whether this factory should create a "logical address" (or use one set via setNodeName(String) and assign it to
any newly created Channel as JGroups "additional_data". |
void |
setDomain(String domain)
Sets the domain portion of any ObjectName the factory should
use when registering channels or protocols in JMX. |
void |
setManageNewThreadClassLoader(boolean manage)
Sets whether this factory should update the standard JGroups thread factories to ensure application classloaders do not leak to newly created channel threads. |
void |
setManageReleasedThreadClassLoader(boolean manage)
Sets whether this factory should update the standard JGroups thread pools to ensure application classloaders have not leaked to threads returned to the pool. |
void |
setNamingServicePort(int jndiPort)
Sets the port on which this server's naming service is listening. |
void |
setNodeAddress(InetAddress nodeAddress)
Sets the address to which this server is bound; typically the value passed to -b when JBoss is started. |
void |
setNodeName(String nodeName)
Sets the logical name assigned to this server; if not null this value will be the value of the logical address assigned
to the channels this factory creates. |
void |
start()
Execute the start phase of the 4 step lifecycle. |
void |
stop()
Execute the stop phase of the 4 step lifecycle. |
Methods inherited from class org.jgroups.JChannelFactory |
---|
clearConfigurations, dumpChannels, dumpConfiguration, getConfig, getDomain, getMultiplexerConfig, getServer, hasMuxChannel, isExposeChannels, isExposeProtocols, removeConfig, setExposeChannels, setExposeProtocols, setMultiplexerConfig, setMultiplexerConfig, setMultiplexerConfig, setMultiplexerConfig, setMultiplexerConfig, setMultiplexerConfig, setMultiplexerConfig, setMultiplexerConfig, setMultiplexerConfig, setMultiplexerConfig, setServer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jboss.ha.framework.server.JChannelFactoryMBean |
---|
clearConfigurations, dumpChannels, dumpConfiguration, getConfig, getDomain, getMultiplexerConfig, isExposeChannels, isExposeProtocols, removeConfig, setExposeChannels, setExposeProtocols, setMultiplexerConfig, setMultiplexerConfig |
Field Detail |
---|
protected static final Logger log
public static final String UNSHARED_TRANSPORT_NAME_BASE
Constructor Detail |
---|
public JChannelFactory()
Method Detail |
---|
public org.jgroups.Channel createChannel() throws org.jgroups.ChannelException
ChannelException
; this method is not supported.
createChannel
in interface org.jgroups.ChannelFactory
createChannel
in class org.jgroups.JChannelFactory
org.jgroups.ChannelException
public org.jgroups.Channel createChannel(Object properties) throws org.jgroups.ChannelException
createChannel
in interface org.jgroups.ChannelFactory
createChannel
in class org.jgroups.JChannelFactory
org.jgroups.ChannelException
public org.jgroups.Channel createChannel(String stack_name) throws Exception
Channel
using the specified stack. Channel will use a
shared transport if the singleton-name
attribute is
set on the stack's transport protocol.
createChannel
in interface JChannelFactoryMBean
createChannel
in interface org.jgroups.ChannelFactory
createChannel
in class org.jgroups.JChannelFactory
stack_name
- the name of the stack
Exception
public org.jgroups.Channel createMultiplexerChannel(String stack_name, String id) throws Exception
protocol stack configuration
.
ChannelFactory.createMultiplexerChannel(String, String)
.
The returned channel will not be an instance of
org.jgroups.mux.MuxChannel
; rather a channel that uses a
shared transport will be returned. This will be the case whether or
not the protocol stack specified by stack_name
includes
a singleton_name
attribute in its
transport protocol
configuration. If no
singleton_name
attribute is present, this factory will create
a synthetic one by prepending "unnamed_" to the provided
id
param and will use that for the returned channel's
transport protocol. (Note this will not effect the protocol stack
configuration named by stack_name
; i.e. another request
that passes the same stack_name
will not inherit the
synthetic singleton name.)
createMultiplexerChannel
in interface JChannelFactoryMBean
createMultiplexerChannel
in interface org.jgroups.ChannelFactory
createMultiplexerChannel
in class org.jgroups.JChannelFactory
stack_name
- The name of the stack to be used. All stacks are defined in
the configuration with which the factory is configured (see
JChannelFactory.setMultiplexerConfig(Object)
for example. If
clients attempt to create a Channel for an undefined stack
name an Exception will be thrown.id
- Only used if the transport protocol configuration for the
specified stack does not include the singleton_name
attribute; then it is used to create a synthetic singleton-name
for the channel's protocol stack.
IllegalStateException
- if the specified protocol stack does not
declare a singleton_name
and
getAddMissingSingletonName()
returns
false
.
org.jgroups.ChannelException
Exception
public org.jgroups.Channel createMultiplexerChannel(String stack_name, String id, boolean register_for_state_transfer, String substate_id) throws Exception
protocol stack configuration
.
See createMultiplexerChannel(String, String)
; the additional
attributes specified in this overloaded version of that method are ignored.
createMultiplexerChannel
in interface JChannelFactoryMBean
createMultiplexerChannel
in interface org.jgroups.ChannelFactory
createMultiplexerChannel
in class org.jgroups.JChannelFactory
register_for_state_transfer
- ignored in JBoss AS. Treated as false
.substate_id
- ignored in JBoss AS
IllegalStateException
- if the specified protocol stack does not
declare a singleton_name
and
getAddMissingSingletonName()
returns
false
.
org.jgroups.ChannelException
Exception
public void setDomain(String domain)
JChannelFactoryMBean
ObjectName
the factory should
use when registering channels or protocols in JMX.
setDomain
in interface JChannelFactoryMBean
setDomain
in class org.jgroups.JChannelFactory
domain
- the domain portion of the object name. Must conform to
the rules for elements in an ObjectName.public String getNodeName()
logical address
assigned
to the channels this factory creates.
null
.public void setNodeName(String nodeName)
logical address
assigned
to the channels this factory creates.
nodeName
- the logical name for this server, or null
.public InetAddress getNodeAddress()
-b
when JBoss is started. Used in combination
with the naming service port
to create
a logical name for this server if no node name
is specified.
null
if not setpublic void setNodeAddress(InetAddress nodeAddress)
-b
when JBoss is started. Used in combination
with the naming service port
to create
a logical name for this server if no node name
is specified.
nodeAddress
- the address to which this server is bound,
or null
public int getNamingServicePort()
the server bind address
to create
a logical name for this server if no node name
is specified.
-1
if not set.public void setNamingServicePort(int jndiPort)
the server bind address
to create
a logical name for this server if no node name
is specified.
jndiPort
- the port on which JNDI is listening.public boolean getAssignLogicalAddresses()
setNodeName(String)
and assign it to
any newly created Channel
as JGroups "additional_data".
setAssignLogicalAddresses(boolean)
public void setAssignLogicalAddresses(boolean logicalAddresses)
setNodeName(String)
and assign it to
any newly created Channel
as JGroups "additional_data".
Any such logical address will be used by HAPartition
to assign a name to the ClusterNode
object representing
this node. If a logical address is not set, the ClusterNode
will use the address and port JGroups is using to receive messages to
create its name.
Default is true
.
public boolean getManageNewThreadClassLoader()
true
if the factories should be updated.
Default is true
.public void setManageNewThreadClassLoader(boolean manage)
false
if a JGroups release is used that itself prevents such classloader leaks.
manage
- true
if the factories should be updated.public boolean getManageReleasedThreadClassLoader()
true
if the pools should be updated.
Default is false
.public void setManageReleasedThreadClassLoader(boolean manage)
There is a small performance cost to enabling this, and applications
can prevent any need to enable it by properly restoring the thread
context classloader if they change it. Therefore, by default this
is set to false
.
manage
- true
if the factories should be updated.public boolean getAddMissingSingletonName()
createMultiplexerChannel(String, String)
should
create a synthetic singleton name attribute for a channel's transport
protocol if one isn't configured. If this is false
and
no singleton_name
is configured,
createMultiplexerChannel(String, String)
will throw an
IllegalStateException
.
true
if synthetic singleton names should be created.
Default is true
.public void setAddMissingSingletonName(boolean addMissingSingletonName)
createMultiplexerChannel(String, String)
should
create a synthetic singleton name attribute for a channel's transport
protocol if one isn't configured.
addMissingSingletonName
- true
if synthetic singleton
names should be created.public void create() throws Exception
JChannelFactoryMBean
create
in interface JChannelFactoryMBean
create
in class org.jgroups.JChannelFactory
Exception
public void start() throws Exception
JChannelFactoryMBean
start
in interface JChannelFactoryMBean
start
in class org.jgroups.JChannelFactory
Exception
public void stop()
JChannelFactoryMBean
stop
in interface JChannelFactoryMBean
stop
in class org.jgroups.JChannelFactory
public void destroy()
JChannelFactoryMBean
destroy
in interface JChannelFactoryMBean
destroy
in class org.jgroups.JChannelFactory
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
preRegister
in interface MBeanRegistration
Exception
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
public void preDeregister() throws Exception
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
postDeregister
in interface MBeanRegistration
protected ClassLoader getDefaultChannelThreadContextClassLoader()
#getManageNewThreadClassloader()
or getManageReleasedThreadClassLoader()
are true
.
This implementation returns this class' classloader.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |