[jboss-svn-commits] JBL Code SVN: r22719 - in labs/jbossesb/workspace/skeagh/runtime/src: main/java/org/jboss/esb/federate/bus and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Sep 12 11:04:56 EDT 2008
Author: tfennelly
Date: 2008-09-12 11:04:56 -0400 (Fri, 12 Sep 2008)
New Revision: 22719
Added:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/package.html
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/NotificationListener.java
Modified:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/LocalDispatcherTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java
Log:
Introduced a Bus abstraction. Created the JMSBus and pulled the JMS specific stuff out of the DeploymentCoordinator.
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-12 13:25:04 UTC (rev 22718)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-12 15:04:56 UTC (rev 22719)
@@ -25,23 +25,19 @@
import org.jboss.esb.classpath.ClassUtil;
import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.federate.bus.Bus;
+import org.jboss.esb.federate.bus.jms.JMSBus;
import org.jboss.esb.federate.notify.AbstractDeploymentNotification;
import org.jboss.esb.federate.notify.DeploymentDetailsNotification;
import org.jboss.esb.federate.notify.DeploymentHeartbeatNotification;
import org.jboss.esb.federate.notify.DeploymentUndeployNotification;
-import org.jboss.esb.jms.AbstractMessageListener;
-import org.jboss.esb.jms.JMSSession;
-import org.jboss.esb.jms.MessageSender;
+import org.jboss.esb.federate.notify.NotificationListener;
import org.jboss.esb.properties.ApplicationProperties;
+import org.jboss.esb.routing.RoutingException;
import org.jboss.esb.schedule.AbstractScheduleListener;
import org.jboss.esb.schedule.SchedulingException;
import org.jboss.esb.util.AssertArgument;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Topic;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -103,26 +99,10 @@
*/
private DeploymentDetailsNotification detailsNotification;
/**
- * Shared JMS Topic Session.
+ * JMS Bus. Will be dynamically loading this soon! Will support different bus types.
*/
- private JMSSession topicSession;
+ private BusDeployment jmsBusDeployment;
/**
- * Shared JMS Topic Session.
- */
- private JMSSession queueSession;
- /**
- * Deployment coordination listener.
- */
- private CoordinationListener coordinationListener;
- /**
- * Deployment coordination broadcaster.
- */
- private MessageSender coordinationBroadcaster;
- /**
- * Deployment monitors.
- */
- private Map<String, DeploymentMonitor> deploymentMonitors = new ConcurrentHashMap<String, DeploymentMonitor>();
- /**
* Coordinator monitor timeout. The number of milliseconds before a deployment is marked as offline.
*/
private long monitorTimeout;
@@ -149,50 +129,35 @@
@Initialize
public final void initialize() throws DeploymentException
{
- ApplicationProperties localBusProperties;
- try
- {
- localBusProperties = DeploymentCoordinator.getBusConfig("jms", runtime.getDeploymentName());
- }
- catch (IOException e)
- {
- throw new DeploymentException("Failed to read local bus deployment configuration", e);
- }
+ // TODO: JMSBus is temporarily hardwired in... pull it out and generalise later...
+ JMSBus bus = new JMSBus();
+ bus.setDeploymentName(runtime.getDeploymentName());
+ bus.setDeploymentId(runtime.getDeploymentId());
- if (localBusProperties != null)
+ bus.connect();
+
+ if(bus.isConnected())
{
- intialiseJMSSessions(localBusProperties);
+ ApplicationProperties busProperties = bus.getBusProperties();
- if (topicSession != null)
+ try
{
- try
- {
- connectCoordinationListener(localBusProperties);
- }
- catch (Throwable t)
- {
- closeJMSSessions();
- throw new DeploymentException("Failed to connect coordination listener", t);
- }
- if (coordinationListener != null && coordinationListener.isConnected())
- {
- try
- {
- connectCoordinationBroadcaster(localBusProperties);
-
- // Tell all other deployments we're online, what services we have etc...
- sendNotification(detailsNotification);
- }
- catch (Throwable t)
- {
- closeJMSSessions();
- throw new DeploymentException("Unable to initialize Deployment Coordinator.", t);
- }
-
- // Set the monitoring timeout - 4 heartbeats...
- monitorTimeout = (localBusProperties.getLongProperty(COORDINATOR_HEARTBEAT_FREQUENCY_KEY, COORDINATOR_HEARTBEAT_DEFAULT_FREQUENCY) * 4);
- }
+ // Tell the other deployments using this bus that this deployment is online...
+ bus.sendNotification(detailsNotification);
}
+ catch (RoutingException e)
+ {
+ bus.close();
+ logger.error("Unable to start Bus. Failed to deliver Deployment Details Notification (on statrup) to bus '" + bus.getClass().getName() + "'.", e);
+ return;
+ }
+
+ // Set the monitoring timeout - 4 heartbeats...
+ // TODO: Move this to a deployment related config i.e. a non-bus related config
+ monitorTimeout = (busProperties.getLongProperty(COORDINATOR_HEARTBEAT_FREQUENCY_KEY, COORDINATOR_HEARTBEAT_DEFAULT_FREQUENCY) * 4);
+ jmsBusDeployment = new BusDeployment(bus);
+
+ // TODO: For each bus... attach the appropriate dispatchers based on the local service/router config...
}
}
@@ -202,41 +167,20 @@
@Uninitialize
public final void uninitialize()
{
- try
+ if(jmsBusDeployment != null)
{
- // Tell all other deployments we're no longer online...
- sendNotification(DeploymentUndeployNotification.toNotification(runtime));
- }
- catch (Throwable t)
- {
- logger.warn("Error sending undeploy notification'.", t);
- }
-
- if (coordinationListener != null && coordinationListener.isConnected())
- {
try
{
- coordinationListener.close();
+ // Tell all other deployments we're no longer online...
+ jmsBusDeployment.bus.sendNotification(DeploymentUndeployNotification.toNotification(runtime));
}
catch (Throwable t)
{
- logger.warn("Error closing deployment coordination listener for deployment '" + runtime.getDeploymentName() + "'.", t);
+ logger.warn("Error sending undeploy notification'.", t);
}
- }
- if (coordinationBroadcaster != null && coordinationBroadcaster.isConnected())
- {
- try
- {
- coordinationBroadcaster.close();
- }
- catch (Throwable t)
- {
- logger.warn("Error closing deployment coordination broadcaster for deployment '" + runtime.getDeploymentName() + "'.", t);
- }
+ jmsBusDeployment.bus.close();
}
-
- closeJMSSessions();
}
/**
@@ -246,27 +190,17 @@
*/
public final void onSchedule() throws SchedulingException
{
- if (coordinationBroadcaster != null)
+ if (jmsBusDeployment != null)
{
try
{
if (broadcastHeartbeat)
{
- // Tell all other deployments we're alive...
- sendNotification(heartbeatNotification);
+ // Tell all other deployments we're still alive...
+ jmsBusDeployment.bus.sendNotification(heartbeatNotification);
}
- // TODO: Do we need to synchronize this? The ConcurrentHashMap docs would suggest it's OK to iterate the Map as long as you don't use an Iterator....
- long currentTime = System.currentTimeMillis();
- Set<Map.Entry<String, DeploymentMonitor>> deploymentMonitorSet = deploymentMonitors.entrySet();
- for (Map.Entry<String, DeploymentMonitor> entry : deploymentMonitorSet)
- {
- DeploymentMonitor deploymentMonitor = entry.getValue();
- if (currentTime > deploymentMonitor.lastHeartbeat + monitorTimeout)
- {
- deploymentMonitor.online = false;
- }
- }
+ jmsBusDeployment.checkMonitors();
}
catch (Throwable t)
{
@@ -292,104 +226,10 @@
*/
public final Map<String, DeploymentMonitor> getDeploymentMonitors()
{
- return deploymentMonitors;
+ return jmsBusDeployment.deploymentMonitors;
}
/**
- * Coordination Event Listener.
- */
- private class CoordinationListener extends AbstractMessageListener
- {
-
- /**
- * Constructor.
- *
- * @param destinationName Destination name.
- * @param jndiProperties JNDI properties.
- */
- protected CoordinationListener(final String destinationName, final Properties jndiProperties)
- {
- super(destinationName, topicSession, jndiProperties);
- }
-
- /**
- * Handle a coordination event from other deployments.
- *
- * @param message Coordination message.
- */
- public final void onMessage(final Message message)
- {
- if (message instanceof ObjectMessage)
- {
- try
- {
- Object objectMessage = ((ObjectMessage) message).getObject();
-
- if (objectMessage instanceof AbstractDeploymentNotification)
- {
- AbstractDeploymentNotification notification = (AbstractDeploymentNotification) objectMessage;
- String deploymentId = notification.getId();
-
- // If it's not a notification from this deployment...
- if (!runtime.getDeploymentId().equals(deploymentId))
- {
- if (notification instanceof DeploymentHeartbeatNotification)
- {
- DeploymentMonitor deploymentMonitor = deploymentMonitors.get(deploymentId);
- if (deploymentMonitor != null)
- {
- deploymentMonitor.lastHeartbeat = System.currentTimeMillis();
- deploymentMonitor.online = true;
- }
- else
- {
- logger.warn("Deployment '" + runtime.getDeploymentName() + ":" + runtime.getDeploymentId() + "' received heartbeat from unknown deployment '" + notification.getName() + ":" + notification.getId() + "'.");
- }
- }
- else if (notification instanceof DeploymentDetailsNotification)
- {
- if (!deploymentMonitors.containsKey(deploymentId))
- {
- DeploymentDetailsNotification deployNotification = (DeploymentDetailsNotification) notification;
-
- // New deployment. Add a monitor...
- deploymentMonitors.put(deploymentId, new DeploymentMonitor(deployNotification.getServiceSet()));
- // Send out the deployment details of this deployment so the new deployment
- // can register them....
- sendNotification(detailsNotification);
- }
- }
- else if (notification instanceof DeploymentUndeployNotification)
- {
- deploymentMonitors.remove(notification.getId());
- }
- }
- }
- }
- catch (JMSException e)
- {
- logger.warn("Unable to get Object from JMS ObjectMessage.", e);
- }
- }
- }
-
- }
-
- /**
- * Send a coordination notification.
- *
- * @param notification The notification to be sent.
- * @throws JMSException An error occured while sending notification.
- */
- private void sendNotification(final AbstractDeploymentNotification notification) throws JMSException
- {
- if (coordinationBroadcaster != null)
- {
- coordinationBroadcaster.send(coordinationBroadcaster.getSession().createObjectMessage(notification));
- }
- }
-
- /**
* Get the bus configuration for the specified protocol and deployment name combination.
* <p/>
* Checks in the following order:
@@ -475,172 +315,101 @@
}
/**
- * Connect the deployment coordination listener.
- *
- * @param localBusProperties Bus configuration properties.
+ * JBoss ESB Deployment.
*/
- private void connectCoordinationListener(final Properties localBusProperties)
+ private class BusDeployment
{
- String coordinationTopicName = localBusProperties.getProperty(DEPLOYMENT_COORDINTATION_TOPIC_KEY, DEFAULT_DEPLOYMENT_COORDINTATION_TOPIC_NAME);
-
- coordinationListener = new CoordinationListener(coordinationTopicName, localBusProperties);
- try
- {
- coordinationListener.connect();
- }
- catch (JMSException e)
- {
- coordinationListener = null;
- logger.info("Deployment '" + runtime.getDeploymentName() + "' is not being coordinated with any other local deployment. Turn on deug logging for more details.");
- if (logger.isDebugEnabled())
- {
- logger.debug("Deployment '" + runtime.getDeploymentName() + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
- + "to connect to the deployment coordination Topic '" + coordinationTopicName + "'. The JMS Server must be running and this Topic must be deployed. "
- + "JNDI properties used: " + localBusProperties);
- }
- }
- }
-
- /**
- * Connect the deployment coordination broadcaster.
- *
- * @param localBusProperties Bus configuration properties.
- * @throws DeploymentException Failed to connect deployment coordination broadcaster.
- */
- private void connectCoordinationBroadcaster(final Properties localBusProperties) throws DeploymentException
- {
- String coordinationTopicName = localBusProperties.getProperty(DEPLOYMENT_COORDINTATION_TOPIC_KEY, DEFAULT_DEPLOYMENT_COORDINTATION_TOPIC_NAME);
-
- coordinationBroadcaster = new MessageSender(coordinationTopicName, topicSession);
- try
- {
- coordinationBroadcaster.connect();
- }
- catch (JMSException e)
- {
- coordinationBroadcaster = null;
- throw new DeploymentException("Deployment '" + runtime.getDeploymentName() + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
- + "to connect to the deployment coordination Topic '" + coordinationTopicName + "'. The JMS Server must be running and this Topic must be deployed. "
- + "JNDI properties used: " + localBusProperties, e);
- }
- }
-
- /**
- * Deployment Monitor.
- */
- public final class DeploymentMonitor
- {
-
/**
- * Time of last received heartbeat.
+ * The Bus.
*/
- private long lastHeartbeat;
-
+ private Bus bus;
/**
- * Deployment Service Sets.
+ * Bus notification listener.
*/
- private DeploymentServiceSets serviceSets;
-
+ private NotificationListener notificationListener = new BusNotificationListener();
/**
- * Deployment online/offline flag.
+ * Deployment monitors - monitoring other deployments using this bus.
*/
- private boolean online;
+ private Map<String, DeploymentMonitor> deploymentMonitors = new ConcurrentHashMap<String, DeploymentMonitor>();
/**
- * Constructor.
- *
- * @param serviceSets Deployment Service sets.
+ * Private constructor.
+ * @param bus The Bus.
*/
- private DeploymentMonitor(final DeploymentServiceSets serviceSets)
+ private BusDeployment(final Bus bus)
{
- this.lastHeartbeat = System.currentTimeMillis();
- this.serviceSets = serviceSets;
- this.online = true;
+ this.bus = bus;
+ bus.setNotificationListener(notificationListener);
}
/**
- * Is the deployment online.
- *
- * @return True if the deployment is online, otherwise false.
+ * Bus notification listener.
*/
- public boolean isOnline()
+ private class BusNotificationListener implements NotificationListener
{
- return online;
- }
- /**
- * Get the DeploymentServiceSets associated with the monitored deployment.
- *
- * @return The DeploymentServiceSets.
- */
- public DeploymentServiceSets getServiceSets()
- {
- return serviceSets;
- }
+ /**
+ * Deployment notification handler.
+ *
+ * @param notification The notification.
+ */
+ public final void onNotification(final AbstractDeploymentNotification notification)
+ {
+ String deploymentId = notification.getId();
- /**
- * Monitor toString.
- *
- * @return String representation of the monitor.
- */
- public String toString()
- {
- return "{online=" + online + "} " + serviceSets.toString();
- }
+ if (notification instanceof DeploymentHeartbeatNotification)
+ {
+ DeploymentMonitor deploymentMonitor = deploymentMonitors.get(deploymentId);
+ if (deploymentMonitor != null)
+ {
+ deploymentMonitor.setLastHeartbeat(System.currentTimeMillis());
+ deploymentMonitor.setOnline(true);
+ }
+ else
+ {
+ logger.warn("Deployment '" + runtime.getDeploymentName() + ":" + runtime.getDeploymentId() + "' received heartbeat from unknown deployment '" + notification.getName() + ":" + notification.getId() + "'.");
+ }
+ }
+ else if (notification instanceof DeploymentDetailsNotification)
+ {
+ if (!deploymentMonitors.containsKey(deploymentId))
+ {
+ DeploymentDetailsNotification deployNotification = (DeploymentDetailsNotification) notification;
- }
-
- /**
- * Initialize the shared JMS Sessions.
- *
- * @param localBusProperties Local JMS Bus properties.
- */
- private void intialiseJMSSessions(final ApplicationProperties localBusProperties)
- {
- topicSession = new JMSSession(Topic.class, localBusProperties);
- try
- {
- topicSession.connect();
+ // New deployment. Add a monitor...
+ deploymentMonitors.put(deploymentId, new DeploymentMonitor(deployNotification.getServiceSet()));
+ // Send out the deployment details of this deployment so the new deployment
+ // can register them....
+ try
+ {
+ bus.sendNotification(detailsNotification);
+ }
+ catch (RoutingException e)
+ {
+ logger.error("Failed to send DeploymentDetails notification broadcast out onto Bus (" + bus.getClass().getName() + ").", e);
+ }
+ }
+ }
+ else if (notification instanceof DeploymentUndeployNotification)
+ {
+ deploymentMonitors.remove(notification.getId());
+ }
+ }
}
- catch (Throwable t)
- {
- closeJMSSessions();
- logger.debug("Failed to connect shared deployment JMS Topic Session.", t);
- return;
- }
- queueSession = new JMSSession(Queue.class, localBusProperties);
- try
- {
- queueSession.connect();
- }
- catch (Throwable t)
- {
- closeJMSSessions();
- logger.debug("Failed to connect shared deployment JMS Queue Session.", t);
- }
- }
- /**
- * Close the JMS Sessions.
- */
- private void closeJMSSessions()
- {
- // Close the sessions...
- if (topicSession != null)
+ private void checkMonitors()
{
- if (topicSession.isConnected())
+ // TODO: Do we need to synchronize this? The ConcurrentHashMap docs would suggest it's OK to iterate the Map as long as you don't use an Iterator....
+ long currentTime = System.currentTimeMillis();
+ Set<Map.Entry<String, DeploymentMonitor>> deploymentMonitorSet = deploymentMonitors.entrySet();
+ for (Map.Entry<String, DeploymentMonitor> entry : deploymentMonitorSet)
{
- topicSession.close();
+ DeploymentMonitor deploymentMonitor = entry.getValue();
+ if (currentTime > deploymentMonitor.getLastHeartbeat() + monitorTimeout)
+ {
+ deploymentMonitor.setOnline(false);
+ }
}
- topicSession = null;
}
- if (queueSession != null)
- {
- if (queueSession.isConnected())
- {
- queueSession.close();
- }
- queueSession = null;
- }
}
}
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java 2008-09-12 15:04:56 UTC (rev 22719)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate;
+
+import org.jboss.esb.util.AssertArgument;
+
+/**
+ * Deployment Monitor.
+ * <p/>
+ * A Deployment Monitor is an object that contains data about the state and status
+ * of a deployment being monitored by the local deployment. This information is
+ * needed by the local deployment for managing routing of message to other deployments.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DeploymentMonitor
+{
+
+ /**
+ * Time of last received heartbeat.
+ */
+ private long lastHeartbeat;
+
+ /**
+ * Deployment Service Sets.
+ */
+ private DeploymentServiceSets serviceSets;
+
+ /**
+ * Deployment online/offline flag.
+ */
+ private boolean online;
+
+ /**
+ * Constructor.
+ *
+ * @param serviceSets Deployment Service sets.
+ */
+ public DeploymentMonitor(final DeploymentServiceSets serviceSets)
+ {
+ AssertArgument.isNotNull(serviceSets, "serviceSets");
+ this.lastHeartbeat = System.currentTimeMillis();
+ this.serviceSets = serviceSets;
+ this.online = true;
+ }
+
+ /**
+ * Get the time of the last heartbeat received on this monitored deployment.
+ * @return The time of the last heartbeat.
+ */
+ public final long getLastHeartbeat()
+ {
+ return lastHeartbeat;
+ }
+
+ /**
+ * Get the time of the last heartbeat received on this monitored deployment.
+ * @param lastHeartbeat The time of the last heartbeat.
+ */
+ public final void setLastHeartbeat(final long lastHeartbeat)
+ {
+ this.lastHeartbeat = lastHeartbeat;
+ }
+
+ /**
+ * Is the deployment online.
+ *
+ * @return True if the deployment is online, otherwise false.
+ */
+ public final boolean isOnline()
+ {
+ return online;
+ }
+
+ /**
+ * Set the deployment online/offline.
+ * @param online True if the deployment is online, otherwise false.
+ */
+ public final void setOnline(final boolean online)
+ {
+ this.online = online;
+ }
+
+ /**
+ * Get the DeploymentServiceSets associated with the monitored deployment.
+ *
+ * @return The DeploymentServiceSets.
+ */
+ public final DeploymentServiceSets getServiceSets()
+ {
+ return serviceSets;
+ }
+
+ /**
+ * Monitor toString.
+ *
+ * @return String representation of the monitor.
+ */
+ public final String toString()
+ {
+ return "{online=" + online + "} " + serviceSets.toString();
+ }
+
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java 2008-09-12 15:04:56 UTC (rev 22719)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate.bus;
+
+import org.jboss.esb.federate.notify.AbstractDeploymentNotification;
+import org.jboss.esb.federate.notify.NotificationListener;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.routing.MessageDispatcher;
+import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentException;
+
+/**
+ * JBoss ESB Bus definition.
+ * <p/>
+ * Implementations of this interface act as the interface to a specfic
+ * message aware Bus implementation, for the local deployment.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface Bus
+{
+ /**
+ * Set the deploymentName for the local deployment.
+ *
+ * @param deploymentName The deployment Name.
+ */
+ void setDeploymentName(String deploymentName);
+
+ /**
+ * Set the deploymentId for the local deployment.
+ *
+ * @param deploymentId The deployment ID.
+ */
+ void setDeploymentId(String deploymentId);
+
+ /**
+ * Connect the bus.
+ * @throws DeploymentException Connection exception.
+ */
+ void connect() throws DeploymentException;
+
+ /**
+ * Is the bus connected.
+ * @return True if the bus is connected, otherwise false.
+ */
+ boolean isConnected();
+
+ /**
+ * Close the Bus.
+ */
+ void close();
+
+ /**
+ * Send the supplied message to the specified service on the specified
+ * deployment via the bus.
+ *
+ * @param message The message.
+ * @param service The target service.
+ * @param serviceDeploymentId The deployment ID on which the Service is located.
+ * @throws RoutingException Error sending message onto the Bus.
+ */
+ void send(Message message, ServiceName service, String serviceDeploymentId) throws RoutingException;
+
+ /**
+ * Add a message dispatcher for receiving messages from the bus for
+ * the specified local service.
+ *
+ * @param dispatcher The message dispatcher.
+ * @param service The target service.
+ */
+ void addDispatcher(MessageDispatcher dispatcher, ServiceName service);
+
+ /**
+ * Set the bus notification listener.
+ *
+ * @param listener Notification listener.
+ */
+ void setNotificationListener(NotificationListener listener);
+
+ /**
+ * Send a notification message onto the Bus.
+ * <p/>
+ * This allows notification messages to be exchanged with other deployments
+ * using the underlying Bus (deployment details, heartbeat, undeploy etc).
+ *
+ * @param notification The notification message to be sent onto the Bus.
+ * @throws RoutingException Error sending notification onto the Bus.
+ */
+ void sendNotification(AbstractDeploymentNotification notification) throws RoutingException;
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java 2008-09-12 15:04:56 UTC (rev 22719)
@@ -0,0 +1,429 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate.bus.jms;
+
+import org.apache.log4j.Logger;
+import org.jboss.esb.deploy.DeploymentException;
+import org.jboss.esb.federate.DeploymentCoordinator;
+import org.jboss.esb.federate.bus.Bus;
+import org.jboss.esb.federate.notify.AbstractDeploymentNotification;
+import org.jboss.esb.federate.notify.NotificationListener;
+import org.jboss.esb.jms.AbstractMessageListener;
+import org.jboss.esb.jms.JMSSession;
+import org.jboss.esb.jms.MessageSender;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.properties.ApplicationProperties;
+import org.jboss.esb.routing.MessageDispatcher;
+import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.service.ServiceName;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.Topic;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * ESB Bus implementation for JMS.
+ * <p/>
+ * Acts as the interface to the JMS Bus for the local deployment.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JMSBus implements Bus
+{
+ /**
+ * Logger.
+ */
+ private static Logger logger = Logger.getLogger(JMSBus.class);
+ /**
+ * Bus Properties.
+ */
+ private ApplicationProperties busProperties;
+ /**
+ * Deployment name.
+ */
+ private String deploymentName;
+ /**
+ * The deployment ID.
+ */
+ private String deploymentId;
+ /**
+ * Shared JMS Topic Session.
+ */
+ private JMSSession topicSession;
+ /**
+ * Shared JMS Topic Session.
+ */
+ private JMSSession queueSession;
+ /**
+ * Deployment coordination listener.
+ */
+ private DeploymentNotificationListener deploymentNotificationListener;
+ /**
+ * Deployment notification broadcaster.
+ */
+ private MessageSender notificationBroadcaster;
+ /**
+ * Notification listener.
+ */
+ private NotificationListener notificationListener;
+
+ /**
+ * Get the Bus configuration properties.
+ * @return The bus configuration properties.
+ */
+ public final ApplicationProperties getBusProperties()
+ {
+ return busProperties;
+ }
+
+ /**
+ * Set the deploymentName for the local deployment.
+ *
+ * @param deploymentName The deployment Name.
+ */
+ public final void setDeploymentName(final String deploymentName)
+ {
+ this.deploymentName = deploymentName;
+ }
+
+ /**
+ * Set the deploymentId for the local deployment.
+ *
+ * @param deploymentId The deployment ID.
+ */
+ public final void setDeploymentId(final String deploymentId)
+ {
+ this.deploymentId = deploymentId;
+ }
+
+ /**
+ * Connect the bus.
+ * @throws DeploymentException Connection exception.
+ */
+ public final void connect() throws DeploymentException
+ {
+ if(deploymentName == null)
+ {
+ throw new IllegalStateException("'deploymentName' not set on Bus.");
+ }
+ else if(deploymentId == null)
+ {
+ throw new IllegalStateException("'deploymentId' not set on Bus.");
+ }
+
+ try
+ {
+ busProperties = DeploymentCoordinator.getBusConfig("jms", deploymentName);
+ }
+ catch (IOException e)
+ {
+ throw new DeploymentException("Failed to read local bus deployment configuration", e);
+ }
+
+ if (busProperties != null)
+ {
+ intialiseJMSResources(busProperties);
+
+ if (topicSession != null)
+ {
+ try
+ {
+ connectNotificationListener(busProperties);
+ }
+ catch (Throwable t)
+ {
+ closeJMSResources();
+ throw new DeploymentException("Failed to connect coordination listener", t);
+ }
+ if (deploymentNotificationListener != null && deploymentNotificationListener.isConnected())
+ {
+ try
+ {
+ connectNotificationBroadcaster(busProperties);
+ }
+ catch (Throwable t)
+ {
+ closeJMSResources();
+ throw new DeploymentException("Unable to initialize Deployment Coordinator.", t);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Close the Bus.
+ */
+ public final void close()
+ {
+ if (deploymentNotificationListener != null && deploymentNotificationListener.isConnected())
+ {
+ try
+ {
+ deploymentNotificationListener.close();
+ }
+ catch (Throwable t)
+ {
+ logger.warn("Error closing deployment coordination listener for deployment '" + deploymentName + "'.", t);
+ }
+ }
+
+ if (notificationBroadcaster != null && notificationBroadcaster.isConnected())
+ {
+ try
+ {
+ notificationBroadcaster.close();
+ }
+ catch (Throwable t)
+ {
+ logger.warn("Error closing deployment coordination broadcaster for deployment '" + deploymentName + "'.", t);
+ }
+ }
+
+ closeJMSResources();
+ }
+
+ /**
+ * Send the supplied message to the specified service on the specified
+ * deployment via the bus.
+ *
+ * @param message The message.
+ * @param service The target service.
+ * @param serviceDeploymentId The deployment ID on which the Service is located.
+ * @throws RoutingException Error sending message onto the Bus.
+ */
+ public final void send(final Message message, final ServiceName service, final String serviceDeploymentId) throws RoutingException
+ {
+
+ }
+
+ /**
+ * Add a message dispatcher for receiving messages from the bus for
+ * the specified local service.
+ *
+ * @param dispatcher The message dispatcher.
+ * @param service The target service.
+ */
+ public final void addDispatcher(final MessageDispatcher dispatcher, final ServiceName service)
+ {
+
+ }
+
+ /**
+ * Set the bus notification listener.
+ *
+ * @param listener Notification listener.
+ */
+ public final void setNotificationListener(final NotificationListener listener)
+ {
+ this.notificationListener = listener;
+ }
+
+ /**
+ * Send a notification message onto the Bus.
+ * <p/>
+ * This allows notification messages to be exchanged with other deployments
+ * using the underlying Bus (deployment details, heartbeat, undeploy etc).
+ *
+ * @param notification The notification message to be sent onto the Bus.
+ * @throws RoutingException Error sending notification onto the Bus.
+ */
+ public final void sendNotification(final AbstractDeploymentNotification notification) throws RoutingException
+ {
+ if (notificationBroadcaster != null)
+ {
+ try
+ {
+ notificationBroadcaster.send(notificationBroadcaster.getSession().createObjectMessage(notification));
+ }
+ catch (JMSException e)
+ {
+ throw new RoutingException("Unable to send deployment notification onto JMS Bus.", e);
+ }
+ }
+ }
+
+ /**
+ * Is the bus connected.
+ * @return True if the bus is connected, otherwise false.
+ */
+ public final boolean isConnected()
+ {
+ return (topicSession != null && queueSession != null);
+ }
+
+ /**
+ * Deployment Notification Listener.
+ */
+ private class DeploymentNotificationListener extends AbstractMessageListener
+ {
+ /**
+ * Constructor.
+ *
+ * @param destinationName Destination name.
+ * @param jndiProperties JNDI properties.
+ */
+ protected DeploymentNotificationListener(final String destinationName, final Properties jndiProperties)
+ {
+ super(destinationName, topicSession, jndiProperties);
+ }
+
+ /**
+ * Handle a coordination event from other deployments.
+ *
+ * @param message Coordination message.
+ */
+ public final void onMessage(final javax.jms.Message message)
+ {
+ if (message instanceof ObjectMessage)
+ {
+ try
+ {
+ Object objectMessage = ((ObjectMessage) message).getObject();
+
+ if (objectMessage instanceof AbstractDeploymentNotification)
+ {
+ AbstractDeploymentNotification notification = (AbstractDeploymentNotification) objectMessage;
+ String messageDeploymentId = notification.getId();
+
+ // If it's not a notification from this deployment...
+ if (!deploymentId.equals(messageDeploymentId))
+ {
+ notificationListener.onNotification(notification);
+ }
+ }
+ }
+ catch (JMSException e)
+ {
+ logger.warn("Unable to get Object from JMS ObjectMessage.", e);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Connect the deployment coordination listener.
+ *
+ * @param localBusProperties Bus configuration properties.
+ */
+ private void connectNotificationListener(final Properties localBusProperties)
+ {
+ String coordinationTopicName = localBusProperties.getProperty(DeploymentCoordinator.DEPLOYMENT_COORDINTATION_TOPIC_KEY, DeploymentCoordinator.DEFAULT_DEPLOYMENT_COORDINTATION_TOPIC_NAME);
+
+ deploymentNotificationListener = new DeploymentNotificationListener(coordinationTopicName, localBusProperties);
+ try
+ {
+ deploymentNotificationListener.connect();
+ }
+ catch (JMSException e)
+ {
+ deploymentNotificationListener = null;
+ logger.info("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment. Turn on deug logging for more details.");
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ + "to connect to the deployment coordination Topic '" + coordinationTopicName + "'. The JMS Server must be running and this Topic must be deployed. "
+ + "JNDI properties used: " + localBusProperties);
+ }
+ }
+ }
+
+ /**
+ * Connect the deployment coordination broadcaster.
+ *
+ * @param localBusProperties Bus configuration properties.
+ * @throws org.jboss.esb.deploy.DeploymentException Failed to connect deployment coordination broadcaster.
+ */
+ private void connectNotificationBroadcaster(final Properties localBusProperties) throws DeploymentException
+ {
+ String coordinationTopicName = localBusProperties.getProperty(DeploymentCoordinator.DEPLOYMENT_COORDINTATION_TOPIC_KEY, DeploymentCoordinator.DEFAULT_DEPLOYMENT_COORDINTATION_TOPIC_NAME);
+
+ notificationBroadcaster = new MessageSender(coordinationTopicName, topicSession);
+ try
+ {
+ notificationBroadcaster.connect();
+ }
+ catch (JMSException e)
+ {
+ notificationBroadcaster = null;
+ throw new DeploymentException("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ + "to connect to the deployment coordination Topic '" + coordinationTopicName + "'. The JMS Server must be running and this Topic must be deployed. "
+ + "JNDI properties used: " + localBusProperties, e);
+ }
+ }
+
+ /**
+ * Initialize the shared JMS Sessions.
+ *
+ * @param localBusProperties Local JMS Bus properties.
+ */
+ private void intialiseJMSResources(final ApplicationProperties localBusProperties)
+ {
+ topicSession = new JMSSession(Topic.class, localBusProperties);
+ try
+ {
+ topicSession.connect();
+ }
+ catch (Throwable t)
+ {
+ closeJMSResources();
+ logger.debug("Failed to connect shared deployment JMS Topic Session.", t);
+ return;
+ }
+ queueSession = new JMSSession(Queue.class, localBusProperties);
+ try
+ {
+ queueSession.connect();
+ }
+ catch (Throwable t)
+ {
+ closeJMSResources();
+ logger.debug("Failed to connect shared deployment JMS Queue Session.", t);
+ }
+ }
+
+ /**
+ * Close the JMS Sessions.
+ */
+ private void closeJMSResources()
+ {
+ // Close the sessions...
+ if (topicSession != null)
+ {
+ if (topicSession.isConnected())
+ {
+ topicSession.close();
+ }
+ topicSession = null;
+ }
+ if (queueSession != null)
+ {
+ if (queueSession.isConnected())
+ {
+ queueSession.close();
+ }
+ queueSession = null;
+ }
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/package.html (from rev 22681, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/package.html)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/package.html 2008-09-12 15:04:56 UTC (rev 22719)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+ESB Bus for message aware comms between ESB Deployments.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/NotificationListener.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/NotificationListener.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/NotificationListener.java 2008-09-12 15:04:56 UTC (rev 22719)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate.notify;
+
+/**
+ * Notification Listener interface.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface NotificationListener
+{
+ /**
+ * Deployment notification handler.
+ *
+ * @param notification The notification.
+ */
+ void onNotification(AbstractDeploymentNotification notification);
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/NotificationListener.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/LocalDispatcherTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/LocalDispatcherTest.java 2008-09-12 13:25:04 UTC (rev 22718)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/LocalDispatcherTest.java 2008-09-12 15:04:56 UTC (rev 22719)
@@ -22,8 +22,6 @@
import junit.framework.TestCase;
import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.config.DeploymentUnit;
-import org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester;
import org.jboss.esb.deploy.config.digest.DigestUtil;
import org.jboss.esb.routing.RoutingException;
import org.jboss.esb.service.ServiceName;
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java 2008-09-12 13:25:04 UTC (rev 22718)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java 2008-09-12 15:04:56 UTC (rev 22719)
@@ -46,18 +46,18 @@
try {
Thread.sleep(500);
DeploymentCoordinator coordinator2 = deployment2.getDeploymentCoordinator();
- DeploymentCoordinator.DeploymentMonitor monitor;
+ DeploymentMonitor monitor;
assertEquals(1, coordinator1.getDeploymentMonitors().size());
assertEquals(1, coordinator2.getDeploymentMonitors().size());
// So deployment1 should be monitoring deployment2...
- monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator1.getDeploymentMonitors().values().toArray()[0];
+ monitor = (DeploymentMonitor) coordinator1.getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
assertEquals("{online=true} deployment2:x[Services: [hello:goodbye]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
// And deployment2 should be monitoring deployment1...
- monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+ monitor = (DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
@@ -100,12 +100,12 @@
assertEquals(1, coordinator2.getDeploymentMonitors().size());
// So deployment1 should be monitoring deployment2...
- monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator1.getDeploymentMonitors().values().toArray()[0];
+ monitor = (DeploymentMonitor) coordinator1.getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
assertEquals("{online=true} deployment2:x[Services: [hello:goodbye]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
// And deployment2 should be monitoring deployment1...
- monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+ monitor = (DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
} finally {
@@ -139,18 +139,18 @@
try {
Thread.sleep(100);
DeploymentCoordinator coordinator2 = deployment2.getDeploymentCoordinator();
- DeploymentCoordinator.DeploymentMonitor monitor;
+ DeploymentMonitor monitor;
assertEquals(1, coordinator1.getDeploymentMonitors().size());
assertEquals(1, coordinator2.getDeploymentMonitors().size());
// So deployment1 should be monitoring deployment2...
- monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator1.getDeploymentMonitors().values().toArray()[0];
+ monitor = (DeploymentMonitor) coordinator1.getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
assertEquals("{online=true} deployment2:x[Services: [hello:goodbye]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
// And deployment2 should be monitoring deployment1...
- monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+ monitor = (DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
@@ -159,7 +159,7 @@
Thread.sleep(6000);
// deployment2 should see deployment1 as being offline now...
- monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+ monitor = (DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
assertEquals("{online=false} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
@@ -168,7 +168,7 @@
Thread.sleep(6000);
// deployment2 should see deployment1 as being online again...
- monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+ monitor = (DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
More information about the jboss-svn-commits
mailing list