[jboss-cvs] JBossAS SVN: r81047 - in trunk/cluster: src/examples/org/jboss/ha/singleton/examples and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 14 09:54:03 EST 2008
Author: dimitris at jboss.org
Date: 2008-11-14 09:54:03 -0500 (Fri, 14 Nov 2008)
New Revision: 81047
Modified:
trunk/cluster/pom.xml
trunk/cluster/src/examples/org/jboss/ha/singleton/examples/HASingletonPojoExample.java
trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionSticky.java
trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailable.java
trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailableIdenticalAllProxies.java
trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRandomRobin.java
trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRoundRobin.java
trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterNodeImpl.java
trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactoryMBean.java
trunk/cluster/src/main/org/jboss/ha/framework/server/RspFilterAdapter.java
trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/AbstractHAPartitionDependencyDeployer.java
trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/DefaultHAPartitionDependencyCreator.java
trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb2HAPartitionDependencyDeployer.java
trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb3HAPartitionDependencyDeployer.java
trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/HAPartitionDependencyCreator.java
trunk/cluster/src/main/org/jboss/ha/jmx/AbstractHAServiceMBeanSupport.java
trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java
trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java
trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicy.java
trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicyMBean.java
trunk/cluster/src/main/org/jboss/proxy/AbstractTransactionStickyInterceptor.java
trunk/cluster/src/main/org/jboss/proxy/ClientUserTransactionStickyInterceptor.java
trunk/cluster/src/main/org/jboss/proxy/TransactionStickyInterceptor.java
trunk/cluster/src/resources/jboss-cache-manager.sar/META-INF/jboss-cache-configs.xml
trunk/cluster/src/resources/jboss-cache-manager.sar/META-INF/jboss-cache-manager-jboss-beans.xml
Log:
fix svn properties
Property changes on: trunk/cluster/pom.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/examples/org/jboss/ha/singleton/examples/HASingletonPojoExample.java
===================================================================
--- trunk/cluster/src/examples/org/jboss/ha/singleton/examples/HASingletonPojoExample.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/examples/org/jboss/ha/singleton/examples/HASingletonPojoExample.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,78 +1,78 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.singleton.examples;
-
-import java.io.Serializable;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.logging.Logger;
-import org.jboss.naming.Util;
-
-/**
- * Ha Singleton Pojo example.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class HASingletonPojoExample implements Serializable
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 6823691561869778917L;
-
- private static Logger log = Logger.getLogger(HASingletonPojoExample.class);
-
- private final String jndiName;
-
- private boolean isMasterNode;
-
- public HASingletonPojoExample(String jndiName)
- {
- this.jndiName = jndiName;
- }
-
- public void startSingleton() throws NamingException
- {
- isMasterNode = true;
-
- InitialContext ctx = new InitialContext();
- Util.rebind(ctx, jndiName, this);
-
- log.info("Notified to start as singleton and bound to jndi under " + jndiName);
- }
-
- public boolean isMasterNode()
- {
- return isMasterNode;
- }
-
- public void stopSingleton() throws NamingException
- {
- isMasterNode = false;
-
- InitialContext ctx = new InitialContext();
- Util.unbind(ctx, jndiName);
-
- log.info("Notified to stop as singleton and unbound from jndi under " + jndiName);
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.singleton.examples;
+
+import java.io.Serializable;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.naming.Util;
+
+/**
+ * Ha Singleton Pojo example.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class HASingletonPojoExample implements Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6823691561869778917L;
+
+ private static Logger log = Logger.getLogger(HASingletonPojoExample.class);
+
+ private final String jndiName;
+
+ private boolean isMasterNode;
+
+ public HASingletonPojoExample(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public void startSingleton() throws NamingException
+ {
+ isMasterNode = true;
+
+ InitialContext ctx = new InitialContext();
+ Util.rebind(ctx, jndiName, this);
+
+ log.info("Notified to start as singleton and bound to jndi under " + jndiName);
+ }
+
+ public boolean isMasterNode()
+ {
+ return isMasterNode;
+ }
+
+ public void stopSingleton() throws NamingException
+ {
+ isMasterNode = false;
+
+ InitialContext ctx = new InitialContext();
+ Util.unbind(ctx, jndiName);
+
+ log.info("Notified to stop as singleton and unbound from jndi under " + jndiName);
+ }
+
+}
Property changes on: trunk/cluster/src/examples/org/jboss/ha/singleton/examples/HASingletonPojoExample.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionSticky.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionSticky.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionSticky.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,112 +1,112 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.interfaces;
-
-import org.jboss.invocation.Invocation;
-import org.jboss.logging.Logger;
-
-/**
- * Root transaction sticky load balance policy class that checks whether there's
- * a sticky target associated with the current invocation and based on that
- * returns the associated target or delegates to the given load balance policy
- * to choose a new target if there's no target associated with the invocation.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class TransactionSticky implements LoadBalancePolicy
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = -8750524198817324850L;
-
- private static final Logger log = Logger.getLogger(TransactionSticky.class);
-
- private transient boolean trace;
-
- private final LoadBalancePolicy delegateLoadBalancePolicy;
-
- public TransactionSticky(LoadBalancePolicy delegate)
- {
- delegateLoadBalancePolicy = delegate;
-
- if (trace)
- {
- log.trace("Transaction sticky load balance policy delegates to: " + delegateLoadBalancePolicy);
- }
- }
-
- /**
- * This method returns either, a new target based on RoundRobin policy, or
- * if there's a ongoing transaction, the target associated with that
- * transaction.
- *
- * @param familyClusterInfo cluster family information
- * @param invocation current invocation
- * @return a new target or the target associated with the transaction
- */
- public Object chooseTarget(FamilyClusterInfo clusterFamily, Invocation routingDecision)
- {
- trace = log.isTraceEnabled();
- Object txStickyTarget = routingDecision.getTransientValue("TX_STICKY_TARGET");
- if (txStickyTarget != null && clusterFamily.getTargets().contains(txStickyTarget))
- {
- if (trace)
- {
- log.trace("Transaction bound target exists: " + txStickyTarget);
- }
-
- return txStickyTarget;
- }
-
- return chooseNewTarget(clusterFamily, routingDecision);
- }
-
- public void init(HARMIClient father)
- {
- delegateLoadBalancePolicy.init(father);
- }
-
- public Object chooseTarget(FamilyClusterInfo clusterFamily)
- {
- return delegateLoadBalancePolicy.chooseTarget(clusterFamily);
- }
-
- /**
- * Choses a new target based on delegate load balance policy.
- *
- * @param familyClusterInfo cluster family information
- * @param invocation current invocation
- * @return a new target
- */
- protected Object chooseNewTarget(FamilyClusterInfo familyClusterInfo, Invocation invocation)
- {
- Object newTarget = delegateLoadBalancePolicy.chooseTarget(familyClusterInfo, invocation);
-
- if (trace)
- {
- log.trace("New target chosen: " + newTarget);
- }
-
- invocation.getTransientPayload().put("TX_STICKY_TARGET", newTarget);
-
- return newTarget;
- }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.framework.interfaces;
+
+import org.jboss.invocation.Invocation;
+import org.jboss.logging.Logger;
+
+/**
+ * Root transaction sticky load balance policy class that checks whether there's
+ * a sticky target associated with the current invocation and based on that
+ * returns the associated target or delegates to the given load balance policy
+ * to choose a new target if there's no target associated with the invocation.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransactionSticky implements LoadBalancePolicy
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8750524198817324850L;
+
+ private static final Logger log = Logger.getLogger(TransactionSticky.class);
+
+ private transient boolean trace;
+
+ private final LoadBalancePolicy delegateLoadBalancePolicy;
+
+ public TransactionSticky(LoadBalancePolicy delegate)
+ {
+ delegateLoadBalancePolicy = delegate;
+
+ if (trace)
+ {
+ log.trace("Transaction sticky load balance policy delegates to: " + delegateLoadBalancePolicy);
+ }
+ }
+
+ /**
+ * This method returns either, a new target based on RoundRobin policy, or
+ * if there's a ongoing transaction, the target associated with that
+ * transaction.
+ *
+ * @param familyClusterInfo cluster family information
+ * @param invocation current invocation
+ * @return a new target or the target associated with the transaction
+ */
+ public Object chooseTarget(FamilyClusterInfo clusterFamily, Invocation routingDecision)
+ {
+ trace = log.isTraceEnabled();
+ Object txStickyTarget = routingDecision.getTransientValue("TX_STICKY_TARGET");
+ if (txStickyTarget != null && clusterFamily.getTargets().contains(txStickyTarget))
+ {
+ if (trace)
+ {
+ log.trace("Transaction bound target exists: " + txStickyTarget);
+ }
+
+ return txStickyTarget;
+ }
+
+ return chooseNewTarget(clusterFamily, routingDecision);
+ }
+
+ public void init(HARMIClient father)
+ {
+ delegateLoadBalancePolicy.init(father);
+ }
+
+ public Object chooseTarget(FamilyClusterInfo clusterFamily)
+ {
+ return delegateLoadBalancePolicy.chooseTarget(clusterFamily);
+ }
+
+ /**
+ * Choses a new target based on delegate load balance policy.
+ *
+ * @param familyClusterInfo cluster family information
+ * @param invocation current invocation
+ * @return a new target
+ */
+ protected Object chooseNewTarget(FamilyClusterInfo familyClusterInfo, Invocation invocation)
+ {
+ Object newTarget = delegateLoadBalancePolicy.chooseTarget(familyClusterInfo, invocation);
+
+ if (trace)
+ {
+ log.trace("New target chosen: " + newTarget);
+ }
+
+ invocation.getTransientPayload().put("TX_STICKY_TARGET", newTarget);
+
+ return newTarget;
+ }
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionSticky.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailable.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailable.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailable.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,43 +1,43 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.interfaces;
-
-/**
- * First available transaction sticky load balance policy.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class TransactionStickyFirstAvailable extends TransactionSticky
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -8688525543058853326L;
-
- /**
- * Create a new TransactionStickyFirstAvailable.
- */
- public TransactionStickyFirstAvailable()
- {
- super(new FirstAvailable());
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.framework.interfaces;
+
+/**
+ * First available transaction sticky load balance policy.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransactionStickyFirstAvailable extends TransactionSticky
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8688525543058853326L;
+
+ /**
+ * Create a new TransactionStickyFirstAvailable.
+ */
+ public TransactionStickyFirstAvailable()
+ {
+ super(new FirstAvailable());
+ }
+
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailable.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailableIdenticalAllProxies.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailableIdenticalAllProxies.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailableIdenticalAllProxies.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,44 +1,44 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.interfaces;
-
-/**
- * First available indentical all proxies transaction sticky load balance policy.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class TransactionStickyFirstAvailableIdenticalAllProxies extends TransactionSticky
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -108026886517429364L;
-
- /**
- * Create a new TransactionStickyFirstAvailableIdenticalAllProxies.
- *
- */
- public TransactionStickyFirstAvailableIdenticalAllProxies()
- {
- super(new FirstAvailableIdenticalAllProxies());
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.framework.interfaces;
+
+/**
+ * First available indentical all proxies transaction sticky load balance policy.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransactionStickyFirstAvailableIdenticalAllProxies extends TransactionSticky
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -108026886517429364L;
+
+ /**
+ * Create a new TransactionStickyFirstAvailableIdenticalAllProxies.
+ *
+ */
+ public TransactionStickyFirstAvailableIdenticalAllProxies()
+ {
+ super(new FirstAvailableIdenticalAllProxies());
+ }
+
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyFirstAvailableIdenticalAllProxies.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRandomRobin.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRandomRobin.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRandomRobin.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,43 +1,43 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.interfaces;
-
-/**
- * Random robin transaction sticky load balace policy.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class TransactionStickyRandomRobin extends TransactionSticky
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -2684882134710754122L;
-
- /**
- * Create a new TransactionStickyRandomRobin.
- */
- public TransactionStickyRandomRobin()
- {
- super(new RandomRobin());
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.framework.interfaces;
+
+/**
+ * Random robin transaction sticky load balace policy.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransactionStickyRandomRobin extends TransactionSticky
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -2684882134710754122L;
+
+ /**
+ * Create a new TransactionStickyRandomRobin.
+ */
+ public TransactionStickyRandomRobin()
+ {
+ super(new RandomRobin());
+ }
+
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRandomRobin.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRoundRobin.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRoundRobin.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRoundRobin.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,43 +1,43 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.interfaces;
-
-/**
- * Round robin transaction sticky load balance policy
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class TransactionStickyRoundRobin extends TransactionSticky
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 8195610955344716827L;
-
- /**
- * Create a new TransactionStickyRoundRobin.
- */
- public TransactionStickyRoundRobin()
- {
- super(new RoundRobin());
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.framework.interfaces;
+
+/**
+ * Round robin transaction sticky load balance policy
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransactionStickyRoundRobin extends TransactionSticky
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 8195610955344716827L;
+
+ /**
+ * Create a new TransactionStickyRoundRobin.
+ */
+ public TransactionStickyRoundRobin()
+ {
+ super(new RoundRobin());
+ }
+
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/TransactionStickyRoundRobin.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterNodeImpl.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterNodeImpl.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterNodeImpl.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,210 +1,210 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.server;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import org.jboss.ha.framework.interfaces.ClusterNode;
-import org.jgroups.stack.IpAddress;
-
-/**
- * Replacement for a JG IpAddress that doesn't base its representation
- * on the JG address but on the computed node name added to the IPAddress instead.
- * This is to avoid any problem in the cluster as some nodes may interpret a node name
- * differently (IP resolution, name case, FQDN or host name, etc.)
- *
- * @see org.jboss.ha.framework.server.ClusterPartitionMBean
- *
- * @author <a href="mailto:sacha.labourey at jboss.org">Sacha Labourey</a>.
- * @author Brian Stansberry
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- * @version $Revision: 58561 $
- */
-
-public class ClusterNodeImpl
- implements ClusterNode
-{
- // Constants -----------------------------------------------------
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 2713397663824031616L;
-
- // Attributes ----------------------------------------------------
-
- protected final String id;
- protected String jgId = null;
- protected final IpAddress originalJGAddress;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ClusterNodeImpl(IpAddress jgAddress)
- {
- if (jgAddress.getAdditionalData() == null)
- {
- this.id = jgAddress.getIpAddress().getHostAddress() + ":" + jgAddress.getPort();
- }
- else
- {
- this.id = new String(jgAddress.getAdditionalData());
- }
-
- this.originalJGAddress = jgAddress;
- }
-
- // Public --------------------------------------------------------
-
- public String getName()
- {
- return this.id;
- }
-
- public String getJGName()
- {
- if (jgId == null)
- {
- jgId = createJGName();
- }
-
- return jgId;
- }
-
- public IpAddress getOriginalJGAddress()
- {
- return this.originalJGAddress;
- }
- public InetAddress getIpAddress()
- {
- return this.originalJGAddress.getIpAddress();
- }
- public int getPort()
- {
- return this.originalJGAddress.getPort();
- }
-
- // Comparable implementation ----------------------------------------------
-
- // Comparable implementation ----------------------------------------------
-
- public int compareTo(Object o)
- {
- if ((o == null) || !(o instanceof ClusterNodeImpl))
- throw new ClassCastException("ClusterNode.compareTo(): comparison between different classes");
-
- ClusterNodeImpl other = (ClusterNodeImpl) o;
-
- return this.id.compareTo(other.id);
- }
- // java.lang.Object overrides ---------------------------------------------------
-
- public boolean equals(Object obj)
- {
- if (obj == null || !(obj instanceof ClusterNodeImpl)) return false;
-
- ClusterNodeImpl other = (ClusterNodeImpl) obj;
- return this.id.equals(other.id);
- }
-
- public int hashCode()
- {
- return id.hashCode();
- }
-
- public String toString()
- {
- return this.getName();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- protected String getShortName(String hostname)
- {
- int index = hostname.indexOf('.');
-
- if (hostname == null) return "";
- if (index > 0 && !Character.isDigit(hostname.charAt(0)))
- return hostname.substring(0, index);
- else
- return hostname;
- }
-
- protected String createJGName()
- {
- StringBuffer sb = new StringBuffer();
- java.net.InetAddress jgIPAddr = originalJGAddress.getIpAddress();
- if (jgIPAddr == null)
- sb.append("<null>");
- else
- {
- if (jgIPAddr.isMulticastAddress())
- sb.append(jgIPAddr.getHostAddress());
- else
- sb.append(getShortName(getFastHostName(jgIPAddr)));
- }
- sb.append(":" + originalJGAddress.getPort());
-
- return sb.toString();
- }
-
- // Private -------------------------------------------------------
-
- /**
- * Tries to determine the hostname of the given InetAddress without
- * triggering a reverse DNS lookup. Tries to parse a symbolic hostname
- * from {@link InetAddress.toString()}, which is documented to return a
- * String of the form "symbolicname/ipaddress" with 'symbolicname' blank
- * if not stored in the object.
- * <p/>
- * If the symbolic name cannot be determined from InetAddress.toString(),
- * the value of {@link InetAddress.getHostAddress()} is returned.
- */
- private static String getFastHostName(InetAddress address)
- {
- String result = null;
-
- String hostAddress = address.getHostAddress();
-
- String inetAddr = address.toString();
- int idx = inetAddr.lastIndexOf('/');
- int idx1 = inetAddr.indexOf(hostAddress);
- if (idx1 == idx + 1)
- {
- if (idx == 0)
- result = hostAddress;
- else
- result = inetAddr.substring(0, idx);
- }
- else
- {
- // Doesn't follow the toString() contract!
- result = hostAddress;
- }
- return result;
- }
-
- // Inner classes -------------------------------------------------
-
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.framework.server;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.jboss.ha.framework.interfaces.ClusterNode;
+import org.jgroups.stack.IpAddress;
+
+/**
+ * Replacement for a JG IpAddress that doesn't base its representation
+ * on the JG address but on the computed node name added to the IPAddress instead.
+ * This is to avoid any problem in the cluster as some nodes may interpret a node name
+ * differently (IP resolution, name case, FQDN or host name, etc.)
+ *
+ * @see org.jboss.ha.framework.server.ClusterPartitionMBean
+ *
+ * @author <a href="mailto:sacha.labourey at jboss.org">Sacha Labourey</a>.
+ * @author Brian Stansberry
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ * @version $Revision: 58561 $
+ */
+
+public class ClusterNodeImpl
+ implements ClusterNode
+{
+ // Constants -----------------------------------------------------
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 2713397663824031616L;
+
+ // Attributes ----------------------------------------------------
+
+ protected final String id;
+ protected String jgId = null;
+ protected final IpAddress originalJGAddress;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ClusterNodeImpl(IpAddress jgAddress)
+ {
+ if (jgAddress.getAdditionalData() == null)
+ {
+ this.id = jgAddress.getIpAddress().getHostAddress() + ":" + jgAddress.getPort();
+ }
+ else
+ {
+ this.id = new String(jgAddress.getAdditionalData());
+ }
+
+ this.originalJGAddress = jgAddress;
+ }
+
+ // Public --------------------------------------------------------
+
+ public String getName()
+ {
+ return this.id;
+ }
+
+ public String getJGName()
+ {
+ if (jgId == null)
+ {
+ jgId = createJGName();
+ }
+
+ return jgId;
+ }
+
+ public IpAddress getOriginalJGAddress()
+ {
+ return this.originalJGAddress;
+ }
+ public InetAddress getIpAddress()
+ {
+ return this.originalJGAddress.getIpAddress();
+ }
+ public int getPort()
+ {
+ return this.originalJGAddress.getPort();
+ }
+
+ // Comparable implementation ----------------------------------------------
+
+ // Comparable implementation ----------------------------------------------
+
+ public int compareTo(Object o)
+ {
+ if ((o == null) || !(o instanceof ClusterNodeImpl))
+ throw new ClassCastException("ClusterNode.compareTo(): comparison between different classes");
+
+ ClusterNodeImpl other = (ClusterNodeImpl) o;
+
+ return this.id.compareTo(other.id);
+ }
+ // java.lang.Object overrides ---------------------------------------------------
+
+ public boolean equals(Object obj)
+ {
+ if (obj == null || !(obj instanceof ClusterNodeImpl)) return false;
+
+ ClusterNodeImpl other = (ClusterNodeImpl) obj;
+ return this.id.equals(other.id);
+ }
+
+ public int hashCode()
+ {
+ return id.hashCode();
+ }
+
+ public String toString()
+ {
+ return this.getName();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected String getShortName(String hostname)
+ {
+ int index = hostname.indexOf('.');
+
+ if (hostname == null) return "";
+ if (index > 0 && !Character.isDigit(hostname.charAt(0)))
+ return hostname.substring(0, index);
+ else
+ return hostname;
+ }
+
+ protected String createJGName()
+ {
+ StringBuffer sb = new StringBuffer();
+ java.net.InetAddress jgIPAddr = originalJGAddress.getIpAddress();
+ if (jgIPAddr == null)
+ sb.append("<null>");
+ else
+ {
+ if (jgIPAddr.isMulticastAddress())
+ sb.append(jgIPAddr.getHostAddress());
+ else
+ sb.append(getShortName(getFastHostName(jgIPAddr)));
+ }
+ sb.append(":" + originalJGAddress.getPort());
+
+ return sb.toString();
+ }
+
+ // Private -------------------------------------------------------
+
+ /**
+ * Tries to determine the hostname of the given InetAddress without
+ * triggering a reverse DNS lookup. Tries to parse a symbolic hostname
+ * from {@link InetAddress.toString()}, which is documented to return a
+ * String of the form "symbolicname/ipaddress" with 'symbolicname' blank
+ * if not stored in the object.
+ * <p/>
+ * If the symbolic name cannot be determined from InetAddress.toString(),
+ * the value of {@link InetAddress.getHostAddress()} is returned.
+ */
+ private static String getFastHostName(InetAddress address)
+ {
+ String result = null;
+
+ String hostAddress = address.getHostAddress();
+
+ String inetAddr = address.toString();
+ int idx = inetAddr.lastIndexOf('/');
+ int idx1 = inetAddr.indexOf(hostAddress);
+ if (idx1 == idx + 1)
+ {
+ if (idx == 0)
+ result = hostAddress;
+ else
+ result = inetAddr.substring(0, idx);
+ }
+ else
+ {
+ // Doesn't follow the toString() contract!
+ result = hostAddress;
+ }
+ return result;
+ }
+
+ // Inner classes -------------------------------------------------
+
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterNodeImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactoryMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactoryMBean.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactoryMBean.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,238 +1,238 @@
-package org.jboss.ha.framework.server;
-
-import javax.management.ObjectName;
-
-import org.jgroups.Channel;
-import org.jgroups.ChannelException;
-
-/**
- * StandardMBean interface for {@link JChannelFactory}. Based on the
- * <code>org.jgroups.jmx.JChannelFactoryMBean</code> interface, which
- * is scheduled to be removed.
- * <p>
- * The plain-old-java-interface for the channel factory is
- * <code>org.jgroups.ChannelFactory</code>; users are encouraged to dependency
- * inject a <code>org.jgroups.ChannelFactory</code>.
- *
- *
- * @author Bela Ban
- * @author Brian Stansberry
- *
- * @version $Revision: 69425 $
- */
-public interface JChannelFactoryMBean
-{
- /**
- * Returns all configurations as a string
- */
- String getMultiplexerConfig();
-
- /**
- * Instructs JGroups to load a set of XML protocol stack configurations.
- * Same as {@link #setMultiplexerConfig(String, boolean) setMultiplexerConfig(properties, true)}.
- *
- * @param properties a string representing a system resource containing a
- * JGroups XML configuration, a string representing a URL
- * pointing to a JGroups XML configuration, or a string
- * representing a file name that contains a JGroups XML
- * configuration.
- *
- * @throws Exception
- */
- void setMultiplexerConfig(String properties) throws Exception;
-
- /**
- * Instructs JGroups to load a set of XML protocol stack configurations.
- *
- * @param properties a string representing a system resource containing a
- * JGroups XML configuration, a string representing a URL
- * pointing to a JGroups XML configuration, or a string
- * representing a file name that contains a JGroups XML
- * configuration.
- * @param replace <code>true</code> if any protocol stack configuration
- * in <code>properties</code> that has the same name
- * as an existing configuration should replace that
- * existing configuration; <code>false</code> if the
- * existing configuration should take precedence.
- *
- * @throws Exception
- */
- void setMultiplexerConfig(String properties, boolean replace) throws Exception;
-
- /**
- * Gets the domain portion of any {@link ObjectName} the factory should
- * use when registering channels or protocols in JMX.
- *
- * @return the domain portion of the object name, or <code>null</code>.
- */
- String getDomain();
-
- /**
- * Sets the domain portion of any {@link ObjectName} the factory should
- * use when registering channels or protocols in JMX.
- *
- * @param name the domain portion of the object name. Must conform to
- * the rules for elements in an ObjectName.
- */
- void setDomain(String name);
-
- /**
- * Gets whether this factory should register channels it creates in JMX.
- *
- * @return <code>true</code> if channels should be registered,
- * <code>false</code> if not
- */
- boolean isExposeChannels();
-
- /**
- * Sets whether this factory should register channels it creates in JMX.
- *
- * @param flag <code>true</code> if channels should be registered,
- * <code>false</code> if not
- */
- void setExposeChannels(boolean flag);
-
- /**
- * Gets whether this factory should register protocols it creates in JMX.
- *
- * @return <code>true</code> if protocols should be registered,
- * <code>false</code> if not
- */
- boolean isExposeProtocols();
-
- /**
- * Sets whether this factory should register protocols it creates in JMX.
- *
- * @param flag <code>true</code> if protocols should be registered,
- * <code>false</code> if not
- */
- void setExposeProtocols(boolean f);
-
- /**
- * Returns the stack configuration as a string (valid to be fed into new JChannel()). Throws an exception
- * if the stack_name is not found. One of the setMultiplexerConfig() methods had to be called beforehand.
- *
- * @return The protocol stack config as a plain string
- */
- String getConfig(String stack_name) throws Exception;
-
- /**
- * Removes the given stack from the configuration.
- *
- * @param stack_name the name of the stack
- * @return <code>true</code> if the stack was removed; <code>false</code> if
- * it wasn't registered
- */
- boolean removeConfig(String stack_name);
-
- /** Removes all protocol stack configurations */
- void clearConfigurations();
-
- /**
- * Create a {@link Channel} using the specified stack. Channel will use a
- * shared transport if the <code>singleton-name</code> attribute is
- * set on the stack's transport protocol.
- *
- * @param stack_name the name of the stack
- * @return the channel
- *
- * @throws Exception
- */
- Channel createChannel(String stack_name) throws Exception;
-
- /**
- * Creates and returns a shared transport Channel configured with the specified
- * {@link #getConfig(String) protocol stack configuration}.
- * <p>
- * <emphasis>NOTE:</emphasis> The implementation of this method is somewhat
- * different from what is described in
- * {@link org.jgroups.ChannelFactory#createMultiplexerChannel(String, String)}.
- * The returned channel will not be an instance of
- * <code>org.jgroups.mux.MuxChannel</code>; rather a channel that uses a
- * shared transport will be returned. This will be the case whether or
- * not the protocol stack specified by <code>stack_name</code> includes
- * a <code>singleton_name</code> attribute in its
- * {@link org.jgroups.protocols.TP transport protocol} configuration. If no
- * <code>singleton_name</code> attribute is present, this factory will create
- * a synthetic one by prepending "unnamed_" to the provided
- * <code>id</code> param and will use that for the returned channel's
- * transport protocol. (Note this will not effect the protocol stack
- * configuration named by <code>stack_name</code>; i.e. another request
- * that passes the same <code>stack_name</code> will not inherit the
- * synthetic singleton name.)
- *
- * @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.
- * @param id Only used if the transport protocol configuration for the
- * specified stack does not include the <code>singleton_name</code>
- * attribute; then it is used to create a synthetic singleton-name
- * for the channel's protocol stack.
- *
- * @return An implementation of Channel configured with a shared transport.
- *
- * @throws ChannelException
- */
- Channel createMultiplexerChannel(String stack_name, String id) throws Exception;
-
-
- /**
- * Creates and returns a shared transport Channel configured with the specified
- * {@link #getConfig(String) protocol stack configuration}.
- *
- * See {@link #createMultiplexerChannel(String, String)}; the additional
- * attributes specified in this overloaded version of that method are ignored.
- *
- * @param register_for_state_transfer ignored in JBoss AS. Treated as <code>false</code>.
- *
- * @param substate_id ignored in JBoss AS
- *
- * @return An implementation of Channel configured with a shared transport.
- *
- * @throws ChannelException
- */
- Channel createMultiplexerChannel(String stack_name, String id, boolean register_for_state_transfer, String substate_id) throws Exception;
-
- /**
- * Execute the create phase of the 4 step lifecycle.
- *
- * @throws Exception
- */
- void create() throws Exception;
-
- /**
- * Execute the start phase of the 4 step lifecycle.
- *
- * @throws Exception
- */
- void start() throws Exception;
-
- /**
- * Execute the stop phase of the 4 step lifecycle.
- *
- * @throws Exception
- */
- void stop();
-
- /**
- * Execute the destroy phase of the 4 step lifecycle.
- *
- * @throws Exception
- */
- void destroy();
-
- /**
- * Returns the names of the currently registered protocol stack configurations.
- */
- String dumpConfiguration();
-
- /**
- * Dumps the names of any currently running multiplexer channels along with
- * the id's of any services that are using them. Information about
- * currently running non-multiplexer channels are not returned.
- */
- String dumpChannels();
-}
+package org.jboss.ha.framework.server;
+
+import javax.management.ObjectName;
+
+import org.jgroups.Channel;
+import org.jgroups.ChannelException;
+
+/**
+ * StandardMBean interface for {@link JChannelFactory}. Based on the
+ * <code>org.jgroups.jmx.JChannelFactoryMBean</code> interface, which
+ * is scheduled to be removed.
+ * <p>
+ * The plain-old-java-interface for the channel factory is
+ * <code>org.jgroups.ChannelFactory</code>; users are encouraged to dependency
+ * inject a <code>org.jgroups.ChannelFactory</code>.
+ *
+ *
+ * @author Bela Ban
+ * @author Brian Stansberry
+ *
+ * @version $Revision: 69425 $
+ */
+public interface JChannelFactoryMBean
+{
+ /**
+ * Returns all configurations as a string
+ */
+ String getMultiplexerConfig();
+
+ /**
+ * Instructs JGroups to load a set of XML protocol stack configurations.
+ * Same as {@link #setMultiplexerConfig(String, boolean) setMultiplexerConfig(properties, true)}.
+ *
+ * @param properties a string representing a system resource containing a
+ * JGroups XML configuration, a string representing a URL
+ * pointing to a JGroups XML configuration, or a string
+ * representing a file name that contains a JGroups XML
+ * configuration.
+ *
+ * @throws Exception
+ */
+ void setMultiplexerConfig(String properties) throws Exception;
+
+ /**
+ * Instructs JGroups to load a set of XML protocol stack configurations.
+ *
+ * @param properties a string representing a system resource containing a
+ * JGroups XML configuration, a string representing a URL
+ * pointing to a JGroups XML configuration, or a string
+ * representing a file name that contains a JGroups XML
+ * configuration.
+ * @param replace <code>true</code> if any protocol stack configuration
+ * in <code>properties</code> that has the same name
+ * as an existing configuration should replace that
+ * existing configuration; <code>false</code> if the
+ * existing configuration should take precedence.
+ *
+ * @throws Exception
+ */
+ void setMultiplexerConfig(String properties, boolean replace) throws Exception;
+
+ /**
+ * Gets the domain portion of any {@link ObjectName} the factory should
+ * use when registering channels or protocols in JMX.
+ *
+ * @return the domain portion of the object name, or <code>null</code>.
+ */
+ String getDomain();
+
+ /**
+ * Sets the domain portion of any {@link ObjectName} the factory should
+ * use when registering channels or protocols in JMX.
+ *
+ * @param name the domain portion of the object name. Must conform to
+ * the rules for elements in an ObjectName.
+ */
+ void setDomain(String name);
+
+ /**
+ * Gets whether this factory should register channels it creates in JMX.
+ *
+ * @return <code>true</code> if channels should be registered,
+ * <code>false</code> if not
+ */
+ boolean isExposeChannels();
+
+ /**
+ * Sets whether this factory should register channels it creates in JMX.
+ *
+ * @param flag <code>true</code> if channels should be registered,
+ * <code>false</code> if not
+ */
+ void setExposeChannels(boolean flag);
+
+ /**
+ * Gets whether this factory should register protocols it creates in JMX.
+ *
+ * @return <code>true</code> if protocols should be registered,
+ * <code>false</code> if not
+ */
+ boolean isExposeProtocols();
+
+ /**
+ * Sets whether this factory should register protocols it creates in JMX.
+ *
+ * @param flag <code>true</code> if protocols should be registered,
+ * <code>false</code> if not
+ */
+ void setExposeProtocols(boolean f);
+
+ /**
+ * Returns the stack configuration as a string (valid to be fed into new JChannel()). Throws an exception
+ * if the stack_name is not found. One of the setMultiplexerConfig() methods had to be called beforehand.
+ *
+ * @return The protocol stack config as a plain string
+ */
+ String getConfig(String stack_name) throws Exception;
+
+ /**
+ * Removes the given stack from the configuration.
+ *
+ * @param stack_name the name of the stack
+ * @return <code>true</code> if the stack was removed; <code>false</code> if
+ * it wasn't registered
+ */
+ boolean removeConfig(String stack_name);
+
+ /** Removes all protocol stack configurations */
+ void clearConfigurations();
+
+ /**
+ * Create a {@link Channel} using the specified stack. Channel will use a
+ * shared transport if the <code>singleton-name</code> attribute is
+ * set on the stack's transport protocol.
+ *
+ * @param stack_name the name of the stack
+ * @return the channel
+ *
+ * @throws Exception
+ */
+ Channel createChannel(String stack_name) throws Exception;
+
+ /**
+ * Creates and returns a shared transport Channel configured with the specified
+ * {@link #getConfig(String) protocol stack configuration}.
+ * <p>
+ * <emphasis>NOTE:</emphasis> The implementation of this method is somewhat
+ * different from what is described in
+ * {@link org.jgroups.ChannelFactory#createMultiplexerChannel(String, String)}.
+ * The returned channel will not be an instance of
+ * <code>org.jgroups.mux.MuxChannel</code>; rather a channel that uses a
+ * shared transport will be returned. This will be the case whether or
+ * not the protocol stack specified by <code>stack_name</code> includes
+ * a <code>singleton_name</code> attribute in its
+ * {@link org.jgroups.protocols.TP transport protocol} configuration. If no
+ * <code>singleton_name</code> attribute is present, this factory will create
+ * a synthetic one by prepending "unnamed_" to the provided
+ * <code>id</code> param and will use that for the returned channel's
+ * transport protocol. (Note this will not effect the protocol stack
+ * configuration named by <code>stack_name</code>; i.e. another request
+ * that passes the same <code>stack_name</code> will not inherit the
+ * synthetic singleton name.)
+ *
+ * @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.
+ * @param id Only used if the transport protocol configuration for the
+ * specified stack does not include the <code>singleton_name</code>
+ * attribute; then it is used to create a synthetic singleton-name
+ * for the channel's protocol stack.
+ *
+ * @return An implementation of Channel configured with a shared transport.
+ *
+ * @throws ChannelException
+ */
+ Channel createMultiplexerChannel(String stack_name, String id) throws Exception;
+
+
+ /**
+ * Creates and returns a shared transport Channel configured with the specified
+ * {@link #getConfig(String) protocol stack configuration}.
+ *
+ * See {@link #createMultiplexerChannel(String, String)}; the additional
+ * attributes specified in this overloaded version of that method are ignored.
+ *
+ * @param register_for_state_transfer ignored in JBoss AS. Treated as <code>false</code>.
+ *
+ * @param substate_id ignored in JBoss AS
+ *
+ * @return An implementation of Channel configured with a shared transport.
+ *
+ * @throws ChannelException
+ */
+ Channel createMultiplexerChannel(String stack_name, String id, boolean register_for_state_transfer, String substate_id) throws Exception;
+
+ /**
+ * Execute the create phase of the 4 step lifecycle.
+ *
+ * @throws Exception
+ */
+ void create() throws Exception;
+
+ /**
+ * Execute the start phase of the 4 step lifecycle.
+ *
+ * @throws Exception
+ */
+ void start() throws Exception;
+
+ /**
+ * Execute the stop phase of the 4 step lifecycle.
+ *
+ * @throws Exception
+ */
+ void stop();
+
+ /**
+ * Execute the destroy phase of the 4 step lifecycle.
+ *
+ * @throws Exception
+ */
+ void destroy();
+
+ /**
+ * Returns the names of the currently registered protocol stack configurations.
+ */
+ String dumpConfiguration();
+
+ /**
+ * Dumps the names of any currently running multiplexer channels along with
+ * the id's of any services that are using them. Information about
+ * currently running non-multiplexer channels are not returned.
+ */
+ String dumpChannels();
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/server/JChannelFactoryMBean.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/RspFilterAdapter.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/RspFilterAdapter.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/RspFilterAdapter.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,53 +1,53 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.framework.server;
-
-import org.jboss.ha.framework.interfaces.ResponseFilter;
-import org.jgroups.Address;
-import org.jgroups.blocks.RspFilter;
-import org.jgroups.stack.IpAddress;
-
-/**
- * JGroups RspFilter adapter class that delegates work to ResponseFilter,
- * Cluster abstraction of RspFilter.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class RspFilterAdapter implements RspFilter
-{
- private ResponseFilter filter;
-
- public RspFilterAdapter(ResponseFilter filter)
- {
- this.filter = filter;
- }
-
- public boolean isAcceptable(Object response, Address sender)
- {
- return filter.isAcceptable(response, new ClusterNodeImpl((IpAddress)sender));
- }
-
- public boolean needMoreResponses()
- {
- return filter.needMoreResponses();
- }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.framework.server;
+
+import org.jboss.ha.framework.interfaces.ResponseFilter;
+import org.jgroups.Address;
+import org.jgroups.blocks.RspFilter;
+import org.jgroups.stack.IpAddress;
+
+/**
+ * JGroups RspFilter adapter class that delegates work to ResponseFilter,
+ * Cluster abstraction of RspFilter.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class RspFilterAdapter implements RspFilter
+{
+ private ResponseFilter filter;
+
+ public RspFilterAdapter(ResponseFilter filter)
+ {
+ this.filter = filter;
+ }
+
+ public boolean isAcceptable(Object response, Address sender)
+ {
+ return filter.isAcceptable(response, new ClusterNodeImpl((IpAddress)sender));
+ }
+
+ public boolean needMoreResponses()
+ {
+ return filter.needMoreResponses();
+ }
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/server/RspFilterAdapter.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/AbstractHAPartitionDependencyDeployer.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/AbstractHAPartitionDependencyDeployer.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/AbstractHAPartitionDependencyDeployer.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,88 +1,88 @@
-package org.jboss.ha.framework.server.deployers;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.ejb.deployers.MergedJBossMetaDataDeployer;
-import org.jboss.metadata.ejb.jboss.ClusterConfigMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-
-public abstract class AbstractHAPartitionDependencyDeployer extends AbstractDeployer
-{
-
- private HAPartitionDependencyCreator dependencyCreator;
-
- public AbstractHAPartitionDependencyDeployer()
- {
- super();
- addInput(MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME);
- addOutput(MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME);
- setStage(DeploymentStages.POST_CLASSLOADER);
- }
-
- public synchronized HAPartitionDependencyCreator getHaPartitionDependencyCreator()
- {
- if (dependencyCreator == null)
- {
- dependencyCreator = DefaultHAPartitionDependencyCreator.INSTANCE;
- }
- return dependencyCreator;
- }
-
- public synchronized void setHaPartitionDependencyCreator(HAPartitionDependencyCreator dependencyCreator)
- {
- this.dependencyCreator = dependencyCreator;
- }
-
- /**
- * Adds the dependency to relevant metadata.
- *
- * {@inheritDoc}
- */
- public void deploy(DeploymentUnit unit) throws DeploymentException
- {
- JBossMetaData metaData = unit.getAttachment(MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME, JBossMetaData.class);
- if (metaData != null && accepts(metaData))
- {
- JBossEnterpriseBeansMetaData beans = metaData.getEnterpriseBeans();
- if (beans != null)
- {
- for (Iterator<JBossEnterpriseBeanMetaData> it = beans.iterator(); it.hasNext(); )
- {
- JBossEnterpriseBeanMetaData bmd = it.next();
- ClusterConfigMetaData ccmd = getClusteredBeanClusterConfig(bmd);
- if (ccmd != null)
- {
- addHAPartitionDependency(bmd, ccmd);
- }
- }
- }
- }
- }
-
- protected abstract boolean accepts(JBossMetaData metaData);
-
- protected abstract void configureDeploymentStage();
-
- protected abstract ClusterConfigMetaData getClusteredBeanClusterConfig(JBossEnterpriseBeanMetaData bmd);
-
- private void addHAPartitionDependency(JBossEnterpriseBeanMetaData bmd, ClusterConfigMetaData ccmd)
- {
- String dependencyName = getHaPartitionDependencyCreator().getHAPartitionDependencyName(ccmd.getPartitionName());
- Set<String> depends = bmd.getDepends();
- if (depends == null)
- {
- depends = new HashSet<String>();
- }
- depends.add(dependencyName);
- bmd.setDepends(depends);
- }
-
+package org.jboss.ha.framework.server.deployers;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb.deployers.MergedJBossMetaDataDeployer;
+import org.jboss.metadata.ejb.jboss.ClusterConfigMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+
+public abstract class AbstractHAPartitionDependencyDeployer extends AbstractDeployer
+{
+
+ private HAPartitionDependencyCreator dependencyCreator;
+
+ public AbstractHAPartitionDependencyDeployer()
+ {
+ super();
+ addInput(MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME);
+ addOutput(MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME);
+ setStage(DeploymentStages.POST_CLASSLOADER);
+ }
+
+ public synchronized HAPartitionDependencyCreator getHaPartitionDependencyCreator()
+ {
+ if (dependencyCreator == null)
+ {
+ dependencyCreator = DefaultHAPartitionDependencyCreator.INSTANCE;
+ }
+ return dependencyCreator;
+ }
+
+ public synchronized void setHaPartitionDependencyCreator(HAPartitionDependencyCreator dependencyCreator)
+ {
+ this.dependencyCreator = dependencyCreator;
+ }
+
+ /**
+ * Adds the dependency to relevant metadata.
+ *
+ * {@inheritDoc}
+ */
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ JBossMetaData metaData = unit.getAttachment(MergedJBossMetaDataDeployer.EJB_MERGED_ATTACHMENT_NAME, JBossMetaData.class);
+ if (metaData != null && accepts(metaData))
+ {
+ JBossEnterpriseBeansMetaData beans = metaData.getEnterpriseBeans();
+ if (beans != null)
+ {
+ for (Iterator<JBossEnterpriseBeanMetaData> it = beans.iterator(); it.hasNext(); )
+ {
+ JBossEnterpriseBeanMetaData bmd = it.next();
+ ClusterConfigMetaData ccmd = getClusteredBeanClusterConfig(bmd);
+ if (ccmd != null)
+ {
+ addHAPartitionDependency(bmd, ccmd);
+ }
+ }
+ }
+ }
+ }
+
+ protected abstract boolean accepts(JBossMetaData metaData);
+
+ protected abstract void configureDeploymentStage();
+
+ protected abstract ClusterConfigMetaData getClusteredBeanClusterConfig(JBossEnterpriseBeanMetaData bmd);
+
+ private void addHAPartitionDependency(JBossEnterpriseBeanMetaData bmd, ClusterConfigMetaData ccmd)
+ {
+ String dependencyName = getHaPartitionDependencyCreator().getHAPartitionDependencyName(ccmd.getPartitionName());
+ Set<String> depends = bmd.getDepends();
+ if (depends == null)
+ {
+ depends = new HashSet<String>();
+ }
+ depends.add(dependencyName);
+ bmd.setDepends(depends);
+ }
+
}
\ No newline at end of file
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/AbstractHAPartitionDependencyDeployer.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/DefaultHAPartitionDependencyCreator.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/DefaultHAPartitionDependencyCreator.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/DefaultHAPartitionDependencyCreator.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,120 +1,120 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.ha.framework.server.deployers;
-
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.ClusterConfigMetaData;
-import org.jboss.util.StringPropertyReplacer;
-
-/**
- * Default impl of {@link HAPartitionDependencyCreator}. Prepends a configurable
- * prefix to the system-property-replaced partition name.
- *
- * @author Brian Stansberry
- */
-public class DefaultHAPartitionDependencyCreator implements HAPartitionDependencyCreator
-{
- private static final Logger log = Logger.getLogger(DefaultHAPartitionDependencyCreator.class);
-
- public static final String DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX = "partition:partitionName=";
-
- /** Shared instance, although this isn't a singleton */
- public static final DefaultHAPartitionDependencyCreator INSTANCE = new DefaultHAPartitionDependencyCreator();
-
- private final String prefix;
-
- // ----------------------------------------------------------- Constructors
-
- /**
- * Create a new DefaultHAPartitionDependencyCreator using the
- * {@link #DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX default prefix}.
- */
- public DefaultHAPartitionDependencyCreator()
- {
- this(DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX);
- }
-
- /**
- * Create a new DefaultHAPartitionDependencyCreator.
- *
- * @param prefix the string that should be prepended to
- * {@link ClusterConfigMetaData#getPartitionName() the bean metadata's partition name}
- * to determine the name of the dependency.
- */
- public DefaultHAPartitionDependencyCreator(String prefix)
- {
- if (prefix == null)
- throw new IllegalArgumentException("prefix cannot be null");
-
- this.prefix = prefix;
- }
-
- // ------------------------------------------- HAPartitionDependencyCreator
-
- public String getHAPartitionDependencyName(String partitionName)
- {
- return getHaPartitionDependencyPrefix() + getPropertyReplacedPartitionName(partitionName);
- }
-
- // ------------------------------------------------------------- Properties
-
- /**
- * Gets the string that should be prepended to
- * {@link ClusterConfigMetaData#getPartitionName() the bean metadata's partition name}
- * to determine the name of the dependency.
- * <p>
- * <code>ClusterPartition</code> will also use the property to determine
- * the name of a microcontainer alias to itself, which it will register
- * in order to satisfy the dependency.
- * </p>
- *
- * @return the prefix, or {@link #DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX} if
- * not configured.
- */
- public String getHaPartitionDependencyPrefix()
- {
- return prefix == null ? DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX : prefix;
- }
-
-
- private static String getPropertyReplacedPartitionName(String partitionName)
- {
- String value = partitionName;
- try
- {
- String replacedValue = StringPropertyReplacer.replaceProperties(value);
- if (value != replacedValue)
- {
- log.debug("Replacing " + ClusterConfigMetaData.class.getSimpleName() +
- " partitionName property " + value + " with " + replacedValue);
- value = replacedValue;
- }
- }
- catch (Exception e)
- {
- log.warn("Unable to replace partition name " + value, e);
- }
-
- return value;
- }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ha.framework.server.deployers;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.ClusterConfigMetaData;
+import org.jboss.util.StringPropertyReplacer;
+
+/**
+ * Default impl of {@link HAPartitionDependencyCreator}. Prepends a configurable
+ * prefix to the system-property-replaced partition name.
+ *
+ * @author Brian Stansberry
+ */
+public class DefaultHAPartitionDependencyCreator implements HAPartitionDependencyCreator
+{
+ private static final Logger log = Logger.getLogger(DefaultHAPartitionDependencyCreator.class);
+
+ public static final String DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX = "partition:partitionName=";
+
+ /** Shared instance, although this isn't a singleton */
+ public static final DefaultHAPartitionDependencyCreator INSTANCE = new DefaultHAPartitionDependencyCreator();
+
+ private final String prefix;
+
+ // ----------------------------------------------------------- Constructors
+
+ /**
+ * Create a new DefaultHAPartitionDependencyCreator using the
+ * {@link #DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX default prefix}.
+ */
+ public DefaultHAPartitionDependencyCreator()
+ {
+ this(DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX);
+ }
+
+ /**
+ * Create a new DefaultHAPartitionDependencyCreator.
+ *
+ * @param prefix the string that should be prepended to
+ * {@link ClusterConfigMetaData#getPartitionName() the bean metadata's partition name}
+ * to determine the name of the dependency.
+ */
+ public DefaultHAPartitionDependencyCreator(String prefix)
+ {
+ if (prefix == null)
+ throw new IllegalArgumentException("prefix cannot be null");
+
+ this.prefix = prefix;
+ }
+
+ // ------------------------------------------- HAPartitionDependencyCreator
+
+ public String getHAPartitionDependencyName(String partitionName)
+ {
+ return getHaPartitionDependencyPrefix() + getPropertyReplacedPartitionName(partitionName);
+ }
+
+ // ------------------------------------------------------------- Properties
+
+ /**
+ * Gets the string that should be prepended to
+ * {@link ClusterConfigMetaData#getPartitionName() the bean metadata's partition name}
+ * to determine the name of the dependency.
+ * <p>
+ * <code>ClusterPartition</code> will also use the property to determine
+ * the name of a microcontainer alias to itself, which it will register
+ * in order to satisfy the dependency.
+ * </p>
+ *
+ * @return the prefix, or {@link #DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX} if
+ * not configured.
+ */
+ public String getHaPartitionDependencyPrefix()
+ {
+ return prefix == null ? DEFAULT_HA_PARTITION_DEPENDENCY_PREFIX : prefix;
+ }
+
+
+ private static String getPropertyReplacedPartitionName(String partitionName)
+ {
+ String value = partitionName;
+ try
+ {
+ String replacedValue = StringPropertyReplacer.replaceProperties(value);
+ if (value != replacedValue)
+ {
+ log.debug("Replacing " + ClusterConfigMetaData.class.getSimpleName() +
+ " partitionName property " + value + " with " + replacedValue);
+ value = replacedValue;
+ }
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to replace partition name " + value, e);
+ }
+
+ return value;
+ }
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/DefaultHAPartitionDependencyCreator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb2HAPartitionDependencyDeployer.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb2HAPartitionDependencyDeployer.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb2HAPartitionDependencyDeployer.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,84 +1,84 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.ha.framework.server.deployers;
-
-
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.metadata.ejb.jboss.ClusterConfigMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-
-/**
- * Adds a dependency on the HAPartition to any JBossSessionBeanMetaData
- * whose <code>isClustered</code> returns <code>true</code>.
- *
- * @author Brian Stansberry
- * @version $Revision : $
- */
-public class Ejb2HAPartitionDependencyDeployer extends AbstractHAPartitionDependencyDeployer
-{
- /**
- * Create a new Ejb2HAPartitionDependencyDeployer.
- *
- */
- public Ejb2HAPartitionDependencyDeployer()
- {
- super();
- }
-
- // ------------------------------------------------------------- Properties
-
- @Override
- protected boolean accepts(JBossMetaData metaData)
- {
- return !metaData.isEJB3x();
- }
-
- protected void configureDeploymentStage()
- {
- setStage(DeploymentStages.PRE_DESCRIBE);
- }
-
- protected ClusterConfigMetaData getClusteredBeanClusterConfig(JBossEnterpriseBeanMetaData bmd)
- {
- if (bmd instanceof JBossSessionBeanMetaData)
- {
- JBossSessionBeanMetaData sbmd = (JBossSessionBeanMetaData) bmd;
- if (sbmd.isClustered())
- {
- return sbmd.getClusterConfig();
- }
- }
- else if (bmd instanceof JBossEntityBeanMetaData)
- {
- JBossEntityBeanMetaData ebmd = (JBossEntityBeanMetaData) bmd;
- if (ebmd.isClustered())
- {
- return ebmd.getClusterConfig();
- }
- }
- return null;
- }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ha.framework.server.deployers;
+
+
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.metadata.ejb.jboss.ClusterConfigMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * Adds a dependency on the HAPartition to any JBossSessionBeanMetaData
+ * whose <code>isClustered</code> returns <code>true</code>.
+ *
+ * @author Brian Stansberry
+ * @version $Revision : $
+ */
+public class Ejb2HAPartitionDependencyDeployer extends AbstractHAPartitionDependencyDeployer
+{
+ /**
+ * Create a new Ejb2HAPartitionDependencyDeployer.
+ *
+ */
+ public Ejb2HAPartitionDependencyDeployer()
+ {
+ super();
+ }
+
+ // ------------------------------------------------------------- Properties
+
+ @Override
+ protected boolean accepts(JBossMetaData metaData)
+ {
+ return !metaData.isEJB3x();
+ }
+
+ protected void configureDeploymentStage()
+ {
+ setStage(DeploymentStages.PRE_DESCRIBE);
+ }
+
+ protected ClusterConfigMetaData getClusteredBeanClusterConfig(JBossEnterpriseBeanMetaData bmd)
+ {
+ if (bmd instanceof JBossSessionBeanMetaData)
+ {
+ JBossSessionBeanMetaData sbmd = (JBossSessionBeanMetaData) bmd;
+ if (sbmd.isClustered())
+ {
+ return sbmd.getClusterConfig();
+ }
+ }
+ else if (bmd instanceof JBossEntityBeanMetaData)
+ {
+ JBossEntityBeanMetaData ebmd = (JBossEntityBeanMetaData) bmd;
+ if (ebmd.isClustered())
+ {
+ return ebmd.getClusterConfig();
+ }
+ }
+ return null;
+ }
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb2HAPartitionDependencyDeployer.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb3HAPartitionDependencyDeployer.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb3HAPartitionDependencyDeployer.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb3HAPartitionDependencyDeployer.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,84 +1,84 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.ha.framework.server.deployers;
-
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.metadata.ejb.jboss.ClusterConfigMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-
-/**
- * @author Brian Stansberry
- *
- */
-public class Ejb3HAPartitionDependencyDeployer extends AbstractHAPartitionDependencyDeployer
-{
-
- /**
- * Create a new Ejb3HAPartitionDependencyDeployer.
- *
- */
- public Ejb3HAPartitionDependencyDeployer()
- {
- super();
- }
-
- @Override
- protected boolean accepts(JBossMetaData metaData)
- {
- return metaData.isEJB3x();
- }
-
- /**
- * Overrides the superclass to run in PRE_REAL as the merge of annotation
- * metadata and xml metadata only occurs in POST_CLASSLOADER.
- */
- @Override
- protected void configureDeploymentStage()
- {
- setStage(DeploymentStages.PRE_REAL);
- }
-
- /**
- * FIXME: use superclass behavior when JBMETA-100 is fixed.
- */
- @Override
- protected ClusterConfigMetaData getClusteredBeanClusterConfig(JBossEnterpriseBeanMetaData bmd)
- {
- if (bmd instanceof JBossSessionBeanMetaData)
- {
- JBossSessionBeanMetaData sbmd = (JBossSessionBeanMetaData) bmd;
- return sbmd.getClusterConfig();
- }
- else if (bmd instanceof JBossEntityBeanMetaData)
- {
- JBossEntityBeanMetaData ebmd = (JBossEntityBeanMetaData) bmd;
- return ebmd.getClusterConfig();
- }
- return null;
- }
-
-
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ha.framework.server.deployers;
+
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.metadata.ejb.jboss.ClusterConfigMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEntityBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class Ejb3HAPartitionDependencyDeployer extends AbstractHAPartitionDependencyDeployer
+{
+
+ /**
+ * Create a new Ejb3HAPartitionDependencyDeployer.
+ *
+ */
+ public Ejb3HAPartitionDependencyDeployer()
+ {
+ super();
+ }
+
+ @Override
+ protected boolean accepts(JBossMetaData metaData)
+ {
+ return metaData.isEJB3x();
+ }
+
+ /**
+ * Overrides the superclass to run in PRE_REAL as the merge of annotation
+ * metadata and xml metadata only occurs in POST_CLASSLOADER.
+ */
+ @Override
+ protected void configureDeploymentStage()
+ {
+ setStage(DeploymentStages.PRE_REAL);
+ }
+
+ /**
+ * FIXME: use superclass behavior when JBMETA-100 is fixed.
+ */
+ @Override
+ protected ClusterConfigMetaData getClusteredBeanClusterConfig(JBossEnterpriseBeanMetaData bmd)
+ {
+ if (bmd instanceof JBossSessionBeanMetaData)
+ {
+ JBossSessionBeanMetaData sbmd = (JBossSessionBeanMetaData) bmd;
+ return sbmd.getClusterConfig();
+ }
+ else if (bmd instanceof JBossEntityBeanMetaData)
+ {
+ JBossEntityBeanMetaData ebmd = (JBossEntityBeanMetaData) bmd;
+ return ebmd.getClusterConfig();
+ }
+ return null;
+ }
+
+
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/Ejb3HAPartitionDependencyDeployer.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/HAPartitionDependencyCreator.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/HAPartitionDependencyCreator.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/HAPartitionDependencyCreator.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,43 +1,43 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.ha.framework.server.deployers;
-
-/**
- * Policy for creating an MC bean name from a partition name. Bean name
- * can be added as a dependency to metadata for deployments that use
- * the specified partition.
- *
- * @author Brian Stansberry
- *
- */
-public interface HAPartitionDependencyCreator
-{
- /**
- * Gets the MC bean name upon which a bean using the given partition
- * can depend.
- *
- * @param partitionName the partition name. Cannot be <code>null</code>
- * @return the bean name
- */
- String getHAPartitionDependencyName(String partitionName);
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ha.framework.server.deployers;
+
+/**
+ * Policy for creating an MC bean name from a partition name. Bean name
+ * can be added as a dependency to metadata for deployments that use
+ * the specified partition.
+ *
+ * @author Brian Stansberry
+ *
+ */
+public interface HAPartitionDependencyCreator
+{
+ /**
+ * Gets the MC bean name upon which a bean using the given partition
+ * can depend.
+ *
+ * @param partitionName the partition name. Cannot be <code>null</code>
+ * @return the bean name
+ */
+ String getHAPartitionDependencyName(String partitionName);
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/framework/server/deployers/HAPartitionDependencyCreator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/jmx/AbstractHAServiceMBeanSupport.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/jmx/AbstractHAServiceMBeanSupport.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/jmx/AbstractHAServiceMBeanSupport.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,406 +1,406 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.jmx;
-
-import java.io.Serializable;
-import java.util.List;
-
-import javax.management.AttributeChangeNotification;
-import javax.management.Notification;
-import javax.management.ObjectName;
-
-import org.jboss.beans.metadata.api.annotations.Inject;
-import org.jboss.beans.metadata.api.model.FromContext;
-import org.jboss.ha.framework.interfaces.DistributedState;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.ha.framework.interfaces.HAService;
-import org.jboss.ha.framework.server.ClusterPartitionMBean;
-import org.jboss.ha.framework.server.EventFacility;
-import org.jboss.ha.framework.server.EventFactory;
-import org.jboss.system.ServiceMBeanSupport;
-
-/**
- * Abstract implementation of HAServiceMBean for use by subclasses, e.g. {@link org.jboss.ha.singleton.HASingletonSupport}.
- *
- * @param S the class of the HAService delegate
- * @author Paul Ferraro
- */
- at SuppressWarnings("deprecation")
-public abstract class AbstractHAServiceMBeanSupport<S extends HAService<Notification>>
- extends ServiceMBeanSupport
- implements HAServiceMBean, HAService<Notification>, EventFactory<Notification>, EventFacility<Notification>
-{
- private final S service = this.createHAService();
-
- private volatile boolean sendLocalLifecycleNotifications = true;
- private volatile boolean sendRemoteLifecycleNotifications = true;
-
- /**
- * Defines the object used to delegate service methods.
- * @return an {@link HAService} delegate
- */
- protected abstract S createHAService();
-
- /**
- * @return the object created by {@link #createHAService()}.
- */
- protected final S getHAService()
- {
- return this.service;
- }
-
- // Public --------------------------------------------------------
-
- public HAPartition getHAPartition()
- {
- return this.service.getHAPartition();
- }
-
- public void setHAPartition(HAPartition partition)
- {
- this.service.setHAPartition(partition);
- }
-
- public void setClusterPartition(ClusterPartitionMBean clusterPartition)
- {
- if ((this.getState() != STARTED) && (this.getState() != STARTING))
- {
- this.service.setHAPartition(clusterPartition.getHAPartition());
- }
- }
-
- public String getPartitionName()
- {
- return this.service.getHAPartition().getPartitionName();
- }
-
- public boolean isRegisterThreadContextClassLoader()
- {
- return this.service.isRegisterThreadContextClassLoader();
- }
-
- public void setRegisterThreadContextClassLoader(boolean register)
- {
- this.service.setRegisterThreadContextClassLoader(register);
- }
-
- public String getHAServiceKey()
- {
- return this.service.getHAServiceKey();
- }
-
- // Protected ------------------------------
-
- /**
- *
- *
- * Convenience method for sharing state across a cluster partition.
- * Delegates to the DistributedStateService
- *
- * @param key key for the distributed object
- * @param value the distributed object
- *
- */
- public void setDistributedState(String key, Serializable value) throws Exception
- {
- DistributedState ds = this.getHAPartition().getDistributedStateService();
- ds.set(this.getHAServiceKey(), key, value);
- }
-
- /**
- *
- * Convenience method for sharing state across a cluster partition.
- * Delegates to the DistributedStateService
- *
- * @param key key for the distributed object
- * @return Serializable the distributed object
- *
- */
- public Serializable getDistributedState(String key)
- {
- DistributedState ds = this.getHAPartition().getDistributedStateService();
- return ds.get(this.getHAServiceKey(), key);
- }
-
- /**
- * @see org.jboss.system.ServiceMBeanSupport#createService()
- */
- @Override
- protected void createService() throws Exception
- {
- this.service.create();
- }
-
- /**
- * <p>
- * Implementors of this method should not
- * code the singleton logic here.
- * The MBean lifecycle create/start/stop are separate from
- * the singleton logic.
- * Singleton logic should originate in becomeMaster().
- * </p>
- *
- * <p>
- * <b>Attention</b>: Always call this method when you overwrite it in a subclass
- * because it elects the master singleton node.
- * </p>
- *
- */
- @Override
- protected void startService() throws Exception
- {
- this.log.debug("start HAServiceMBeanSupport");
-
- if (this.getHAPartition() == null)
- {
- throw new IllegalStateException("HAPartition property must be set before starting HAServiceMBeanSupport");
- }
-
- this.setupPartition();
-
- this.service.start();
- }
-
- /**
- * <p>
- * <b>Attention</b>: Always call this method when you overwrite it in a subclass
- * </p>
- *
- */
- @Override
- protected void stopService() throws Exception
- {
- this.log.debug("stop HAServiceMBeanSupport");
-
- this.service.stop();
- }
-
- /**
- * @see org.jboss.system.ServiceMBeanSupport#destroyService()
- */
- @Override
- protected void destroyService() throws Exception
- {
- this.service.destroy();
- }
-
- protected void setupPartition() throws Exception
- {
- // method no longer used by base implementation
- }
-
- @SuppressWarnings("unchecked")
- public List callMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
- {
- return this.getHAPartition().callMethodOnCluster(this.getHAServiceKey(), methodName, args, types, true);
- }
-
- @SuppressWarnings("unchecked")
- protected void callAsyncMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
- {
- this.getHAPartition().callAsynchMethodOnCluster(this.getHAServiceKey(), methodName, args, types, true);
- }
-
- /**
- * Gets whether JMX Notifications should be sent to local (same JVM) listeners
- * if the notification is for an attribute change to attribute "State".
- * <p>
- * Default is <code>true</code>.
- * </p>
- * @see #sendNotification(Notification)
- */
- public boolean getSendLocalLifecycleNotifications()
- {
- return this.sendLocalLifecycleNotifications;
- }
-
- /**
- * Sets whether JMX Notifications should be sent to local (same JVM) listeners
- * if the notification is for an attribute change to attribute "State".
- * <p>
- * Default is <code>true</code>.
- * </p>
- * @see #sendNotification(Notification)
- */
- public void setSendLocalLifecycleNotifications(boolean sendLocalLifecycleNotifications)
- {
- this.sendLocalLifecycleNotifications = sendLocalLifecycleNotifications;
- }
-
- /**
- * Gets whether JMX Notifications should be sent to remote listeners
- * if the notification is for an attribute change to attribute "State".
- * <p>
- * Default is <code>true</code>.
- * </p>
- * <p>
- * See http://jira.jboss.com/jira/browse/JBAS-3194 for an example of a
- * use case where this property should be set to false.
- * </p>
- *
- * @see #sendNotification(Notification)
- */
- public boolean getSendRemoteLifecycleNotifications()
- {
- return this.sendRemoteLifecycleNotifications;
- }
-
- /**
- * Sets whether JMX Notifications should be sent to remote listeners
- * if the notification is for an attribute change to attribute "State".
- * <p>
- * Default is <code>true</code>.
- * </p>
- * <p>
- * See http://jira.jboss.com/jira/browse/JBAS-3194 for an example of a
- * use case where this property should be set to false.
- * </p>
- *
- * @see #sendNotification(Notification)
- */
- public void setSendRemoteLifecycleNotifications(boolean sendRemoteLifecycleNotifications)
- {
- this.sendRemoteLifecycleNotifications = sendRemoteLifecycleNotifications;
- }
-
- /**
- * Broadcast the notification to the remote listener nodes (if any) and then
- * invoke super.sendNotification() to notify local listeners.
- *
- * @param notification sent out to local listeners and other nodes. It should be serializable.
- * It is recommended that the source of the notification is an ObjectName of an MBean that
- * is is available on all nodes where the broadcaster MBean is registered.
- *
- * @see #getSendLocalLifecycleNotifications()
- * @see #getSendRemoteLifecycleNotifications()
- * @see javax.management.NotificationBroadcasterSupport#sendNotification(Notification)
- * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#sendNotification(javax.management.Notification)
- */
- public void sendNotification(Notification notification)
- {
- boolean stateChange = (notification instanceof AttributeChangeNotification) ? "State".equals(((AttributeChangeNotification) notification).getAttributeName()) : false;
-
- if (!stateChange || this.sendRemoteLifecycleNotifications)
- {
- try
- {
- this.sendNotificationRemote(notification);
- }
- catch (Throwable e)
- {
- // even if broadcast failed, local notification should still be sent
- this.log.warn("handleNotification( " + notification + " ) failed ", e);
- }
- }
-
- if (!stateChange || this.sendLocalLifecycleNotifications)
- {
- this.sendNotificationToLocalListeners(notification);
- }
- }
-
- /**
- *
- * Broadcast a notifcation remotely to the partition participants
- *
- * @param notification
- */
- protected void sendNotificationRemote(Notification notification) throws Exception
- {
- // Overriding the source MBean with its ObjectName
- // to ensure that it can be safely transferred over the wire
- notification.setSource(this.getServiceName());
-
- this.handleEvent(notification);
- }
-
- protected void sendNotificationToLocalListeners(Notification notification)
- {
- this.notifyListeners(notification);
- }
-
- /**
- * @see org.jboss.ha.framework.server.EventFacility#notifyListeners(java.util.EventObject)
- */
- public void notifyListeners(Notification notification)
- {
- super.sendNotification(notification);
- }
-
- /**
- * @see org.jboss.ha.framework.interfaces.EventListener#handleEvent(java.util.EventObject)
- */
- public void handleEvent(Notification notification) throws Exception
- {
- this.service.handleEvent(notification);
- }
-
- /**
- * @see org.jboss.ha.framework.server.EventFactory#createEvent(java.lang.Object, java.lang.String)
- */
- public Notification createEvent(Object source, String type)
- {
- return new Notification(type, this, this.getNextNotificationSequenceNumber());
- }
-
- /**
- *
- * Override this method only if you need to provide a custom partition wide unique service name.
- * The default implementation will usually work, provided that
- * the getServiceName() method returns a unique canonical MBean name.
- *
- * @return partition wide unique service name
- */
- public String getServiceHAName()
- {
- String name = this.service.getServiceHAName();
-
- if (name == null)
- {
- ObjectName on = this.getServiceName();
-
- if (on != null)
- {
- name = on.getCanonicalName();
-
- this.service.setServiceHAName(name);
- }
- else
- {
- // This shouldn't occur as the service name is now injected by the microcontainer.
- // If injection fails, the service name should then be used.
- throw new IllegalStateException("Cannot determine ServiceHAName for " +
- getClass().getName() + "; " +
- "either set it explicitly or register this object in JMX " +
- "before calling create");
- }
- }
-
- return name;
- }
-
- @Inject(fromContext = FromContext.NAME)
- public void setServiceHAName(String haName)
- {
- this.service.setServiceHAName(haName);
- }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.jmx;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.management.AttributeChangeNotification;
+import javax.management.Notification;
+import javax.management.ObjectName;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.model.FromContext;
+import org.jboss.ha.framework.interfaces.DistributedState;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.interfaces.HAService;
+import org.jboss.ha.framework.server.ClusterPartitionMBean;
+import org.jboss.ha.framework.server.EventFacility;
+import org.jboss.ha.framework.server.EventFactory;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * Abstract implementation of HAServiceMBean for use by subclasses, e.g. {@link org.jboss.ha.singleton.HASingletonSupport}.
+ *
+ * @param S the class of the HAService delegate
+ * @author Paul Ferraro
+ */
+ at SuppressWarnings("deprecation")
+public abstract class AbstractHAServiceMBeanSupport<S extends HAService<Notification>>
+ extends ServiceMBeanSupport
+ implements HAServiceMBean, HAService<Notification>, EventFactory<Notification>, EventFacility<Notification>
+{
+ private final S service = this.createHAService();
+
+ private volatile boolean sendLocalLifecycleNotifications = true;
+ private volatile boolean sendRemoteLifecycleNotifications = true;
+
+ /**
+ * Defines the object used to delegate service methods.
+ * @return an {@link HAService} delegate
+ */
+ protected abstract S createHAService();
+
+ /**
+ * @return the object created by {@link #createHAService()}.
+ */
+ protected final S getHAService()
+ {
+ return this.service;
+ }
+
+ // Public --------------------------------------------------------
+
+ public HAPartition getHAPartition()
+ {
+ return this.service.getHAPartition();
+ }
+
+ public void setHAPartition(HAPartition partition)
+ {
+ this.service.setHAPartition(partition);
+ }
+
+ public void setClusterPartition(ClusterPartitionMBean clusterPartition)
+ {
+ if ((this.getState() != STARTED) && (this.getState() != STARTING))
+ {
+ this.service.setHAPartition(clusterPartition.getHAPartition());
+ }
+ }
+
+ public String getPartitionName()
+ {
+ return this.service.getHAPartition().getPartitionName();
+ }
+
+ public boolean isRegisterThreadContextClassLoader()
+ {
+ return this.service.isRegisterThreadContextClassLoader();
+ }
+
+ public void setRegisterThreadContextClassLoader(boolean register)
+ {
+ this.service.setRegisterThreadContextClassLoader(register);
+ }
+
+ public String getHAServiceKey()
+ {
+ return this.service.getHAServiceKey();
+ }
+
+ // Protected ------------------------------
+
+ /**
+ *
+ *
+ * Convenience method for sharing state across a cluster partition.
+ * Delegates to the DistributedStateService
+ *
+ * @param key key for the distributed object
+ * @param value the distributed object
+ *
+ */
+ public void setDistributedState(String key, Serializable value) throws Exception
+ {
+ DistributedState ds = this.getHAPartition().getDistributedStateService();
+ ds.set(this.getHAServiceKey(), key, value);
+ }
+
+ /**
+ *
+ * Convenience method for sharing state across a cluster partition.
+ * Delegates to the DistributedStateService
+ *
+ * @param key key for the distributed object
+ * @return Serializable the distributed object
+ *
+ */
+ public Serializable getDistributedState(String key)
+ {
+ DistributedState ds = this.getHAPartition().getDistributedStateService();
+ return ds.get(this.getHAServiceKey(), key);
+ }
+
+ /**
+ * @see org.jboss.system.ServiceMBeanSupport#createService()
+ */
+ @Override
+ protected void createService() throws Exception
+ {
+ this.service.create();
+ }
+
+ /**
+ * <p>
+ * Implementors of this method should not
+ * code the singleton logic here.
+ * The MBean lifecycle create/start/stop are separate from
+ * the singleton logic.
+ * Singleton logic should originate in becomeMaster().
+ * </p>
+ *
+ * <p>
+ * <b>Attention</b>: Always call this method when you overwrite it in a subclass
+ * because it elects the master singleton node.
+ * </p>
+ *
+ */
+ @Override
+ protected void startService() throws Exception
+ {
+ this.log.debug("start HAServiceMBeanSupport");
+
+ if (this.getHAPartition() == null)
+ {
+ throw new IllegalStateException("HAPartition property must be set before starting HAServiceMBeanSupport");
+ }
+
+ this.setupPartition();
+
+ this.service.start();
+ }
+
+ /**
+ * <p>
+ * <b>Attention</b>: Always call this method when you overwrite it in a subclass
+ * </p>
+ *
+ */
+ @Override
+ protected void stopService() throws Exception
+ {
+ this.log.debug("stop HAServiceMBeanSupport");
+
+ this.service.stop();
+ }
+
+ /**
+ * @see org.jboss.system.ServiceMBeanSupport#destroyService()
+ */
+ @Override
+ protected void destroyService() throws Exception
+ {
+ this.service.destroy();
+ }
+
+ protected void setupPartition() throws Exception
+ {
+ // method no longer used by base implementation
+ }
+
+ @SuppressWarnings("unchecked")
+ public List callMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
+ {
+ return this.getHAPartition().callMethodOnCluster(this.getHAServiceKey(), methodName, args, types, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void callAsyncMethodOnPartition(String methodName, Object[] args, Class[] types) throws Exception
+ {
+ this.getHAPartition().callAsynchMethodOnCluster(this.getHAServiceKey(), methodName, args, types, true);
+ }
+
+ /**
+ * Gets whether JMX Notifications should be sent to local (same JVM) listeners
+ * if the notification is for an attribute change to attribute "State".
+ * <p>
+ * Default is <code>true</code>.
+ * </p>
+ * @see #sendNotification(Notification)
+ */
+ public boolean getSendLocalLifecycleNotifications()
+ {
+ return this.sendLocalLifecycleNotifications;
+ }
+
+ /**
+ * Sets whether JMX Notifications should be sent to local (same JVM) listeners
+ * if the notification is for an attribute change to attribute "State".
+ * <p>
+ * Default is <code>true</code>.
+ * </p>
+ * @see #sendNotification(Notification)
+ */
+ public void setSendLocalLifecycleNotifications(boolean sendLocalLifecycleNotifications)
+ {
+ this.sendLocalLifecycleNotifications = sendLocalLifecycleNotifications;
+ }
+
+ /**
+ * Gets whether JMX Notifications should be sent to remote listeners
+ * if the notification is for an attribute change to attribute "State".
+ * <p>
+ * Default is <code>true</code>.
+ * </p>
+ * <p>
+ * See http://jira.jboss.com/jira/browse/JBAS-3194 for an example of a
+ * use case where this property should be set to false.
+ * </p>
+ *
+ * @see #sendNotification(Notification)
+ */
+ public boolean getSendRemoteLifecycleNotifications()
+ {
+ return this.sendRemoteLifecycleNotifications;
+ }
+
+ /**
+ * Sets whether JMX Notifications should be sent to remote listeners
+ * if the notification is for an attribute change to attribute "State".
+ * <p>
+ * Default is <code>true</code>.
+ * </p>
+ * <p>
+ * See http://jira.jboss.com/jira/browse/JBAS-3194 for an example of a
+ * use case where this property should be set to false.
+ * </p>
+ *
+ * @see #sendNotification(Notification)
+ */
+ public void setSendRemoteLifecycleNotifications(boolean sendRemoteLifecycleNotifications)
+ {
+ this.sendRemoteLifecycleNotifications = sendRemoteLifecycleNotifications;
+ }
+
+ /**
+ * Broadcast the notification to the remote listener nodes (if any) and then
+ * invoke super.sendNotification() to notify local listeners.
+ *
+ * @param notification sent out to local listeners and other nodes. It should be serializable.
+ * It is recommended that the source of the notification is an ObjectName of an MBean that
+ * is is available on all nodes where the broadcaster MBean is registered.
+ *
+ * @see #getSendLocalLifecycleNotifications()
+ * @see #getSendRemoteLifecycleNotifications()
+ * @see javax.management.NotificationBroadcasterSupport#sendNotification(Notification)
+ * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#sendNotification(javax.management.Notification)
+ */
+ public void sendNotification(Notification notification)
+ {
+ boolean stateChange = (notification instanceof AttributeChangeNotification) ? "State".equals(((AttributeChangeNotification) notification).getAttributeName()) : false;
+
+ if (!stateChange || this.sendRemoteLifecycleNotifications)
+ {
+ try
+ {
+ this.sendNotificationRemote(notification);
+ }
+ catch (Throwable e)
+ {
+ // even if broadcast failed, local notification should still be sent
+ this.log.warn("handleNotification( " + notification + " ) failed ", e);
+ }
+ }
+
+ if (!stateChange || this.sendLocalLifecycleNotifications)
+ {
+ this.sendNotificationToLocalListeners(notification);
+ }
+ }
+
+ /**
+ *
+ * Broadcast a notifcation remotely to the partition participants
+ *
+ * @param notification
+ */
+ protected void sendNotificationRemote(Notification notification) throws Exception
+ {
+ // Overriding the source MBean with its ObjectName
+ // to ensure that it can be safely transferred over the wire
+ notification.setSource(this.getServiceName());
+
+ this.handleEvent(notification);
+ }
+
+ protected void sendNotificationToLocalListeners(Notification notification)
+ {
+ this.notifyListeners(notification);
+ }
+
+ /**
+ * @see org.jboss.ha.framework.server.EventFacility#notifyListeners(java.util.EventObject)
+ */
+ public void notifyListeners(Notification notification)
+ {
+ super.sendNotification(notification);
+ }
+
+ /**
+ * @see org.jboss.ha.framework.interfaces.EventListener#handleEvent(java.util.EventObject)
+ */
+ public void handleEvent(Notification notification) throws Exception
+ {
+ this.service.handleEvent(notification);
+ }
+
+ /**
+ * @see org.jboss.ha.framework.server.EventFactory#createEvent(java.lang.Object, java.lang.String)
+ */
+ public Notification createEvent(Object source, String type)
+ {
+ return new Notification(type, this, this.getNextNotificationSequenceNumber());
+ }
+
+ /**
+ *
+ * Override this method only if you need to provide a custom partition wide unique service name.
+ * The default implementation will usually work, provided that
+ * the getServiceName() method returns a unique canonical MBean name.
+ *
+ * @return partition wide unique service name
+ */
+ public String getServiceHAName()
+ {
+ String name = this.service.getServiceHAName();
+
+ if (name == null)
+ {
+ ObjectName on = this.getServiceName();
+
+ if (on != null)
+ {
+ name = on.getCanonicalName();
+
+ this.service.setServiceHAName(name);
+ }
+ else
+ {
+ // This shouldn't occur as the service name is now injected by the microcontainer.
+ // If injection fails, the service name should then be used.
+ throw new IllegalStateException("Cannot determine ServiceHAName for " +
+ getClass().getName() + "; " +
+ "either set it explicitly or register this object in JMX " +
+ "before calling create");
+ }
+ }
+
+ return name;
+ }
+
+ @Inject(fromContext = FromContext.NAME)
+ public void setServiceHAName(String haName)
+ {
+ this.service.setServiceHAName(haName);
+ }
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/jmx/AbstractHAServiceMBeanSupport.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,251 +1,251 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.singleton;
-
-import java.net.URI;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.system.server.profileservice.DeploymentPhaseVFSScanner;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * VFSScanner that exposes methods whereby an HASingletonController
- * can trigger the deployment or undeployment.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
- */
-public class HASingletonDeploymentScanner extends DeploymentPhaseVFSScanner implements HASingletonDeploymentScannerMBean
-{
- private static final DeploymentPhase DEPLOYMENT_PHASE = DeploymentPhase.APPLICATION;
-
- private MainDeployer mainDeployer;
-
- private DeploymentManager deploymentManager;
-
- private boolean deployed;
-
- private ProfileKey activeProfile;
-
- private Set<String> uploadedNames = new LinkedHashSet<String>();
-
- /**
- * Create a new HASingletonDeploymentScanner.
- *
- */
- public HASingletonDeploymentScanner()
- {
- super(DEPLOYMENT_PHASE);
- }
-
- // ---------------------------------------------------------- Properties
-
- public MainDeployer getMainDeployer()
- {
- return mainDeployer;
- }
-
- public void setMainDeployer(MainDeployer mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
- @Override
- public void setProfileService(ProfileService profileService)
- {
- super.setProfileService(profileService);
- if (profileService != null)
- {
- this.deploymentManager = profileService.getDeploymentManager();
- }
- else
- {
- this.deploymentManager = null;
- }
- }
-
- // ----------------------------------------------------------------- Public
-
- /**
- * Deploy the content under the given URIs. Called by the
- * HASingletonController when we become the singleton master.
- *
- * @param uris comma delimited list of URIs containing content to deploy
- */
- public synchronized void deploySingletons(String uris) throws Exception
- {
- if (!this.deployed)
- {
- if (this.deploymentManager == null && this.mainDeployer == null)
- {
- throw new IllegalStateException("Configuration must either provide " +
- "a ProfileService with a DeploymentManager or a MainDeployer");
- }
-
- StringTokenizer tokenizer = new StringTokenizer(uris, ",");
- while (tokenizer.hasMoreTokens())
- {
- String uri = tokenizer.nextToken();
- uri = uri.trim();
- addURI(new URI(uri));
- }
-
- scan();
-
- if (this.deploymentManager == null)
- {
- this.mainDeployer.process();
- // We don't call mainDeployer.checkComplete() as we may be in the
- // middle of the initial startup deployments; i.e. not expected to be complete
- }
- else
- {
- String[] allUploaded = getAllUploadedNames();
- DeploymentProgress progress = this.deploymentManager.start(DEPLOYMENT_PHASE, allUploaded);
- progress.run();
- }
-
- this.deployed = true;
- }
- }
-
- /**
- * Undeploy the content under the given URIs. Called by the
- * HASingletonController when we are no longer the singleton master.
- *
- * @param uris comma delimited list of URIs containing content to deploy
- */
- public synchronized void undeploySingletons(String uris) throws Exception
- {
- if (this.deployed)
- {
- if (this.deploymentManager == null && this.mainDeployer == null)
- {
- throw new IllegalStateException("Configuration must either provide " +
- "a ProfileService with a DeploymentManager or a MainDeployer");
- }
-
- StringTokenizer tokenizer = new StringTokenizer(uris, ",");
- while (tokenizer.hasMoreTokens())
- {
- String uri = tokenizer.nextToken();
- uri = uri.trim();
- removeURI(new URI(uri));
- }
-
- scan();
-
- if (this.deploymentManager == null)
- {
- this.mainDeployer.process();
- // We don't call mainDeployer.checkComplete() as we may be in the
- // middle of the main shutdown startup deployments; i.e. not expected to be complete
- }
- else
- {
- String[] allUploaded = getAllUploadedNames();
-
- this.uploadedNames.clear();
-
- DeploymentProgress progress = this.deploymentManager.stop(DEPLOYMENT_PHASE, allUploaded);
- progress.run();
- progress = this.deploymentManager.undeploy(DEPLOYMENT_PHASE, allUploaded);
- progress.run();
- }
-
- this.deployed = false;
- }
- }
-
- // ---------------------------------------------------- Protected Overrides
-
- @Override
- protected VFSDeployment add(Profile profile, VirtualFile file) throws Exception
- {
- VFSDeployment deployment = createDeployment(file);
- if (this.deploymentManager == null)
- {
- if(profile.hasDeployment(deployment.getName(), DEPLOYMENT_PHASE) == false)
- {
- profile.addDeployment(deployment, DEPLOYMENT_PHASE);
- this.mainDeployer.addDeployment(deployment);
- }
- }
- else
- {
- activateProfile(profile.getKey());
-
- String name = file.getPathName();
- DeploymentProgress progress = this.deploymentManager.distribute(name, DEPLOYMENT_PHASE, file.toURL());
- progress.run();
-
- String[] repoNames = progress.getDeploymentID().getRepositoryNames();
- if (repoNames != null)
- {
- for (String repoName : repoNames)
- {
- uploadedNames.add(repoName);
- }
- }
- }
- return deployment;
- }
-
- @Override
- protected void remove(Profile profile, String name) throws Exception
- {
- if(this.deploymentManager == null && profile.hasDeployment(name, DEPLOYMENT_PHASE))
- {
- profile.removeDeployment(name, DEPLOYMENT_PHASE);
- this.mainDeployer.removeDeployment(name);
- }
- // else we deal with everything at the end of undeploySingletons
- }
-
- // ---------------------------------------------------------------- Private
-
- private void activateProfile(ProfileKey key) throws Exception
- {
- if (activeProfile != key)
- {
- this.deploymentManager.loadProfile(key, false);
- activeProfile = key;
- }
- }
-
- private String[] getAllUploadedNames()
- {
- String[] result = new String[this.uploadedNames.size()];
- return this.uploadedNames.toArray(result);
- }
-
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.singleton;
+
+import java.net.URI;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.Profile;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.system.server.profileservice.DeploymentPhaseVFSScanner;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * VFSScanner that exposes methods whereby an HASingletonController
+ * can trigger the deployment or undeployment.
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public class HASingletonDeploymentScanner extends DeploymentPhaseVFSScanner implements HASingletonDeploymentScannerMBean
+{
+ private static final DeploymentPhase DEPLOYMENT_PHASE = DeploymentPhase.APPLICATION;
+
+ private MainDeployer mainDeployer;
+
+ private DeploymentManager deploymentManager;
+
+ private boolean deployed;
+
+ private ProfileKey activeProfile;
+
+ private Set<String> uploadedNames = new LinkedHashSet<String>();
+
+ /**
+ * Create a new HASingletonDeploymentScanner.
+ *
+ */
+ public HASingletonDeploymentScanner()
+ {
+ super(DEPLOYMENT_PHASE);
+ }
+
+ // ---------------------------------------------------------- Properties
+
+ public MainDeployer getMainDeployer()
+ {
+ return mainDeployer;
+ }
+
+ public void setMainDeployer(MainDeployer mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ @Override
+ public void setProfileService(ProfileService profileService)
+ {
+ super.setProfileService(profileService);
+ if (profileService != null)
+ {
+ this.deploymentManager = profileService.getDeploymentManager();
+ }
+ else
+ {
+ this.deploymentManager = null;
+ }
+ }
+
+ // ----------------------------------------------------------------- Public
+
+ /**
+ * Deploy the content under the given URIs. Called by the
+ * HASingletonController when we become the singleton master.
+ *
+ * @param uris comma delimited list of URIs containing content to deploy
+ */
+ public synchronized void deploySingletons(String uris) throws Exception
+ {
+ if (!this.deployed)
+ {
+ if (this.deploymentManager == null && this.mainDeployer == null)
+ {
+ throw new IllegalStateException("Configuration must either provide " +
+ "a ProfileService with a DeploymentManager or a MainDeployer");
+ }
+
+ StringTokenizer tokenizer = new StringTokenizer(uris, ",");
+ while (tokenizer.hasMoreTokens())
+ {
+ String uri = tokenizer.nextToken();
+ uri = uri.trim();
+ addURI(new URI(uri));
+ }
+
+ scan();
+
+ if (this.deploymentManager == null)
+ {
+ this.mainDeployer.process();
+ // We don't call mainDeployer.checkComplete() as we may be in the
+ // middle of the initial startup deployments; i.e. not expected to be complete
+ }
+ else
+ {
+ String[] allUploaded = getAllUploadedNames();
+ DeploymentProgress progress = this.deploymentManager.start(DEPLOYMENT_PHASE, allUploaded);
+ progress.run();
+ }
+
+ this.deployed = true;
+ }
+ }
+
+ /**
+ * Undeploy the content under the given URIs. Called by the
+ * HASingletonController when we are no longer the singleton master.
+ *
+ * @param uris comma delimited list of URIs containing content to deploy
+ */
+ public synchronized void undeploySingletons(String uris) throws Exception
+ {
+ if (this.deployed)
+ {
+ if (this.deploymentManager == null && this.mainDeployer == null)
+ {
+ throw new IllegalStateException("Configuration must either provide " +
+ "a ProfileService with a DeploymentManager or a MainDeployer");
+ }
+
+ StringTokenizer tokenizer = new StringTokenizer(uris, ",");
+ while (tokenizer.hasMoreTokens())
+ {
+ String uri = tokenizer.nextToken();
+ uri = uri.trim();
+ removeURI(new URI(uri));
+ }
+
+ scan();
+
+ if (this.deploymentManager == null)
+ {
+ this.mainDeployer.process();
+ // We don't call mainDeployer.checkComplete() as we may be in the
+ // middle of the main shutdown startup deployments; i.e. not expected to be complete
+ }
+ else
+ {
+ String[] allUploaded = getAllUploadedNames();
+
+ this.uploadedNames.clear();
+
+ DeploymentProgress progress = this.deploymentManager.stop(DEPLOYMENT_PHASE, allUploaded);
+ progress.run();
+ progress = this.deploymentManager.undeploy(DEPLOYMENT_PHASE, allUploaded);
+ progress.run();
+ }
+
+ this.deployed = false;
+ }
+ }
+
+ // ---------------------------------------------------- Protected Overrides
+
+ @Override
+ protected VFSDeployment add(Profile profile, VirtualFile file) throws Exception
+ {
+ VFSDeployment deployment = createDeployment(file);
+ if (this.deploymentManager == null)
+ {
+ if(profile.hasDeployment(deployment.getName(), DEPLOYMENT_PHASE) == false)
+ {
+ profile.addDeployment(deployment, DEPLOYMENT_PHASE);
+ this.mainDeployer.addDeployment(deployment);
+ }
+ }
+ else
+ {
+ activateProfile(profile.getKey());
+
+ String name = file.getPathName();
+ DeploymentProgress progress = this.deploymentManager.distribute(name, DEPLOYMENT_PHASE, file.toURL());
+ progress.run();
+
+ String[] repoNames = progress.getDeploymentID().getRepositoryNames();
+ if (repoNames != null)
+ {
+ for (String repoName : repoNames)
+ {
+ uploadedNames.add(repoName);
+ }
+ }
+ }
+ return deployment;
+ }
+
+ @Override
+ protected void remove(Profile profile, String name) throws Exception
+ {
+ if(this.deploymentManager == null && profile.hasDeployment(name, DEPLOYMENT_PHASE))
+ {
+ profile.removeDeployment(name, DEPLOYMENT_PHASE);
+ this.mainDeployer.removeDeployment(name);
+ }
+ // else we deal with everything at the end of undeploySingletons
+ }
+
+ // ---------------------------------------------------------------- Private
+
+ private void activateProfile(ProfileKey key) throws Exception
+ {
+ if (activeProfile != key)
+ {
+ this.deploymentManager.loadProfile(key, false);
+ activeProfile = key;
+ }
+ }
+
+ private String[] getAllUploadedNames()
+ {
+ String[] result = new String[this.uploadedNames.size()];
+ return this.uploadedNames.toArray(result);
+ }
+
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,39 +1,39 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.singleton;
-
-import java.net.URI;
-import java.util.List;
-
-
-/**
- * StandardMBean interface for {@link HASingletonDeploymentScanner}
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
- */
-public interface HASingletonDeploymentScannerMBean
-{
- void deploySingletons(String uri) throws Exception;
-
- void undeploySingletons(String uri) throws Exception;
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.singleton;
+
+import java.net.URI;
+import java.util.List;
+
+
+/**
+ * StandardMBean interface for {@link HASingletonDeploymentScanner}
+ *
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1.1 $
+ */
+public interface HASingletonDeploymentScannerMBean
+{
+ void deploySingletons(String uri) throws Exception;
+
+ void undeploySingletons(String uri) throws Exception;
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScannerMBean.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicy.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicy.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicy.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,174 +1,174 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.singleton;
-
-import java.net.InetAddress;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.UnknownHostException;
-import java.util.List;
-
-import org.jboss.ha.framework.interfaces.ClusterNode;
-import org.jboss.logging.Logger;
-
-/**
- * Election policy that chooses the node where the singleton should run based on
- * the given preferred master node in ip_address:port_number or
- * host_name:port_number format. If the preferred master is null, or its
- * ip_address does not resolve to a valid host name, or the port number is
- * invalid, it delegates to the standard policy.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- * @author Paul Ferraro
- */
-public class PreferredMasterElectionPolicy
- extends HASingletonElectionPolicySimple
- implements PreferredMasterElectionPolicyMBean
-{
- protected Logger log = Logger.getLogger(this.getClass());
-
- private String preferredMaster;
-
- // ------------------------------------------------------------- Properties
-
- /**
- * @see PreferredMasterElectionPolicyMBean#setPreferredMaster(String)
- */
- public void setPreferredMaster(String node)
- {
- this.preferredMaster = node;
- }
-
- /**
- * @see PreferredMasterElectionPolicyMBean#getPreferredMaster()
- */
- public String getPreferredMaster()
- {
- return this.preferredMaster;
- }
-
- // ----------------------------------------------------- HASingletonElector
-
- @Override
- public ClusterNode elect(List<ClusterNode> candidates)
- {
- // If preferred master is defined and contained in cluster, return it
- if (this.preferredMaster != null)
- {
- this.log.debug("Checking if " + this.preferredMaster + " is in candidate list " + candidates);
-
- // First just match on names
- for (ClusterNode node : candidates)
- {
- if (node.getName().equals(this.preferredMaster))
- {
- return node;
- }
- }
-
- // No match. Check for situation where preferred master uses a hostname
- // and the ClusterNode uses dotted decimal (or vice versa)
-
- // Create a URI out of the preferred master and try retrieving host
- // and port.
- URI uri = createUri(this.preferredMaster);
- // See if we can parse out an InetAddress and port from preferredMaster.
- InetAddress addr = parseInetAddress(uri);
-
- if (addr != null)
- {
- int port = uri.getPort();
- String rewritten = addr.getHostAddress() + ":" + port;
- if (this.preferredMaster.equals(rewritten))
- {
- rewritten = addr.getHostName() + ":" + port;
- }
-
- for (ClusterNode node : candidates)
- {
- if (node.getName().equals(rewritten))
- {
- return node;
- }
- }
- }
- }
-
- return super.elect(candidates);
- }
-
- // --------------------------------------------------------------- Protected
-
- /**
- * Create a URI instance from the given preferred master.
- *
- * @param str contains the String format of the preferred master.
- * @return an instance of URI, or null if the str cannot be parsed.
- */
- protected URI createUri(String str)
- {
- try
- {
- return new URI("cluster://" + this.preferredMaster);
- }
- catch (URISyntaxException use)
- {
- this.log.debug("Cannot extract URI from " + this.preferredMaster, use);
- }
-
- return null;
- }
-
- /**
- * Parse an URI into an InetAddress
- *
- * @param uri URI representation of the address. It can be null.
- * @return InetAddress representation or null if the host in the URI is
- * unknown or given URI is null.
- */
- protected InetAddress parseInetAddress(URI uri)
- {
- if (uri != null)
- {
- // Returns either the host, or null if host undefined
- String host = uri.getHost();
- // Returns either the port, or -1 if port undefined or not numeric
- int port = uri.getPort();
-
- if (host != null && port != -1)
- {
- try
- {
- InetAddress addr = InetAddress.getByName(host);
- this.log.debug("Parsed " + this.preferredMaster + " into " + addr + " and " + port);
- return addr;
- }
- catch (UnknownHostException uhe)
- {
- this.log.debug("Cannot extract InetAddress from " + this.preferredMaster, uhe);
- }
- }
- }
-
- return null;
- }
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.singleton;
+
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+import java.util.List;
+
+import org.jboss.ha.framework.interfaces.ClusterNode;
+import org.jboss.logging.Logger;
+
+/**
+ * Election policy that chooses the node where the singleton should run based on
+ * the given preferred master node in ip_address:port_number or
+ * host_name:port_number format. If the preferred master is null, or its
+ * ip_address does not resolve to a valid host name, or the port number is
+ * invalid, it delegates to the standard policy.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ * @author Paul Ferraro
+ */
+public class PreferredMasterElectionPolicy
+ extends HASingletonElectionPolicySimple
+ implements PreferredMasterElectionPolicyMBean
+{
+ protected Logger log = Logger.getLogger(this.getClass());
+
+ private String preferredMaster;
+
+ // ------------------------------------------------------------- Properties
+
+ /**
+ * @see PreferredMasterElectionPolicyMBean#setPreferredMaster(String)
+ */
+ public void setPreferredMaster(String node)
+ {
+ this.preferredMaster = node;
+ }
+
+ /**
+ * @see PreferredMasterElectionPolicyMBean#getPreferredMaster()
+ */
+ public String getPreferredMaster()
+ {
+ return this.preferredMaster;
+ }
+
+ // ----------------------------------------------------- HASingletonElector
+
+ @Override
+ public ClusterNode elect(List<ClusterNode> candidates)
+ {
+ // If preferred master is defined and contained in cluster, return it
+ if (this.preferredMaster != null)
+ {
+ this.log.debug("Checking if " + this.preferredMaster + " is in candidate list " + candidates);
+
+ // First just match on names
+ for (ClusterNode node : candidates)
+ {
+ if (node.getName().equals(this.preferredMaster))
+ {
+ return node;
+ }
+ }
+
+ // No match. Check for situation where preferred master uses a hostname
+ // and the ClusterNode uses dotted decimal (or vice versa)
+
+ // Create a URI out of the preferred master and try retrieving host
+ // and port.
+ URI uri = createUri(this.preferredMaster);
+ // See if we can parse out an InetAddress and port from preferredMaster.
+ InetAddress addr = parseInetAddress(uri);
+
+ if (addr != null)
+ {
+ int port = uri.getPort();
+ String rewritten = addr.getHostAddress() + ":" + port;
+ if (this.preferredMaster.equals(rewritten))
+ {
+ rewritten = addr.getHostName() + ":" + port;
+ }
+
+ for (ClusterNode node : candidates)
+ {
+ if (node.getName().equals(rewritten))
+ {
+ return node;
+ }
+ }
+ }
+ }
+
+ return super.elect(candidates);
+ }
+
+ // --------------------------------------------------------------- Protected
+
+ /**
+ * Create a URI instance from the given preferred master.
+ *
+ * @param str contains the String format of the preferred master.
+ * @return an instance of URI, or null if the str cannot be parsed.
+ */
+ protected URI createUri(String str)
+ {
+ try
+ {
+ return new URI("cluster://" + this.preferredMaster);
+ }
+ catch (URISyntaxException use)
+ {
+ this.log.debug("Cannot extract URI from " + this.preferredMaster, use);
+ }
+
+ return null;
+ }
+
+ /**
+ * Parse an URI into an InetAddress
+ *
+ * @param uri URI representation of the address. It can be null.
+ * @return InetAddress representation or null if the host in the URI is
+ * unknown or given URI is null.
+ */
+ protected InetAddress parseInetAddress(URI uri)
+ {
+ if (uri != null)
+ {
+ // Returns either the host, or null if host undefined
+ String host = uri.getHost();
+ // Returns either the port, or -1 if port undefined or not numeric
+ int port = uri.getPort();
+
+ if (host != null && port != -1)
+ {
+ try
+ {
+ InetAddress addr = InetAddress.getByName(host);
+ this.log.debug("Parsed " + this.preferredMaster + " into " + addr + " and " + port);
+ return addr;
+ }
+ catch (UnknownHostException uhe)
+ {
+ this.log.debug("Cannot extract InetAddress from " + this.preferredMaster, uhe);
+ }
+ }
+ }
+
+ return null;
+ }
}
\ No newline at end of file
Property changes on: trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicy.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicyMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicyMBean.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicyMBean.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,48 +1,48 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ha.singleton;
-
-/**
- * MBean interface for the preferred master election policy that allows
- * preferred master to be changed at runtime.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public interface PreferredMasterElectionPolicyMBean extends HASingletonElectionPolicySimpleMBean
-{
- /**
- * Sets the preferred master node. As long as the preferred master node
- * presents in the cluster, it will be always selected as master node,
- * no matter what the election policy is.
- * @param node String format of ip_address:port_number or
- * host_name:port_number.
- */
- void setPreferredMaster(String node);
-
- /**
- * Get the preferred master node.
- *
- * @return preferred master node in ip_address:port_number or
- * host_name:port_number format.
- */
- String getPreferredMaster();
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.singleton;
+
+/**
+ * MBean interface for the preferred master election policy that allows
+ * preferred master to be changed at runtime.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public interface PreferredMasterElectionPolicyMBean extends HASingletonElectionPolicySimpleMBean
+{
+ /**
+ * Sets the preferred master node. As long as the preferred master node
+ * presents in the cluster, it will be always selected as master node,
+ * no matter what the election policy is.
+ * @param node String format of ip_address:port_number or
+ * host_name:port_number.
+ */
+ void setPreferredMaster(String node);
+
+ /**
+ * Get the preferred master node.
+ *
+ * @return preferred master node in ip_address:port_number or
+ * host_name:port_number format.
+ */
+ String getPreferredMaster();
+}
Property changes on: trunk/cluster/src/main/org/jboss/ha/singleton/PreferredMasterElectionPolicyMBean.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/proxy/AbstractTransactionStickyInterceptor.java
===================================================================
--- trunk/cluster/src/main/org/jboss/proxy/AbstractTransactionStickyInterceptor.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/proxy/AbstractTransactionStickyInterceptor.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,165 +1,165 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.proxy;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.util.Collections;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.jboss.ha.framework.interfaces.FamilyClusterInfo;
-import org.jboss.invocation.Invocation;
-import org.jboss.invocation.InvokerProxyHA;
-import org.jboss.invocation.ServiceUnavailableException;
-import org.jboss.logging.Logger;
-import org.jboss.tm.TransactionPropagationContextFactory;
-import org.jboss.tm.TransactionPropagationContextUtil;
-
-/**
- * Parent transaction sticky interceptor that encapsulates sticky target map
- * and exposes operations on this map.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public abstract class AbstractTransactionStickyInterceptor extends Interceptor
-{
- private static final Map txStickyTargets = Collections.synchronizedMap(new WeakHashMap());
-
- private FamilyClusterInfo familyClusterInfo;
-
- protected final Logger log = Logger.getLogger(getClass());
-
- protected static boolean trace = false;
-
- public AbstractTransactionStickyInterceptor()
- {
- trace = log.isTraceEnabled();
- }
-
- /**
- * Called at the beginning of the invocation to check whether the current tpc
- * is already present in the tx sticky target. If it is, get the chosen
- * target associated to it and add it to the invocation transient payload so
- * that the load balance policy can choose the right target as long as the
- * target is available in the cluster family. Otherwise, invocation needs to
- * be halted because a previous invocation within the transaction succeeded
- * (tx sticky target was set), so we can't failover to a different node.
- *
- * @param invocation Invocation object where transaction sticky will be set
- * if present.
- */
- protected void putIfExistsTransactionTarget(Invocation invocation) throws Exception
- {
- Object tpc = getTransactionPropagationContext();
-
- if (tpc != null)
- {
- if (trace)
- {
- log.trace("In the proxy, transaction propagation context (tpc) is " + tpc);
- log.trace("Contains key returns " + txStickyTargets.containsKey(tpc));
- }
-
- Object stickyTarget = txStickyTargets.get(tpc);
-
- if (stickyTarget != null)
- {
- if (getFamilyClusterInfo(invocation).getTargets().contains(stickyTarget))
- {
- if (trace)
- {
- log.trace("Put transaction bound target into transient payload: " + stickyTarget);
- }
-
- invocation.getTransientPayload().put("TX_STICKY_TARGET", stickyTarget);
- }
- else
- {
- throw new ServiceUnavailableException("Transaction sticky target is no longer available, so invocation needs to be halted");
- }
- }
- }
- }
-
- /**
- * Method called to remember the sticky target associated with a transaction
- * context.
- *
- * @param invocation Invocation object from which the TX_STICKY_TARGET
- * transient value comes from.
- * @param tpc Transaction propagation context.
- */
- protected void rememberTransactionTarget(Invocation invocation, Object tpc)
- {
- if (trace)
- {
- log.trace("After reaching the server, transaction propagation context (tpc) is " + tpc);
- }
-
- Object stickyTarget = invocation.getTransientValue("TX_STICKY_TARGET");
-
- if (stickyTarget != null)
- {
- if (trace)
- {
- log.trace("Remember transaction bound target [" + stickyTarget + "] for tpc " + tpc);
- }
-
- txStickyTargets.put(tpc, stickyTarget);
-
- /* Put it in invoker proxy txFailoverAuthorizations to avoid failover being
- * allowed if the 1st EJB invocation within user trasnsaction fails with
- * GenericClusteringException.COMPLETED_NO */
- InvokerProxyHA proxy = (InvokerProxyHA)invocation.getInvocationContext().getInvoker();
- proxy.forbidTransactionFailover(tpc);
- }
- }
-
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- trace = log.isTraceEnabled();
- }
-
- protected Object getTransactionPropagationContext()
- {
- TransactionPropagationContextFactory tpcFactory = TransactionPropagationContextUtil.getTPCFactoryClientSide();
- if (trace)
- {
- log.trace("Using tpc factory " + tpcFactory);
- }
- return (tpcFactory == null) ? null : tpcFactory.getTransactionPropagationContext();
- }
-
- protected synchronized FamilyClusterInfo getFamilyClusterInfo(Invocation invocation) throws Exception
- {
- if (familyClusterInfo == null)
- {
- InvokerProxyHA proxy = (InvokerProxyHA)invocation.getInvocationContext().getInvoker();
- familyClusterInfo = proxy.getFamilyClusterInfo();
- }
-
- return familyClusterInfo;
- }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.proxy;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.util.Collections;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.jboss.ha.framework.interfaces.FamilyClusterInfo;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.InvokerProxyHA;
+import org.jboss.invocation.ServiceUnavailableException;
+import org.jboss.logging.Logger;
+import org.jboss.tm.TransactionPropagationContextFactory;
+import org.jboss.tm.TransactionPropagationContextUtil;
+
+/**
+ * Parent transaction sticky interceptor that encapsulates sticky target map
+ * and exposes operations on this map.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public abstract class AbstractTransactionStickyInterceptor extends Interceptor
+{
+ private static final Map txStickyTargets = Collections.synchronizedMap(new WeakHashMap());
+
+ private FamilyClusterInfo familyClusterInfo;
+
+ protected final Logger log = Logger.getLogger(getClass());
+
+ protected static boolean trace = false;
+
+ public AbstractTransactionStickyInterceptor()
+ {
+ trace = log.isTraceEnabled();
+ }
+
+ /**
+ * Called at the beginning of the invocation to check whether the current tpc
+ * is already present in the tx sticky target. If it is, get the chosen
+ * target associated to it and add it to the invocation transient payload so
+ * that the load balance policy can choose the right target as long as the
+ * target is available in the cluster family. Otherwise, invocation needs to
+ * be halted because a previous invocation within the transaction succeeded
+ * (tx sticky target was set), so we can't failover to a different node.
+ *
+ * @param invocation Invocation object where transaction sticky will be set
+ * if present.
+ */
+ protected void putIfExistsTransactionTarget(Invocation invocation) throws Exception
+ {
+ Object tpc = getTransactionPropagationContext();
+
+ if (tpc != null)
+ {
+ if (trace)
+ {
+ log.trace("In the proxy, transaction propagation context (tpc) is " + tpc);
+ log.trace("Contains key returns " + txStickyTargets.containsKey(tpc));
+ }
+
+ Object stickyTarget = txStickyTargets.get(tpc);
+
+ if (stickyTarget != null)
+ {
+ if (getFamilyClusterInfo(invocation).getTargets().contains(stickyTarget))
+ {
+ if (trace)
+ {
+ log.trace("Put transaction bound target into transient payload: " + stickyTarget);
+ }
+
+ invocation.getTransientPayload().put("TX_STICKY_TARGET", stickyTarget);
+ }
+ else
+ {
+ throw new ServiceUnavailableException("Transaction sticky target is no longer available, so invocation needs to be halted");
+ }
+ }
+ }
+ }
+
+ /**
+ * Method called to remember the sticky target associated with a transaction
+ * context.
+ *
+ * @param invocation Invocation object from which the TX_STICKY_TARGET
+ * transient value comes from.
+ * @param tpc Transaction propagation context.
+ */
+ protected void rememberTransactionTarget(Invocation invocation, Object tpc)
+ {
+ if (trace)
+ {
+ log.trace("After reaching the server, transaction propagation context (tpc) is " + tpc);
+ }
+
+ Object stickyTarget = invocation.getTransientValue("TX_STICKY_TARGET");
+
+ if (stickyTarget != null)
+ {
+ if (trace)
+ {
+ log.trace("Remember transaction bound target [" + stickyTarget + "] for tpc " + tpc);
+ }
+
+ txStickyTargets.put(tpc, stickyTarget);
+
+ /* Put it in invoker proxy txFailoverAuthorizations to avoid failover being
+ * allowed if the 1st EJB invocation within user trasnsaction fails with
+ * GenericClusteringException.COMPLETED_NO */
+ InvokerProxyHA proxy = (InvokerProxyHA)invocation.getInvocationContext().getInvoker();
+ proxy.forbidTransactionFailover(tpc);
+ }
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ trace = log.isTraceEnabled();
+ }
+
+ protected Object getTransactionPropagationContext()
+ {
+ TransactionPropagationContextFactory tpcFactory = TransactionPropagationContextUtil.getTPCFactoryClientSide();
+ if (trace)
+ {
+ log.trace("Using tpc factory " + tpcFactory);
+ }
+ return (tpcFactory == null) ? null : tpcFactory.getTransactionPropagationContext();
+ }
+
+ protected synchronized FamilyClusterInfo getFamilyClusterInfo(Invocation invocation) throws Exception
+ {
+ if (familyClusterInfo == null)
+ {
+ InvokerProxyHA proxy = (InvokerProxyHA)invocation.getInvocationContext().getInvoker();
+ familyClusterInfo = proxy.getFamilyClusterInfo();
+ }
+
+ return familyClusterInfo;
+ }
+}
Property changes on: trunk/cluster/src/main/org/jboss/proxy/AbstractTransactionStickyInterceptor.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/proxy/ClientUserTransactionStickyInterceptor.java
===================================================================
--- trunk/cluster/src/main/org/jboss/proxy/ClientUserTransactionStickyInterceptor.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/proxy/ClientUserTransactionStickyInterceptor.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,62 +1,62 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.proxy;
-
-import org.jboss.invocation.Invocation;
-
-/**
- * The ClientUserTransactionStickyInterceptor should be used as an interceptor
- * for the HA proxy in the ClientUserTransactionService. The aim of this
- * interceptor is twofold: First, when UserTransaction.begin() is called, the
- * result of the invocation, which is the transaction propagation context of
- * the transaction started, is stored together with the target server used, so
- * that future invocations can make use of the sticky target. Secondly, for the
- * rest of UserTransaction invocations, i.e. commit(), getStatus()...etc, the
- * current tpc is retrieved and the sticky target is located and added to the
- * transient payload of the invocation.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class ClientUserTransactionStickyInterceptor extends AbstractTransactionStickyInterceptor
-{
- @Override
- public Object invoke(Invocation invocation) throws Throwable
- {
- putIfExistsTransactionTarget(invocation);
- Object response = getNext().invoke(invocation);
- invocationHasReachedAServer(invocation, response);
- return response;
- }
-
- public void invocationHasReachedAServer(Invocation invocation, Object response)
- {
- Object tpc = getTransactionPropagationContext();
- if (tpc == null)
- {
- /* If tpc is null when invoking a UserTransaction operation, begin()
- * is being called, so we remember the target where the transaction
- * was started.
- */
- rememberTransactionTarget(invocation, response);
- }
- }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.proxy;
+
+import org.jboss.invocation.Invocation;
+
+/**
+ * The ClientUserTransactionStickyInterceptor should be used as an interceptor
+ * for the HA proxy in the ClientUserTransactionService. The aim of this
+ * interceptor is twofold: First, when UserTransaction.begin() is called, the
+ * result of the invocation, which is the transaction propagation context of
+ * the transaction started, is stored together with the target server used, so
+ * that future invocations can make use of the sticky target. Secondly, for the
+ * rest of UserTransaction invocations, i.e. commit(), getStatus()...etc, the
+ * current tpc is retrieved and the sticky target is located and added to the
+ * transient payload of the invocation.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class ClientUserTransactionStickyInterceptor extends AbstractTransactionStickyInterceptor
+{
+ @Override
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ putIfExistsTransactionTarget(invocation);
+ Object response = getNext().invoke(invocation);
+ invocationHasReachedAServer(invocation, response);
+ return response;
+ }
+
+ public void invocationHasReachedAServer(Invocation invocation, Object response)
+ {
+ Object tpc = getTransactionPropagationContext();
+ if (tpc == null)
+ {
+ /* If tpc is null when invoking a UserTransaction operation, begin()
+ * is being called, so we remember the target where the transaction
+ * was started.
+ */
+ rememberTransactionTarget(invocation, response);
+ }
+ }
+}
Property changes on: trunk/cluster/src/main/org/jboss/proxy/ClientUserTransactionStickyInterceptor.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/cluster/src/main/org/jboss/proxy/TransactionStickyInterceptor.java
===================================================================
--- trunk/cluster/src/main/org/jboss/proxy/TransactionStickyInterceptor.java 2008-11-14 14:52:58 UTC (rev 81046)
+++ trunk/cluster/src/main/org/jboss/proxy/TransactionStickyInterceptor.java 2008-11-14 14:54:03 UTC (rev 81047)
@@ -1,42 +1,42 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.proxy;
-
-import org.jboss.invocation.Invocation;
-
-/**
- * Transaction sticky interceptor targeted for Home and Bean invocations. This
- * interceptor will put, if exists, the transaction sticky target into the
- * transient payload in the invocation so that the transaction sticky load
- * balance policy can use it.
- *
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class TransactionStickyInterceptor extends AbstractTransactionStickyInterceptor
-{
- @Override
- public Object invoke(Invocation invocation) throws Throwable
- {
- putIfExistsTransactionTarget(invocation);
- return getNext().invoke(invocation);
- }
-}
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.proxy;
+
+import org.jboss.invocation.Invocation;
+
+/**
+ * Transaction sticky interceptor targeted for Home and Bean invocations. This
+ * interceptor will put, if exists, the transaction sticky target into the
+ * transient payload in the invocation so that the transaction sticky load
+ * balance policy can use it.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class TransactionStickyInterceptor extends AbstractTransactionStickyInterceptor
+{
+ @Override
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ putIfExistsTransactionTarget(invocation);
+ return getNext().invoke(invocation);
+ }
+}
Property changes on: trunk/cluster/src/main/org/jboss/proxy/TransactionStickyInterceptor.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: trunk/cluster/src/resources/jboss-cache-manager.sar/META-INF/jboss-cache-configs.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: trunk/cluster/src/resources/jboss-cache-manager.sar/META-INF/jboss-cache-manager-jboss-beans.xml
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list