Author: degenaro
Date: Mon Apr  9 14:27:50 2018
New Revision: 1828726

URL: http://svn.apache.org/viewvc?rev=1828726&view=rev
Log:
UIMA-5742 Reliable DUCC

- employ ducc.head for Agents and CLI
- employ local host for Orchestrator, PM, RM, SM, and broker

(remove use of initial reliable DUCC design: virtual_ip_address and 
virtual_ip_device)

Removed:
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/DuccHeadHelper.java
Modified:
    uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_head_mode.py
    uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_util.py
    uima/uima-ducc/branches/reliable-ducc/src/main/admin/start_ducc
    
uima/uima-ducc/branches/reliable-ducc/src/main/resources/default.ducc.properties
    uima/uima-ducc/branches/reliable-ducc/src/main/test/service.py
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/deploy/DuccWorkHelper.java
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccMonitor.java
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccUiUtilities.java
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/test/java/org/apache/uima/ducc/cli/test/ServiceTester.java
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/component/AbstractDuccComponent.java
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesHelper.java
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/part4/reliable.tex
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/reliable-ducc.tex
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-examples/src/main/scripts/start_sim
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jd/JobDriverStateExchanger.java
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java
    
uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java

Modified: uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_head_mode.py
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_head_mode.py?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_head_mode.py 
(original)
+++ uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_head_mode.py Mon 
Apr  9 14:27:50 2018
@@ -18,11 +18,12 @@
 # under the License.
 # -----------------------------------------------------------------------
 
+import os
 import subprocess
 
 from ducc_util import DuccUtil
 
-class Master(DuccUtil):
+class DuccHeadMode(DuccUtil):
 
     # purpose:    determine reliable ducc status
     # input:      none
@@ -31,31 +32,31 @@ class Master(DuccUtil):
     #             and employ linux commands to determine if system
     #             has matching configured virtual ip address
 
+    debug_flag = False
+    
+    def debug(self,text):
+        if(self.debug_flag):
+            print(text)
+            
     def main(self):
        result = 'unspecified'
        try:
-               device = self.ducc_properties.get('ducc.virtual.ip.device')
-               address = self.ducc_properties.get('ducc.virtual.ip.address')
-               #print "device: "+device, "address: "+address
-               if(device == None):
-                       pass
-               elif(address == None):
-                       pass
-               elif(address == '0.0.0.0'):
-                       pass
-               else:
-                       #print 'cmd: ', '/sbin/ip', 'addr', 'list', device
-                       p = subprocess.Popen(['/sbin/ip', 'addr', 'list', 
device], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-                       output, err = p.communicate()
-                       #print "output: "+output
-                       if(address in output):
-                               result = 'master'
-                       else:
-                               result = 'backup'
+            head = self.ducc_properties.get('ducc.head')
+            if(self.is_reliable_head_eligible(head)):
+               text = 'cmd: ', '/sbin/ip', 'addr', 'list'
+                self.debug(text)
+               p = subprocess.Popen(['/sbin/ip', 'addr', 'list'], 
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+               output, err = p.communicate()
+               text = "output: "+output
+                self.debug(text)
+               if(head in output):
+                       result = 'master'
+               else:
+                       result = 'backup'
        except Exception as e:
                print e
        print result
         
 if __name__ == '__main__':
-    instance = Master()
+    instance = DuccHeadMode()
     instance.main()
\ No newline at end of file

Modified: uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_util.py
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_util.py?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_util.py (original)
+++ uima/uima-ducc/branches/reliable-ducc/src/main/admin/ducc_util.py Mon Apr  
9 14:27:50 2018
@@ -156,7 +156,7 @@ class DuccUtil(DuccBase):
         self.ducc_uid          = find_ducc_uid()
         # self.broker_url      = self.ducc_properties.get('ducc.broker.url')
         self.broker_protocol   = 
self.ducc_properties.get('ducc.broker.protocol')
-        self.broker_host       = 
self.ducc_properties.get('ducc.broker.hostname')
+        self.broker_host       = self.localhost
         self.broker_port       = self.ducc_properties.get('ducc.broker.port')
         self.broker_jmx_port   = 
self.ducc_properties.get('ducc.broker.jmx.port')
         self.broker_decoration = 
self.ducc_properties.get('ducc.broker.url.decoration')
@@ -357,7 +357,7 @@ class DuccUtil(DuccBase):
 
     def stop_broker(self):
 
-        broker_host = self.ducc_properties.get('ducc.broker.hostname')
+        broker_host = self.localhost
         broker_home = self.ducc_properties.get('ducc.broker.home')
         broker_name = self.ducc_properties.get('ducc.broker.name')
         broker_jmx  = self.ducc_properties.get('ducc.broker.jmx.port')
@@ -391,6 +391,13 @@ class DuccUtil(DuccBase):
         is_operational = False
         req = node.split('.')[0]
         cmd = '/bin/hostname'
+        if(node == 'localhost'):
+            resp = self.popen(cmd)
+            lines = resp.readlines()
+            if(len(lines)== 1):
+                line = lines[0]
+                line = line.strip();
+                req = line.split('.')[0]
         ssh_cmd = 'ssh -q -o BatchMode=yes -o ConnectTimeout=10'+' '+node+" 
"+cmd
         resp = self.popen(ssh_cmd)
         lines = resp.readlines()
@@ -532,16 +539,31 @@ class DuccUtil(DuccBase):
             return False
         return True
     
+    keepalivd_conf = '/etc/keepalived/keepalived.conf'
+    
+    def is_reliable_head_eligible(self, head):
+        retVal = False
+        if ( os.path.exists(self.keepalivd_conf) ):
+            with open(self.keepalivd_conf) as f:
+                for line in f:
+                    if head in line:
+                        retVal = True
+                        break
+        return retVal
+    
     # Exit if this is not the head node.  Ignore the domain as uname sometimes 
drops it.
     # Also check that ssh to this node works
     # Also restrict operations to the userid that installed ducc
     def verify_head(self):
         head = self.ducc_properties.get("ducc.head").split('.')[0]
-        local = self.localhost.split('.')[0]
-        if local != head:
-            print ">>> ERROR - this script must be run from the head node"
-            sys.exit(1);
-        node = head
+        if(self.is_reliable_head_eligible(head)):
+            node = 'localhost'
+        else:
+            local = self.localhost.split('.')[0]
+            if local != head:
+                print ">>> ERROR - this script must be run from the head node"
+                sys.exit(1);
+            node = head
         if(self.ssh_operational(node)):
             text = "ssh is operational to "+node
             #print text
@@ -1060,6 +1082,7 @@ class DuccUtil(DuccBase):
         self.broker_host = 'localhost'
         self.broker_port = '61616'
         self.default_components = ['rm', 'pm', 'sm', 'or', 'ws', 'db', 
'broker']
+        self.local_components = ['rm', 'pm', 'sm', 'or', 'ws', 'broker']
         self.default_nodefiles = [self.DUCC_HOME + '/resources/ducc.nodes']
 
         if ( self.localhost == self.ducc_properties.get("ducc.head")):

Modified: uima/uima-ducc/branches/reliable-ducc/src/main/admin/start_ducc
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/src/main/admin/start_ducc?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- uima/uima-ducc/branches/reliable-ducc/src/main/admin/start_ducc (original)
+++ uima/uima-ducc/branches/reliable-ducc/src/main/admin/start_ducc Mon Apr  9 
14:27:50 2018
@@ -41,7 +41,7 @@ class StartDucc(DuccUtil):
 
     def start_broker(self):
         
-        broker_host = self.ducc_properties.get('ducc.broker.hostname')
+        broker_host = self.localhost
         print 'Starting broker on', broker_host
         lines = self.ssh(broker_host, True, "'", self.DUCC_HOME + 
'/admin/ducc.py', '-c', 'broker', "'")
         while 1:
@@ -68,14 +68,13 @@ class StartDucc(DuccUtil):
         msgs = []
 
         node = self.ducc_properties.get('ducc.head')
+        
         com = component
         if ( com.find('@') >= 0 ):            
             com, node = com.split('@')
-
-        if ( ( com == 'ws' ) and ( node == 'local' ) and ( self.webserver_node 
!= 'localhost' )):
-            if ( self.webserver_node != None ):
-                node = self.webserver_node
-                component = com + '@' + node
+            
+        if (com in self.local_components):
+                       node = self.localhost
 
         if ((com in self.default_components) or ( com == 'agent')) :
             msgs.append((node, 'Starting', com))

Modified: 
uima/uima-ducc/branches/reliable-ducc/src/main/resources/default.ducc.properties
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/src/main/resources/default.ducc.properties?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/src/main/resources/default.ducc.properties
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/src/main/resources/default.ducc.properties
 Mon Apr  9 14:27:50 2018
@@ -47,21 +47,11 @@
 # Resource Manager, Process Manager, Service Manager).  This property is 
required and MUST be
 # configured in new installation.  The installation script ducc_post_install 
initializes this 
 # property to the node the script is executed on.
+# Reliable DUCC: if running reliably, then this value must be the same as that 
specified
+# for the virtual_ipaddress in /etc/keepalived/keepalived.conf.  DUCC CLI and 
Agents employ
+# this value to connect to the current reliable DUCC head node.
 ducc.head = <head-node>
 
-# These optional properties declare virtual ip device and address for 
"reliable" DUCC.
-# Reliable DUCC comprises a MASTER and BACKUP configured using Linux 
keepalived, which
-# must correspond with the below two DUCC properties.
-# The following signify "reliable" DUCC is *not* in effect:
-# - omission of one or both of these properties
-# - 0.0.0.0 specified as <ducc.virtual.ip.address>
-# When in effect, a DUCC head node will act as MASTER only when the command
-# > ip addr show dev <ducc.virtual.ip.device> displays 
<ducc.virtual.ip.address>
-# Automatic takeover by the DUCC head BACKUP from DUCC head MASTER (and vice 
versa) occurs 
-# when the above command results change.
-ducc.virtual.ip.device = eth0
-ducc.virtual.ip.address = 0.0.0.0
-
 # The full name of the Java command.
 # This specifies the full path to the JVM to be used by the DUCC processes. 
This MUST be
 # configured.  The installation script ducc_post_install initializes this 
property to 
@@ -97,11 +87,6 @@ ducc.jms.provider=activemq
 
 #Declare the wire protocol used to communicate with ActiveMQ.
 ducc.broker.protocol=tcp
-
-# This declares the node where the ActiveMQ broker resides. It MUST be updated 
to 
-# the actual node where the broker is running as part of DUCC installation. 
-# The default value will not work.          
-ducc.broker.hostname=${ducc.head}
  
 # This declares the port on which the ActiveMQ broker is listening for 
messages.        
 ducc.broker.port=61617
@@ -110,7 +95,6 @@ ducc.broker.port=61617
 ducc.broker.url.decoration=jms.useCompression=true&jms.prefetchPolicy.all=0
 
 # The Broker's name must match the actual broker name in the broker config.  
-# THIS IS NOT THE BROKER HOSTNAME WHICH IS CONFIGURED IN ducc.broker.hostname.
 # This is the internal name of the broker, used to locate Broker's MBean in 
 # JMX Registry. It is NOT related to any node name. When using the ActiveMQ 
 # distribution supplied with DUCC it should always be set to localhost.  
@@ -561,8 +545,7 @@ ducc.sm.meta.ping.timeout =  15000
 # *****
 ducc.sm.http.port=${ducc.orchestrator.http.port}
 
-# This is the node where the Service Manager runs. It MUST be configured as 
part of DUCC 
-# setup. The ducc_post_install procedures initialize this to ${ducc.head}
+# This is the node where the Service Manager runs. It MUST be ${ducc.head}.
 ducc.sm.http.node=${ducc.head}
 
 # This is the length of time, in milliseconds, that the SM allows a service to 
remain alive after 
@@ -612,9 +595,7 @@ ducc.orchestrator.maintenance.rate=60000
 # This is the HTTP port used by the Orchestrator to field requests from the 
CLI / API. 
 ducc.orchestrator.http.port=19988
 
-# Node where OR is running. This is needed by CLI to compose a URL to access 
OR jetty server.
-# This is the node where the Orchestrator runs. It MUST be configured as part 
of DUCC 
-# setup. The ducc_post_install procedures initialize this to ${ducc.head}
+# Node where Orchestrator is running. It MUST be ${ducc.head}.
 ducc.orchestrator.http.node=${ducc.head}
 
 #------------------------------------------------------------------------------

Modified: uima/uima-ducc/branches/reliable-ducc/src/main/test/service.py
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/src/main/test/service.py?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- uima/uima-ducc/branches/reliable-ducc/src/main/test/service.py (original)
+++ uima/uima-ducc/branches/reliable-ducc/src/main/test/service.py Mon Apr  9 
14:27:50 2018
@@ -201,7 +201,7 @@ def mkBrokerUrl(ducc_home):
     props = DuccProperties()
     props.load(ducc_home + '/resources/ducc.properties')
     protocol = props.get('ducc.broker.protocol')
-    host     = props.get('ducc.broker.hostname')
+    host     = props.get('ducc.head')
     port     = props.get('ducc.broker.port')
     return protocol + '://' + host + ':' + port
 

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/deploy/DuccWorkHelper.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/deploy/DuccWorkHelper.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/deploy/DuccWorkHelper.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/deploy/DuccWorkHelper.java
 Mon Apr  9 14:27:50 2018
@@ -19,7 +19,6 @@
 
 package org.apache.uima.ducc.agent.deploy;
 import org.apache.uima.ducc.agent.Agent;
-import org.apache.uima.ducc.common.head.DuccHeadHelper;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.DuccPropertiesResolver;
 import org.apache.uima.ducc.common.utils.id.DuccId;
@@ -60,8 +59,7 @@ public class DuccWorkHelper {
                String location = "getTargetUrl";
                String targetUrl = null;
                String server = getServer();
-               String host = DuccPropertiesResolver.get("ducc." + server + 
".http.node");
-               host = DuccHeadHelper.getVirtualHost(host);
+               String host = DuccPropertiesResolver.get("ducc.head");
            String port = DuccPropertiesResolver.get("ducc." + server + 
".http.port");
         if ( host == null || port == null ) {
                String message = "ducc." + server + ".http.node and/or .port 
not set in ducc.properties";

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccMonitor.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccMonitor.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccMonitor.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccMonitor.java
 Mon Apr  9 14:27:50 2018
@@ -128,12 +128,9 @@ public abstract class DuccMonitor {
        public abstract String getUrl(String id);
 
        public String getHost() {
-               String host = 
duccPropertiesResolver.getFileProperty("ducc.virtual.ip.address");
+               String host = 
duccPropertiesResolver.getFileProperty("ducc.ws.node");
                if (host == null) {
-                       host = 
duccPropertiesResolver.getFileProperty("ducc.ws.node");
-                       if (host == null) {
-                               host = 
duccPropertiesResolver.getFileProperty("ducc.head");
-                       }
+                       host = 
duccPropertiesResolver.getFileProperty("ducc.head");
                }
                return host;
        }

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccUiUtilities.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccUiUtilities.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccUiUtilities.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccUiUtilities.java
 Mon Apr  9 14:27:50 2018
@@ -42,7 +42,6 @@ import javax.xml.parsers.ParserConfigura
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.ducc.common.IDuccUser;
 import org.apache.uima.ducc.common.TcpStreamHandler;
-import org.apache.uima.ducc.common.head.DuccHeadHelper;
 import org.apache.uima.ducc.common.utils.DuccPropertiesResolver;
 import org.apache.uima.ducc.transport.event.sm.IService.ServiceType;
 import org.apache.uima.ducc.user.common.PrivateClassLoader;
@@ -142,8 +141,7 @@ public class DuccUiUtilities {
         * Get URL for service handling request. (server is always 
"orchestrator")
         */
        public static String dispatchUrl(String server) {
-           String host = DuccPropertiesResolver.get("ducc." + server + 
".http.node");
-           host = DuccHeadHelper.getVirtualHost(host);
+           String host = DuccPropertiesResolver.get("ducc.head");
            String port = DuccPropertiesResolver.get("ducc." + server + 
".http.port");
         if ( host == null || port == null) {
             throw new IllegalStateException("ducc." + server + ".http.node 
and/or .port not set in ducc.properties");

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/test/java/org/apache/uima/ducc/cli/test/ServiceTester.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/test/java/org/apache/uima/ducc/cli/test/ServiceTester.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/test/java/org/apache/uima/ducc/cli/test/ServiceTester.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-cli/src/test/java/org/apache/uima/ducc/cli/test/ServiceTester.java
 Mon Apr  9 14:27:50 2018
@@ -96,7 +96,7 @@ public class ServiceTester
        throws Exception
     {
         String proto = 
ducc_properties.getStringProperty("ducc.broker.protocol");
-        String host  = 
ducc_properties.getStringProperty("ducc.broker.hostname");
+        String host  = ducc_properties.getStringProperty("ducc.head");
         String port  = ducc_properties.getStringProperty("ducc.broker.port");
         return proto + "://" + host + ":" + port;
     }

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/component/AbstractDuccComponent.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/component/AbstractDuccComponent.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/component/AbstractDuccComponent.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/component/AbstractDuccComponent.java
 Mon Apr  9 14:27:50 2018
@@ -50,10 +50,11 @@ import org.apache.uima.ducc.common.admin
 import org.apache.uima.ducc.common.crypto.Crypto;
 import 
org.apache.uima.ducc.common.exception.DuccComponentInitializationException;
 import org.apache.uima.ducc.common.exception.DuccConfigurationException;
-import org.apache.uima.ducc.common.head.DuccHeadHelper;
 import org.apache.uima.ducc.common.main.DuccService;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.DuccProperties;
+import org.apache.uima.ducc.common.utils.DuccPropertiesHelper;
+import org.apache.uima.ducc.common.utils.InetHelper;
 import org.apache.uima.ducc.common.utils.JdkEvaluator;
 import org.apache.uima.ducc.common.utils.JdkEvaluator.JDKVendor;
 import org.apache.uima.ducc.common.utils.JdkEvaluator.Vendors;
@@ -139,11 +140,12 @@ public abstract class AbstractDuccCompon
   }
 
   private static String agent = "agent";
-  private static String ducc_virtual_ip_device = "ducc.virtual.ip.device";
-  private static String ducc_virtual_ip_address = "ducc.virtual.ip.address";
-  private static String ducc_broker_hostname = "ducc.broker.hostname";
   private static String ducc_deploy_components = "ducc.deploy.components";
+  private static String ducc_broker_hostname = "inet.hostname";
   
+  /*
+   * Agents use virtual IP, other daemons use local host
+   */
   private boolean is_virtual_ip_used() {
          String location = "is_virtual_ip_used";
          boolean retVal = false;
@@ -159,14 +161,12 @@ public abstract class AbstractDuccCompon
   
   private String getBrokerHostname() throws Exception {
          String location = "getBrokerHostname";
-         String brokerHostname = System.getProperty(ducc_broker_hostname);
+         String brokerHostname = InetHelper.getHostName();
          String retVal = brokerHostname;
-         String ipDevice = System.getProperty(ducc_virtual_ip_device);
-         String ipAddress = System.getProperty(ducc_virtual_ip_address);
-         logger.info(location, jobid, ducc_broker_hostname+"="+brokerHostname, 
ducc_virtual_ip_device+"="+ipDevice, ducc_virtual_ip_address+"="+ipAddress);
          if(is_virtual_ip_used()) {
-                 retVal = DuccHeadHelper.getVirtualHost(brokerHostname);
+                 retVal = DuccPropertiesHelper.getDuccHead();
          }
+         logger.debug(location, jobid, 
ducc_broker_hostname+"="+brokerHostname);
          return retVal;
   }
   
@@ -229,9 +229,12 @@ public abstract class AbstractDuccCompon
   private static String sepDeco = "?";
   
   /**
-   * ducc.properties provides broker URL in pieces as follows: - 
ducc.broker.protocol -
-   * ducc.broker.hostname - ducc.broker.port - ducc.broker.url.decoration 
Assemble the above into a
-   * complete URL
+   * ducc.properties provides broker URL in pieces as follows: 
+   * - ducc.broker.protocol 
+   * - ducc.broker.port
+   * - ducc.broker.url.decoration 
+   * Assemble the above with broker host (ducc.head for Agents, local host for 
other daemons)
+   * into a complete URL
    * 
    * @throws Exception
    */
@@ -252,7 +255,7 @@ public abstract class AbstractDuccCompon
     }
     if ((duccBrokerHostname = getBrokerHostname()) == null) {
       throw new DuccConfigurationException(
-              "Ducc Configuration Exception. Please add ducc.broker.hostname 
property to ducc.propeties");
+              "Ducc Configuration Exception. Please add ducc.head property to 
ducc.propeties");
     }
     if ((duccBrokerPort = System.getProperty("ducc.broker.port")) == null) {
       throw new DuccConfigurationException(

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesHelper.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesHelper.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesHelper.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesHelper.java
 Mon Apr  9 14:27:50 2018
@@ -18,9 +18,6 @@
 */
 package org.apache.uima.ducc.common.utils;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
 import java.util.Properties;
 
 public class DuccPropertiesHelper {
@@ -45,21 +42,4 @@ public class DuccPropertiesHelper {
                return retVal;
        }
        
-       private static String defaultDuccHeadVirtualIpAddress= "";
-       
-       public static String getDuccHeadVirtualIpAddress() {
-               String key = 
DuccPropertiesResolver.ducc_head_virtual_ip_address;
-               String value = 
DuccPropertiesResolver.get(key,defaultDuccHeadVirtualIpAddress);
-               String retVal = value;
-               return retVal;
-       }
-       
-       private static String defaultDuccHeadVirtualIpDevice= "";
-       
-       public static String getDuccHeadVirtualIpDevice() {
-               String key = DuccPropertiesResolver.ducc_head_virtual_ip_device;
-               String value = 
DuccPropertiesResolver.get(key,defaultDuccHeadVirtualIpDevice);
-               String retVal = value;
-               return retVal;
-       }
 }

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java
 Mon Apr  9 14:27:50 2018
@@ -83,9 +83,6 @@ public class DuccPropertiesResolver {
     
     public static final String ducc_head = "ducc.head";
     
-    public static final String ducc_head_virtual_ip_address = 
"ducc.virtual.ip.address";
-    public static final String ducc_head_virtual_ip_device = 
"ducc.virtual.ip.device";
-    
     public static final String ducc_security_home = "ducc.security.home";
     
     public static final String ducc_private_resources = 
"ducc.private.resources";
@@ -105,7 +102,6 @@ public class DuccPropertiesResolver {
     public static final String ducc_signature_required = 
"ducc.signature.required";
     public static final String ducc_broker_url = "ducc.broker.url";
     public static final String ducc_broker_protocol = "ducc.broker.protocol";
-    public static final String ducc_broker_hostname = "ducc.broker.hostname";
     public static final String ducc_broker_port = "ducc.broker.port";
     public static final String ducc_broker_url_decoration = 
"ducc.broker.url.decoration";
     public static final String ducc_broker_name = "ducc.broker.name";

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/part4/reliable.tex
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/part4/reliable.tex?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/part4/reliable.tex
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/part4/reliable.tex
 Mon Apr  9 14:27:50 2018
@@ -42,6 +42,48 @@
     which can be found at this web address: 
     
\url{https://docs.oracle.com/cd/E37670_01/E41138/html/section_uxg_lzh_nr.html}.
 
+       Sample MASTER /etc/keepalived/keepalived.conf
+       
+       \begin{verbatim}
+    ! Configuration File for keepalived
+
+       vrrp_instance VI_1 {
+           state MASTER
+           interface eth0
+           virtual_router_id 51
+           priority 100
+           advert_int 1
+           authentication {
+               auth_type PASS
+               auth_pass 1111
+           }
+           virtual_ipaddress {
+               192.168.6.253
+           }
+       }
+       \end{verbatim}
+
+       Sample BACKUP /etc/keepalived/keepalived.conf
+       
+       \begin{verbatim}
+    ! Configuration File for keepalived
+
+       vrrp_instance VI_1 {
+           state BACKUP
+           interface eth0
+           virtual_router_id 51
+           priority 100
+           advert_int 1
+           authentication {
+               auth_type PASS
+               auth_pass 1111
+           }
+           virtual_ipaddress {
+               192.168.6.253
+           }
+       }
+       \end{verbatim}
+       
        Linux Commands
        
        Starting keepalived
@@ -54,13 +96,13 @@
        Querying keepalived
        
     \begin{verbatim}
-    > ip addr show dev eth0
-    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 
1000
-    link/ether 00:21:5e:20:02:84 brd ff:ff:ff:ff:ff:ff
-    inet 192.168.3.7/16 brd 192.168.255.255 scope global eth0
-    inet 192.168.200.17/32 scope global eth0
-    inet6 fe80::221:5eff:fe20:284/64 scope link 
-       valid_lft forever preferred_lft forever
+    > /sbin/ip addr show dev eth0
+       2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP 
qlen 1000
+           link/ether 00:21:5e:20:02:84 brd ff:ff:ff:ff:ff:ff
+           inet 192.168.3.7/16 brd 192.168.255.255 scope global eth0
+           inet 192.168.6.253/32 scope global eth0
+           inet6 fe80::221:5eff:fe20:284/64 scope link 
+              valid_lft forever preferred_lft forever
        \end{verbatim}
 
        Stopping keepalived
@@ -71,15 +113,14 @@
        \end{verbatim}
 
 \section{Configuring DUCC}  
-    To configure DUCC to run reliable, there are two properties that must
+    To configure DUCC to run reliable, one required property must
     be configured in the {\em site.ducc.properties} file.  Example:
     
     \begin{verbatim}
-       ducc.virtual.ip.device = eth0
-       ducc.virtual.ip.address = 192.168.200.17
+       ducc.head = 192.168.6.253
        \end{verbatim}
     
-    Use the device and virtual IP address configured for your host machines. 
+    Use the virtual IP address configured for your host machines keepalived. 
     
 \section{Webserver}
 

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/reliable-ducc.tex
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/reliable-ducc.tex?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/reliable-ducc.tex
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-duccdocs/src/site/tex/duccbook/reliable-ducc.tex
 Mon Apr  9 14:27:50 2018
@@ -76,6 +76,48 @@ This first major section describes suppo
     which can be found at this web address: 
     
\url{https://docs.oracle.com/cd/E37670_01/E41138/html/section_uxg_lzh_nr.html}.
 
+       Sample MASTER /etc/keepalived/keepalived.conf
+       
+       \begin{verbatim}
+    ! Configuration File for keepalived
+
+       vrrp_instance VI_1 {
+           state MASTER
+           interface eth0
+           virtual_router_id 51
+           priority 100
+           advert_int 1
+           authentication {
+               auth_type PASS
+               auth_pass 1111
+           }
+           virtual_ipaddress {
+               192.168.6.253
+           }
+       }
+       \end{verbatim}
+
+       Sample BACKUP /etc/keepalived/keepalived.conf
+       
+       \begin{verbatim}
+    ! Configuration File for keepalived
+
+       vrrp_instance VI_1 {
+           state BACKUP
+           interface eth0
+           virtual_router_id 51
+           priority 100
+           advert_int 1
+           authentication {
+               auth_type PASS
+               auth_pass 1111
+           }
+           virtual_ipaddress {
+               192.168.6.253
+           }
+       }
+       \end{verbatim}
+
        Linux Commands
        
        Starting keepalived
@@ -88,13 +130,13 @@ This first major section describes suppo
        Querying keepalived
        
     \begin{verbatim}
-    > ip addr show dev eth0
-    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 
1000
-    link/ether 00:21:5e:20:02:84 brd ff:ff:ff:ff:ff:ff
-    inet 192.168.3.7/16 brd 192.168.255.255 scope global eth0
-    inet 192.168.200.17/32 scope global eth0
-    inet6 fe80::221:5eff:fe20:284/64 scope link 
-       valid_lft forever preferred_lft forever
+    > /sbin/ip addr show dev eth0
+       2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP 
qlen 1000
+           link/ether 00:21:5e:20:02:84 brd ff:ff:ff:ff:ff:ff
+           inet 192.168.3.7/16 brd 192.168.255.255 scope global eth0
+           inet 192.168.6.253/32 scope global eth0
+           inet6 fe80::221:5eff:fe20:284/64 scope link 
+              valid_lft forever preferred_lft forever
        \end{verbatim}
 
        Stopping keepalived
@@ -105,15 +147,14 @@ This first major section describes suppo
        \end{verbatim}
 
 \subsection{Configuring DUCC}  
-    To configure DUCC to run reliable, there are two properties that must
+    To configure DUCC to run reliable, one required property must
     be configured in the {\em site.ducc.properties} file.  Example:
     
     \begin{verbatim}
-       ducc.virtual.ip.device = eth0
-       ducc.virtual.ip.address = 192.168.200.17
+       ducc.head = 192.168.6.253
        \end{verbatim}
     
-    Use the device and virtual IP address configured for your host machines. 
+    Use the virtual IP address configured for your host machines keepalived. 
     
 \subsection{Webserver}
 
@@ -163,7 +204,7 @@ publication.
     # output:     one of { unspecified, master, backup }
     # operation:  look in ducc.properties for relevant keywords
     #             and employ linux commands to determine if system
-    #             has matching configured virtual ip address
+    #             has matching configured virtual IP address
    \end{verbatim}
 
 \subsubsection{existing scripts}
@@ -171,8 +212,9 @@ publication.
 {\renewcommand\labelitemi{}
 \begin{itemize}
   \item \textbf{ducc\_post\_install} - no need to create webserver request log 
directory
-  \item \textbf{ducc\_util.py} - incorporate host name into cassandra.pid, 
cassandra.console path
+  \item \textbf{ducc\_util.py} - incorporate host name into cassandra.pid, 
cassandra.console path; broker host must be local host; head node must be 
eligible with respect to keepalived.conf; head node local components are all 
daemons except Database and Agents
   \item \textbf{ducc.py} - incorporate host name into cassandra.pid, 
cassandra.console path
+  \item \textbf{start\_ducc.py} - head node local components must start on 
eligible local host
 \end{itemize}
 }
 
@@ -181,20 +223,21 @@ publication.
 \textbf{ducc.properties}  
 
    \begin{verbatim}
-    # These optional properties declare virtual ip device and address for 
"reliable" DUCC.
-    # Reliable DUCC comprises a MASTER and BACKUP configured using Linux 
keepalived, which
-    # must correspond with the below two DUCC properties.
-    # The following signify "reliable" DUCC is *not* in effect:
-    # - omission of one or both of these properties
-    # - 0.0.0.0 specified as <ducc.virtual.ip.address>
-    # When in effect, a DUCC head node will act as MASTER only when the command
-    # > ip addr show dev <ducc.virtual.ip.device> displays 
<ducc.virtual.ip.address>
-    # Automatic takeover by the DUCC head BACKUP from DUCC head MASTER (and 
vice versa) occurs 
-    # when the above command results change.
-    ducc.virtual.ip.device = eth0
-    ducc.virtual.ip.address = 0.0.0.0
+    # The name of the node where DUCC runs.
+    # This property declares the node where the DUCC administrative processes 
run (Orchestrator,
+    # Resource Manager, Process Manager, Service Manager).  This property is 
required and MUST be
+    # configured in new installation.  The installation script 
ducc_post_install initializes this 
+    # property to the node the script is executed on.
+    # Reliable DUCC: if running reliably, then this value must be the same as 
that specified
+    # for the virtual_ipaddress in /etc/keepalived/keepalived.conf.  DUCC CLI 
and Agents employ
+    # this value to connect to the current reliable DUCC head node.
+    ducc.head = <head-node>
    \end{verbatim}
 
+Although not strictly true, the Orchestrator, RM, SM, PM, Webserver and Broker 
"must"
+all be configured on the head node.  Reliable DUCC may work with other 
configurations,
+but it has not been tested as such.
+
 \textbf{log4j.xml}
 
    \begin{verbatim}
@@ -207,9 +250,10 @@ publication.
 
 {\renewcommand\labelitemi{}
 \begin{itemize}
-  \item \textbf{DuccWorkHelper} - use virtualIP address or head node
+  \item \textbf{DuccWorkHelper} - use virtual IP address configured as 
ducc.head node
   \item \textbf{AgentEventListener} - ignore any incoming publications from 
backup producer
   \item \textbf{CGroupsTest} - employ changed DuccIdFactory signature
+  \item \textbf{ServiceTester} - broker must be on ducc.head node
 \end{itemize}
 }
 
@@ -217,8 +261,8 @@ publication.
 
 {\renewcommand\labelitemi{}
 \begin{itemize}
-  \item \textbf{DuccMonitor} - use virtual IP address, or WS node, or head node
-  \item \textbf{DuccUiUtilities} - use virtualIP address or head node (to 
submit, cancel..)
+  \item \textbf{DuccMonitor} - use WS node or virtual IP address configured as 
ducc.head node
+  \item \textbf{DuccUiUtilities} - use virtual IP address configured as 
ducc.head node (to submit, cancel..)
 \end{itemize}
 }
 
@@ -226,9 +270,8 @@ publication.
 
 {\renewcommand\labelitemi{}
 \begin{itemize}
-  \item \textbf{AbstractDuccComponent} - for broker use virtual IP address or 
head node, remove commented-out code, remove print to console
+  \item \textbf{AbstractDuccComponent} - remove commented-out code, remove 
print to console, head node local components are all daemons except Database 
and Agents
   \item \textbf{ADuccHead} - abstract class with reliable DUCC share 
functionality
-  \item \textbf{DuccHeadHelper, IDuccHead} - reliable DUCC utilities
   \item \textbf{IDuccHead} - reliable DUCC interface
   \item \textbf{IDuccEnv} - remove DUCC\_LOGS\_WEBSERVER\_DIR, not used
   \item \textbf{IStateServices} - database access control RW or RO
@@ -236,8 +279,8 @@ publication.
   \item \textbf{StateServices} - database access control RW or RO
   \item \textbf{DuccDaemonRuntimeProperties} - incorporate hostname into logs 
directory location
   \item \textbf{InetHelper} - incorporate hostname into logs directory location
-  \item \textbf{DuccPropertiesHelper} - fetch virtual IP address
-  \item \textbf{DuccPropertiesResolver} - Reliable DUCC properties keys
+  \item \textbf{DuccPropertiesHelper} - fetch virtual IP address configured as 
ducc.head node
+  \item \textbf{DuccPropertiesResolver} - Remove key ducc.broker.hostname, 
broker must be on ducc.head node
   \item \textbf{IDuccLoggerComponents} - Missing PM abbreviation
   \item \textbf{DuccIdFactory} - improved (generalized) to handle DB persisted 
sequence numbering
 \end{itemize}
@@ -317,7 +360,7 @@ publication.
 
 {\renewcommand\labelitemi{}
 \begin{itemize}
-  \item \textbf{JobDriverStateExchanger} - use virtualIP address or head node
+  \item \textbf{JobDriverStateExchanger} - use virtual IP address configured 
as ducc.head node
   \item \textbf{AbstractDuccEvent} - tag publications with producer host 
identity and state {\em master} or {\em backup}
   \item \textbf{DaemonDuccEvent} - switch to {\em master} or {\em backup} 
state for recording to system event log
   \item \textbf{DuccEvent} - add events SWITCH\_TO\_MASTER and 
SWITCH\_TO\_BACKUP
@@ -330,6 +373,7 @@ publication.
 
 {\renewcommand\labelitemi{}
 \begin{itemize}
+  \item \textbf{BrokerHelper} - use local host name to find co-located broker
   \item \textbf{DuccBoot} - make boot reusable for switch to {\em master}
   \item \textbf{DuccData} - create reset function for switch to {\em master}
   \item \textbf{DuccHead} - loggable wrapper around common.ADuccHead
@@ -345,6 +389,15 @@ publication.
 \end{itemize}
 }
 
+\subsubsection{examples}
+
+{\renewcommand\labelitemi{}
+\begin{itemize}
+  \item \textbf{start\_sim} - broker must be on head node
+\end{itemize}
+}
+
+
 \section{Installing and Cloning}
 
 This second major section describes support for installation of head node 
master and backup(s).

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-examples/src/main/scripts/start_sim
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-examples/src/main/scripts/start_sim?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-examples/src/main/scripts/start_sim
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-examples/src/main/scripts/start_sim
 Mon Apr  9 14:27:50 2018
@@ -60,7 +60,7 @@ class StartSim(DuccUtil):
         if ( not self.automanage ):
             print "Broker is not automanaged, returning."
 
-        broker_host = self.ducc_properties.get('ducc.broker.hostname')
+        broker_host = self.localhost
         print 'broker host', broker_host
         lines = self.ssh(broker_host, True, "'", self.DUCC_HOME + 
'/admin/ducc.py', '-c', 'broker', '--simtest', "'")
 

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jd/JobDriverStateExchanger.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jd/JobDriverStateExchanger.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jd/JobDriverStateExchanger.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configuration/jd/JobDriverStateExchanger.java
 Mon Apr  9 14:27:50 2018
@@ -22,7 +22,6 @@ import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.uima.ducc.common.NodeIdentity;
-import org.apache.uima.ducc.common.head.DuccHeadHelper;
 import org.apache.uima.ducc.common.jd.files.workitem.IWorkItemStateKeeper;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.DuccLoggerComponents;
@@ -129,11 +128,7 @@ public class JobDriverStateExchanger ext
        private String getTargetUrl() {
                String targetUrl = null;
                String server = getServer();
-               String host = DuccPropertiesResolver.get("ducc." + server + 
".http.node");
-               
-               // employ virtual IP if configured
-               host = DuccHeadHelper.getVirtualHost(host);
-
+               String host = DuccPropertiesResolver.get("ducc.head");
            String port = DuccPropertiesResolver.get("ducc." + server + 
".http.port");
         if ( host == null || port == null ) {
                String message = "ducc." + server + ".http.node and/or .port 
not set in ducc.properties";

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/BrokerHelper.java
 Mon Apr  9 14:27:50 2018
@@ -42,6 +42,7 @@ import javax.management.remote.JMXServic
 
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.DuccPropertiesResolver;
+import org.apache.uima.ducc.common.utils.InetHelper;
 import org.apache.uima.ducc.common.utils.id.DuccId;
 import org.apache.uima.ducc.ws.DuccDaemonsData;
 
@@ -108,8 +109,7 @@ public class BrokerHelper extends JmxHel
                String key;
                String value;
                //
-               key = "ducc.broker.hostname";
-               value = duccPropertiesResolver.getCachedProperty(key);
+               value = InetHelper.getHostName();
                setHost(value);
                //
                key = "ducc.broker.jmx.port";

Modified: 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java?rev=1828726&r1=1828725&r2=1828726&view=diff
==============================================================================
--- 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
 (original)
+++ 
uima/uima-ducc/branches/reliable-ducc/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
 Mon Apr  9 14:27:50 2018
@@ -49,7 +49,6 @@ import org.apache.uima.ducc.common.SizeB
 import org.apache.uima.ducc.common.SizeBytes.Type;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties.DaemonName;
-import org.apache.uima.ducc.common.head.DuccHeadHelper;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.internationalization.Messages;
 import org.apache.uima.ducc.common.jd.files.IWorkItemState;
@@ -3344,23 +3343,15 @@ public class DuccHandler extends DuccAbs
                String methodName = "handleDuccServletClusterReliableStatus";
                duccLogger.trace(methodName, null, messages.fetch("enter"));
                StringBuffer sb = new StringBuffer();
-               if(DuccHeadHelper.isVirtualIpAddress()) {
-                       String ipAddress = 
DuccPropertiesHelper.getDuccHeadVirtualIpAddress();
-                       String ipDevice = 
DuccPropertiesHelper.getDuccHeadVirtualIpDevice();
-                       if(ipAddress.length() > 0) {
-                               if(ipDevice.length() > 0) {
-                                       String status = dh.get_ducc_head_mode();
-                                       String hover = ipDevice+" "+ipAddress;
-                                       if(dh.is_ducc_head_master()) {
-                                               String text = "<span 
title=\""+hover+"\">"+status+"</span>";
-                                               sb.append(text);
-                                       }
-                                       else {
-                                               String text = 
"<span>"+status+"</span>";
-                                               sb.append(text);
-                                       }
-                               }
-                       }
+               String status = dh.get_ducc_head_mode();
+               String hover = DuccPropertiesHelper.getDuccHead();
+               if(dh.is_ducc_head_master()) {
+                       String text = "<span 
title=\""+hover+"\">"+status+"</span>";
+                       sb.append(text);
+               }
+               else {
+                       String text = "<span>"+status+"</span>";
+                       sb.append(text);
                }
                response.getWriter().println(sb);
                duccLogger.trace(methodName, null, messages.fetch("exit"));
@@ -3372,25 +3363,18 @@ public class DuccHandler extends DuccAbs
                String methodName = "handleDuccServletClusterReliableLabel";
                duccLogger.trace(methodName, null, messages.fetch("enter"));
                StringBuffer sb = new StringBuffer();
-               if(DuccHeadHelper.isVirtualIpAddress()) {
-                       String ipAddress = 
DuccPropertiesHelper.getDuccHeadVirtualIpAddress();
-                       String ipDevice = 
DuccPropertiesHelper.getDuccHeadVirtualIpDevice();
-                       if(ipAddress.length() > 0) {
-                               if(ipDevice.length() > 0) {
-                                       String label = "reliable:";
-                                       if(dh.is_ducc_head_backup()) {
-                                               String hover = "Click to visit 
master";
-                                               String text = "<span 
title=\""+hover+"\">"+label+"</span>";
-                                               String link = 
"http://"+ipAddress+":"+getDuccWebServer().getPort()+"/";
-                                       String href = "<a href=\""+link+"\" 
target=\"_ducc_master\"  >"+text+"</a>";
-                                       sb.append(href);
-                                       }
-                                       else {
-                                               String text = 
"<span>"+label+"</span>";
-                                               sb.append(text);
-                                       }
-                               }
-                       }
+               String label = "reliable:";
+               if(dh.is_ducc_head_backup()) {
+                       String hover = "Click to visit master";
+                       String text = "<span 
title=\""+hover+"\">"+label+"</span>";
+                       String host = DuccPropertiesHelper.getDuccHead();;
+                       String link = 
"http://"+host+":"+getDuccWebServer().getPort()+"/";
+                       String href = "<a href=\""+link+"\" 
target=\"_ducc_master\"  >"+text+"</a>";
+                       sb.append(href);
+               }
+               else {
+                       String text = "<span>"+label+"</span>";
+                       sb.append(text);
                }
                response.getWriter().println(sb);
                duccLogger.trace(methodName, null, messages.fetch("exit"));


Reply via email to