using $SQ_PDCP/$SQ_PDSH for pdcp/pdsh

Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/f2c547e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/f2c547e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/f2c547e3

Branch: refs/heads/master
Commit: f2c547e3dc27ddab6737539a1e23f050bb4ee0bb
Parents: f530cfe
Author: Kevin Xu <[email protected]>
Authored: Mon Jan 18 17:12:20 2016 +0800
Committer: Kevin Xu <[email protected]>
Committed: Mon Jan 18 17:12:20 2016 +0800

----------------------------------------------------------------------
 .../src/main/java/org/trafodion/libmgmt/FileMgmt.java | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f2c547e3/core/sql/lib_mgmt/src/main/java/org/trafodion/libmgmt/FileMgmt.java
----------------------------------------------------------------------
diff --git 
a/core/sql/lib_mgmt/src/main/java/org/trafodion/libmgmt/FileMgmt.java 
b/core/sql/lib_mgmt/src/main/java/org/trafodion/libmgmt/FileMgmt.java
index 94f7d65..aa41412 100644
--- a/core/sql/lib_mgmt/src/main/java/org/trafodion/libmgmt/FileMgmt.java
+++ b/core/sql/lib_mgmt/src/main/java/org/trafodion/libmgmt/FileMgmt.java
@@ -210,8 +210,14 @@ public class FileMgmt {
                LOG.info("syncJars " + fileName);
                String nodes = System.getenv("MY_NODES");
                if (nodes != null && !"".equals(nodes.trim())) {
-                       execShell("pdcp " + nodes + " " + userPath + 
fileName.trim() + " " + userPath + " ");
-                       execShell("pdsh " + nodes + " chmod 755 " + userPath + 
fileName.trim());
+                       String pdcp = System.getenv("SQ_PDCP");
+                       String pdsh = System.getenv("SQ_PDSH");
+                       if (pdcp != null) {
+                               execShell(pdcp + " " + nodes + " " + userPath + 
fileName.trim() + " " + userPath + " ");
+                       }
+                       if (pdsh != null) {
+                               execShell(pdsh + " " + nodes + " chmod 755 " + 
userPath + fileName.trim());
+                       }
                }
        }
 
@@ -416,6 +422,8 @@ public class FileMgmt {
                                if (lock != null) {
                                        fos.write(data);
                                        fos.flush();
+                               }else{
+                                       throw new SQLException("File 
"+fileName+" is locked, please try again later.");
                                }
                        } finally {
                                if(lock != null){
@@ -429,7 +437,7 @@ public class FileMgmt {
                        }
 
                        syncJar(userPath, fileName);
-
+                       LOG.info("PUT method out !!! " + fileName);
                } catch (Throwable t) {
                        LOG.error(t.getMessage(), t);
                        throw new SQLException(t.getMessage());

Reply via email to