From scm-return-32351-apmail-geronimo-scm-archive=geronimo.apache.org@geronimo.apache.org Wed Oct 01 18:27:24 2008 Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 49898 invoked from network); 1 Oct 2008 18:27:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Oct 2008 18:27:24 -0000 Received: (qmail 55350 invoked by uid 500); 1 Oct 2008 18:27:22 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 55309 invoked by uid 500); 1 Oct 2008 18:27:22 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 55300 invoked by uid 99); 1 Oct 2008 18:27:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 11:27:22 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 18:26:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9CF1C2388882; Wed, 1 Oct 2008 11:26:32 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r700858 - in /geronimo/server/trunk: assemblies/geronimo-boilerplate/src/main/underlay/etc/ framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ framework/modules/geronimo-plugin/src/main/java/org/apache/geronim... Date: Wed, 01 Oct 2008 18:26:31 -0000 To: scm@geronimo.apache.org From: dblevins@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081001182632.9CF1C2388882@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dblevins Date: Wed Oct 1 11:26:31 2008 New Revision: 700858 URL: http://svn.apache.org/viewvc?rev=700858&view=rev Log: Inroduced a MulticastLocation gbean that hold the mutlicast connection info so it can be configured in one place yet consumed by multiple gbeans. Added a HeartbeatMonitor ghsell command (not quite working) that will allow people to see what is moving on the heartbeat. Renamed FarmCommand to ClusterCommand and its flags to -c and --cluster Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ClusterCommand.groovy - copied, changed from r700201, geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/FarmCommand.groovy geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/HeartbeatCommand.groovy geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/HeartbeatMonitor.java geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastLocation.java geronimo/server/trunk/plugins/clustering/geronimo-plugin-farm/src/main/java/org/apache/geronimo/farm/plugin/HeartbeatMonitor.java Removed: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/FarmCommand.groovy Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/layout.xml geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastDiscoveryAgent.java geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastSearch.java geronimo/server/trunk/plugins/clustering/plugin-farm-member/pom.xml geronimo/server/trunk/plugins/clustering/plugin-farm-member/src/main/plan/plan.xml geronimo/server/trunk/plugins/clustering/plugin-farm/pom.xml geronimo/server/trunk/plugins/clustering/plugin-farm/src/main/plan/plan.xml Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/layout.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/layout.xml?rev=700858&r1=700857&r2=700858&view=diff ============================================================================== --- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/layout.xml (original) +++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/etc/layout.xml Wed Oct 1 11:26:31 2008 @@ -200,10 +200,21 @@ install-plugin geronimo-commands:install-plugin + + + + + cluster + + + + deploy + geronimo-commands:cluster + - farm - geronimo-commands:farm + heartbeat + geronimo-commands:heartbeat Copied: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ClusterCommand.groovy (from r700201, geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/FarmCommand.groovy) URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ClusterCommand.groovy?p2=geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ClusterCommand.groovy&p1=geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/FarmCommand.groovy&r1=700201&r2=700858&rev=700858&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/FarmCommand.groovy (original) +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ClusterCommand.groovy Wed Oct 1 11:26:31 2008 @@ -1,21 +1,21 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ package org.apache.geronimo.commands @@ -29,67 +29,67 @@ import org.apache.geronimo.system.plugin.Farm /** - * List plugins. - * - * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $ - */ -@CommandComponent (id = 'geronimo-commands:farm', description = 'administer farm') -class FarmCommand - extends ConnectCommand +* List plugins. +* +* @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $ +*/ +@CommandComponent (id = 'geronimo-commands:cluster', description = 'administer cluster') +class ClusterCommand + extends ConnectCommand { - @Option(name='-f', aliases=['--farm'], description='Farm to perform action on') - String farmName + @Option(name='-c', aliases=['--cluster'], description='Cluster to perform action on') + String clusterName - @Option(name='-l', aliases=['--pluginlist'], description='Plugin List to perform action on') - String pluginList + @Option(name='-l', aliases=['--pluginlist'], description='Plugin List to perform action on') + String pluginList - @Option(name='-a', aliases=['--pluginartifact'], description='Plugin Artifact to perform action on') - String plugin + @Option(name='-a', aliases=['--pluginartifact'], description='Plugin Artifact to perform action on') + String plugin - @Argument(metaVar='ACTION', required=true, index=0, description='Action (add/remove) to perform') - String action - - protected Object doExecute() throws Exception { - def connection = connect() - - def ConsoleReader consoleReader = new ConsoleReader(io.inputStream, io.out) - def repo = null - def plugins = null - - def deploymentManager = connection.getDeploymentManager(); - def Farm farm = (Farm)((RemoteDeploymentManager)deploymentManager).getImplementation(Farm.class); - def Map results; - if (action == "add") { - if (farmName && pluginList && plugin) { - results = farm.addPluginToCluster(farmName, pluginList, plugin); - } else if (farmName && pluginList) { - results = farm.addPluginList(farmName, pluginList); - } else if (pluginList && plugin) { - results = farm.addPlugin(pluginList, plugin); - } else { - io.out.println("add requires -f farm and -l plugin list, -l plugin list and -a plugin, or all three") - return; - } - } else if (action == "remove") { - if (farmName && pluginList && plugin) { - io.out.println("remove requires -f farm and -l plugin list, or -l plugin list and -a plugin, but not all three") - return; - } else if (farmName && pluginList) { - results = farm.removePluginListFromCluster(farmName, pluginList); - } else if (pluginList && plugin) { - results = farm.removePluginFromPluginList(pluginList, plugin); - } else { - io.out.println("remove requires -f farm and -l plugin list, or -l plugin list and -a plugin") - return; - } - } else { - io.out.println("unknown command, expecting add or remove") - return; - } - io.out.println("Results:") - for (Map.Entry entry in results) { - io.out.println("results for node: " + entry.getKey()); - CommandInstallCAR.printResults(consoleReader, entry.getValue(), 0); - } - } + @Argument(metaVar='ACTION', required=true, index=0, description='Action (add/remove) to perform') + String action + + protected Object doExecute() throws Exception { + def connection = connect() + + def ConsoleReader consoleReader = new ConsoleReader(io.inputStream, io.out) + def repo = null + def plugins = null + + def deploymentManager = connection.getDeploymentManager(); + def Farm farm = (Farm)((RemoteDeploymentManager)deploymentManager).getImplementation(Farm.class); + def Map results; + if (action == "add") { + if (clusterName && pluginList && plugin) { + results = farm.addPluginToCluster(clusterName, pluginList, plugin); + } else if (clusterName && pluginList) { + results = farm.addPluginList(clusterName, pluginList); + } else if (pluginList && plugin) { + results = farm.addPlugin(pluginList, plugin); + } else { + io.out.println("add requires -c and -l , -l and -a , or all three") + return; + } + } else if (action == "remove") { + if (clusterName && pluginList && plugin) { + io.out.println("remove requires -c and -l , or -l and -a , but not all three") + return; + } else if (clusterName && pluginList) { + results = farm.removePluginListFromCluster(clusterName, pluginList); + } else if (pluginList && plugin) { + results = farm.removePluginFromPluginList(pluginList, plugin); + } else { + io.out.println("remove requires -c and -l , or -l and -a ") + return; + } + } else { + io.out.println("unknown command, expecting add or remove") + return; + } + io.out.println("Results:") + for (Map.Entry entry in results) { + io.out.println("results for node: " + entry.getKey()); + CommandInstallCAR.printResults(consoleReader, entry.getValue(), 0); + } + } } Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/HeartbeatCommand.groovy URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/HeartbeatCommand.groovy?rev=700858&view=auto ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/HeartbeatCommand.groovy (added) +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/HeartbeatCommand.groovy Wed Oct 1 11:26:31 2008 @@ -0,0 +1,49 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.geronimo.commands + +import jline.ConsoleReader +import org.apache.geronimo.deployment.plugin.jmx.RemoteDeploymentManager +import org.apache.geronimo.gshell.clp.Argument +import org.apache.geronimo.gshell.clp.Option +import org.apache.geronimo.gshell.command.annotation.CommandComponent +import org.apache.geronimo.system.plugin.HeartbeatMonitor + +/** +* List plugins. +* +* @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $ +*/ +@CommandComponent (id = 'geronimo-commands:heartbeat', description = 'monitor cluster heartbeat') +class HeartbeatCommand + extends ConnectCommand +{ + @Option(name='-f', aliases=['--filter'], description='Regular expression to filter heartbeat data displayed') + String filter + + protected Object doExecute() throws Exception { + def connection = connect() + + def deploymentManager = connection.getDeploymentManager(); + def HeartbeatMonitor heartbeatmonitor = (HeartbeatMonitor)((RemoteDeploymentManager)deploymentManager).getImplementation(HeartbeatMonitor.class); + + heartbeatmonitor.monitor(io.inputStream, io.outputStream, filter) + } +} Added: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/HeartbeatMonitor.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/HeartbeatMonitor.java?rev=700858&view=auto ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/HeartbeatMonitor.java (added) +++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/HeartbeatMonitor.java Wed Oct 1 11:26:31 2008 @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.system.plugin; + +import java.io.InputStream; +import java.io.OutputStream; + +/** + * @version $Rev$ $Date$ + */ +public interface HeartbeatMonitor { + + void monitor(InputStream in, OutputStream output, String pattern); + +} Modified: geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastDiscoveryAgent.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastDiscoveryAgent.java?rev=700858&r1=700857&r2=700858&view=diff ============================================================================== --- geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastDiscoveryAgent.java (original) +++ geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastDiscoveryAgent.java Wed Oct 1 11:26:31 2008 @@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory; import org.apache.geronimo.gbean.annotation.GBean; import org.apache.geronimo.gbean.annotation.ParamAttribute; +import org.apache.geronimo.gbean.annotation.ParamReference; import org.apache.geronimo.gbean.GBeanLifecycle; /** @@ -83,8 +84,7 @@ private int maxReconnectAttempts = 10; // todo: check this out // --------------------------------- - public MulticastDiscoveryAgent(@ParamAttribute(name="host") String host, - @ParamAttribute(name="port") int port, + public MulticastDiscoveryAgent(@ParamReference(name="MulticastLocation")MulticastLocation location, @ParamAttribute(name="heartRate") long heartRate, @ParamAttribute(name="maxMissedHeartbeats") int maxMissedHeartbeats, @ParamAttribute(name="loopbackMode") boolean loopbackMode, @@ -93,8 +93,8 @@ @ParamAttribute(name="maxReconnectAttempts") int maxReconnectAttempts, @ParamAttribute(name="backOffMultiplier") long backOffMultiplier, @ParamAttribute(name="useExponentialBackOff") boolean useExponentialBackOff) { - this.host = host; - this.port = port; + this.host = location.getHost(); + this.port = location.getPort(); this.heartRate = heartRate; this.maxMissedHeartbeats = maxMissedHeartbeats; this.loopbackMode = loopbackMode; Added: geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastLocation.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastLocation.java?rev=700858&view=auto ============================================================================== --- geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastLocation.java (added) +++ geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastLocation.java Wed Oct 1 11:26:31 2008 @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.farm.discovery; + +import org.apache.geronimo.gbean.annotation.GBean; +import org.apache.geronimo.gbean.annotation.ParamAttribute; + +/** + * Simple Gbean that holds the multicast location info so that + * other gbeans can consume it without the information having + * to be replicated in other gbeans. + */ +@GBean +public class MulticastLocation { + + private final String host; + private final int port; + + public MulticastLocation(@ParamAttribute(name="host") String host, + @ParamAttribute(name="port") int port) { + this.host = host; + this.port = port; + } + + public String getHost() { + return host; + } + + public int getPort() { + return port; + } + +} Modified: geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastSearch.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastSearch.java?rev=700858&r1=700857&r2=700858&view=diff ============================================================================== --- geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastSearch.java (original) +++ geronimo/server/trunk/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/discovery/MulticastSearch.java Wed Oct 1 11:26:31 2008 @@ -20,6 +20,7 @@ import java.net.MulticastSocket; import java.net.InetAddress; import java.net.DatagramPacket; +import java.net.SocketException; import java.util.concurrent.TimeUnit; import java.io.IOException; @@ -74,6 +75,7 @@ return service; } } + } catch (SocketException e) { } finally { long stop = System.currentTimeMillis(); waited += stop - start; Added: geronimo/server/trunk/plugins/clustering/geronimo-plugin-farm/src/main/java/org/apache/geronimo/farm/plugin/HeartbeatMonitor.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-plugin-farm/src/main/java/org/apache/geronimo/farm/plugin/HeartbeatMonitor.java?rev=700858&view=auto ============================================================================== --- geronimo/server/trunk/plugins/clustering/geronimo-plugin-farm/src/main/java/org/apache/geronimo/farm/plugin/HeartbeatMonitor.java (added) +++ geronimo/server/trunk/plugins/clustering/geronimo-plugin-farm/src/main/java/org/apache/geronimo/farm/plugin/HeartbeatMonitor.java Wed Oct 1 11:26:31 2008 @@ -0,0 +1,92 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.farm.plugin; + + +import org.apache.geronimo.gbean.annotation.GBean; +import org.apache.geronimo.gbean.annotation.ParamReference; +import org.apache.geronimo.farm.discovery.MulticastLocation; +import org.apache.geronimo.farm.discovery.MulticastSearch; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.regex.Pattern; +import java.util.regex.Matcher; +import java.util.concurrent.atomic.AtomicBoolean; +import java.net.URI; + +@GBean +public class HeartbeatMonitor implements org.apache.geronimo.system.plugin.HeartbeatMonitor { + + private final MulticastLocation location; + + public HeartbeatMonitor(@ParamReference(name = "MulticastLocation") MulticastLocation location) { + this.location = location; + } + + public void monitor(final InputStream in, final OutputStream output, String pattern) { + if (pattern == null || pattern.equals("")) pattern = ".*"; + + final PrintStream out = new PrintStream(output); + + final Pattern regex; + try { + regex = Pattern.compile(pattern); + } catch (Exception e) { + out.println("Invalid java.util.regex.Pattern \"" + pattern + "\""); + return; + } + + out.println("Hit any key to stop."); + + final AtomicBoolean stop = new AtomicBoolean(); + + Runnable runnable = new Runnable(){ + public void run() { + try { + in.read(); + } catch (IOException e) { + } finally { + stop.set(true); + } + } + }; + Thread thread = new Thread(runnable); + thread.setDaemon(true); + thread.start(); + + try { + MulticastSearch multicast = new MulticastSearch(location.getHost(), location.getPort()); + + + multicast.search(new MulticastSearch.Filter(){ + public boolean accept(URI service) { + String s = service.toString(); + Matcher matcher = regex.matcher(s); + if (matcher.matches()){ + out.println(s); + } + return stop.get(); + } + }); + } catch (IOException e) { + e.printStackTrace(out); + } + } +} Modified: geronimo/server/trunk/plugins/clustering/plugin-farm-member/pom.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/plugin-farm-member/pom.xml?rev=700858&r1=700857&r2=700858&view=diff ============================================================================== --- geronimo/server/trunk/plugins/clustering/plugin-farm-member/pom.xml (original) +++ geronimo/server/trunk/plugins/clustering/plugin-farm-member/pom.xml Wed Oct 1 11:26:31 2008 @@ -82,7 +82,7 @@ ${NodeName} ${ClusterName} - + ${MulticastDiscoveryAddress} ${MulticastDiscoveryPort} Modified: geronimo/server/trunk/plugins/clustering/plugin-farm-member/src/main/plan/plan.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/plugin-farm-member/src/main/plan/plan.xml?rev=700858&r1=700857&r2=700858&view=diff ============================================================================== --- geronimo/server/trunk/plugins/clustering/plugin-farm-member/src/main/plan/plan.xml (original) +++ geronimo/server/trunk/plugins/clustering/plugin-farm-member/src/main/plan/plan.xml Wed Oct 1 11:26:31 2008 @@ -37,9 +37,12 @@ - + 239.255.3.2 6142 + + + 500 10 false @@ -47,6 +50,9 @@ 30000 0 false + + MulticastLocation + Modified: geronimo/server/trunk/plugins/clustering/plugin-farm/pom.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/plugin-farm/pom.xml?rev=700858&r1=700857&r2=700858&view=diff ============================================================================== --- geronimo/server/trunk/plugins/clustering/plugin-farm/pom.xml (original) +++ geronimo/server/trunk/plugins/clustering/plugin-farm/pom.xml Wed Oct 1 11:26:31 2008 @@ -89,7 +89,7 @@ system manager - + ${MulticastDiscoveryAddress} ${MulticastDiscoveryPort} Modified: geronimo/server/trunk/plugins/clustering/plugin-farm/src/main/plan/plan.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/plugin-farm/src/main/plan/plan.xml?rev=700858&r1=700857&r2=700858&view=diff ============================================================================== --- geronimo/server/trunk/plugins/clustering/plugin-farm/src/main/plan/plan.xml (original) +++ geronimo/server/trunk/plugins/clustering/plugin-farm/src/main/plan/plan.xml Wed Oct 1 11:26:31 2008 @@ -53,9 +53,18 @@ - + 239.255.3.2 6142 + + + + + MulticastLocation + + + + 500 10 false @@ -63,6 +72,9 @@ 30000 0 false + + MulticastLocation +