[exo-jcr-commits] exo-jcr SVN: r5538 - jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sat Jan 28 03:45:36 EST 2012
Author: nzamosenchuk
Date: 2012-01-28 03:45:35 -0500 (Sat, 28 Jan 2012)
New Revision: 5538
Modified:
jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java
Log:
EXOJCR-1709 : change logger usage
Modified: jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java 2012-01-27 14:09:27 UTC (rev 5537)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java 2012-01-28 08:45:35 UTC (rev 5538)
@@ -141,6 +141,8 @@
new RSyncJob(String.format(urlFormatString, address), indexPath, rsyncUserName, rsyncPassword);
try
{
+ // synchronizing access to RSync Job.
+ // No parallel jobs allowed
synchronized (this)
{
rSyncJob.execute();
@@ -154,6 +156,9 @@
}
}
+ /**
+ * Wrapper of native process calling RSYNC utility
+ */
private class RSyncJob
{
private final static String RSYNC_USER_SYSTEM_PROPERTY = "USER";
@@ -178,14 +183,22 @@
this.password = password;
}
- // TODO : Use JNI and librsync library? or handle err stream
+ /**
+ * Executes RSYNC synchronization job
+ *
+ * @throws IOException
+ */
public void execute() throws IOException
{
+ // Future todo: Use JNI and librsync library?
Runtime run = Runtime.getRuntime();
try
{
String command = "rsync -rv --delete " + src + " " + dst;
- log.info("Rsync job started: " + command);
+ if (log.isDebugEnabled())
+ {
+ log.debug("Rsync job started: " + command);
+ }
if (userName != null && password != null)
{
String[] envProperties =
@@ -235,8 +248,11 @@
// oops, this can happen sometimes
}
}
- log.info("Rsync job finished: " + returnCode + ". Error stream output \n" + stringBuilderErr.toString()
- + " Standard stream output \n" + stringBuilderStd.toString());
+ if (log.isDebugEnabled())
+ {
+ log.debug("Rsync job finished: " + returnCode + ". Error stream output \n" + stringBuilderErr.toString()
+ + " Standard stream output \n" + stringBuilderStd.toString());
+ }
if (returnCode != 0)
{
throw new IOException("RSync job finished with exit code is " + returnCode + ". Error stream output: \n"
More information about the exo-jcr-commits
mailing list