Author: burn
Date: Fri Jan 18 21:10:49 2019
New Revision: 1851645

URL: http://svn.apache.org/viewvc?rev=1851645&view=rev
Log:
UIMA-5965 Remove noisy stdout msg

Modified:
    
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/protocol/builtin/DefaultServiceProtocolHandler.java

Modified: 
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/protocol/builtin/DefaultServiceProtocolHandler.java
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/protocol/builtin/DefaultServiceProtocolHandler.java?rev=1851645&r1=1851644&r2=1851645&view=diff
==============================================================================
--- 
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/protocol/builtin/DefaultServiceProtocolHandler.java
 (original)
+++ 
uima/uima-ducc/trunk/uima-ducc-pullservice/src/main/java/org/apache/uima/ducc/ps/service/protocol/builtin/DefaultServiceProtocolHandler.java
 Fri Jan 18 21:10:49 2019
@@ -6,9 +6,9 @@
  * 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
@@ -48,8 +48,8 @@ import org.apache.uima.util.Level;
 import org.apache.uima.util.Logger;
 
 /**
- * 
- * This protocol handler is a Runnable 
+ *
+ * This protocol handler is a Runnable
  *
  */
 public class DefaultServiceProtocolHandler implements IServiceProtocolHandler {
@@ -71,16 +71,16 @@ public class DefaultServiceProtocolHandl
        private IService service;
        // forces process threads to initialize serially
        private static ReentrantLock initLock = new ReentrantLock();
-       
+
        private static AtomicInteger idGenerator = new AtomicInteger();
-       
+
        private static ReentrantLock retryLock = new ReentrantLock();
-       
+
        private Thread retryThread = null;
-       
-       private DefaultServiceProtocolHandler(Builder builder) { 
-               this.initLatch = builder.initLatch; 
-               this.stopLatch = builder.stopLatch; 
+
+       private DefaultServiceProtocolHandler(Builder builder) {
+               this.initLatch = builder.initLatch;
+               this.stopLatch = builder.stopLatch;
                this.service = builder.service;
                this.transport = builder.transport;
                this.processor = builder.processor;
@@ -138,7 +138,7 @@ public class DefaultServiceProtocolHandl
                        // increment minor
                        tid.next();
                }
-               
+
        transaction.setRequesterProcessName(service.getType());
        transport.addRequestorInfo(transaction);
                Object o = null;
@@ -149,7 +149,7 @@ public class DefaultServiceProtocolHandl
                                throw new TransportException("Received invalid 
content (null) in response from client - rejecting request");
                        }
                        o = XStreamUtils.unmarshall(content);
-                       
+
                } catch ( Exception e) {
                        if ( !running ) {
                                throw new TransportException("Service stopping 
- rejecting request");
@@ -182,7 +182,7 @@ public class DefaultServiceProtocolHandl
        }
 
        private IMetaTaskTransaction callGet(IMetaTaskTransaction transaction) 
throws Exception {
-               transaction.setType(Type.Get); 
+               transaction.setType(Type.Get);
                if ( logger.isLoggable(Level.FINE)) {
                        logger.log(Level.FINE, "ProtocolHandler calling GET");
                }
@@ -190,7 +190,7 @@ public class DefaultServiceProtocolHandl
        }
        /**
         * Block until service start() is called
-        * 
+        *
         * @throws ServiceInitializationException
         */
        private void awaitStart() throws ServiceInitializationException {
@@ -209,7 +209,7 @@ public class DefaultServiceProtocolHandl
                        while (running) {
 
                                // send GET Request
-                               transaction = 
+                               transaction =
                                                callGet(new 
MetaTaskTransaction());
                                // the code may have blocked in callGet for 
awhile, so check
                                // if service is still running. If this service 
is in quiescing
@@ -220,10 +220,10 @@ public class DefaultServiceProtocolHandl
                                }
                                if (transaction.getMetaTask() != null && 
transaction.getMetaTask().getUserSpaceTask() != null) {
                                        break;
-                               } 
+                               }
                                retryThread = Thread.currentThread();
-                               
-                               
System.out.println("Thread:"+Thread.currentThread().getId()+" ------------- No 
Task -------------- Retrying GET until success");
+
+                               
//System.out.println("Thread:"+Thread.currentThread().getId()+" ------------- 
No Task -------------- Retrying GET until success");
                                // the client has no tasks to give.
                                noTaskStrategy.handleNoTaskSupplied();
 
@@ -242,19 +242,19 @@ public class DefaultServiceProtocolHandl
                // we may fail in initialize() in which case the 
ServiceInitializationException
                // is thrown
                initialize();
-               
+
                // now wait for application to call start
                awaitStart();
-               
+
                // all threads intialized, enter running state
 
                IMetaTaskTransaction transaction = null;
-               
+
                if ( logger.isLoggable(Level.INFO)) {
                        logger.log(Level.INFO, ".............. Thread 
"+Thread.currentThread().getId() + " ready to process");
                }
 
-               
+
                while (running) {
 
                        try {
@@ -281,8 +281,8 @@ public class DefaultServiceProtocolHandl
                                logger.log(Level.INFO, ".............. Thread 
"+Thread.currentThread().getId() + " processing new task");
 
                                Object task = 
transaction.getMetaTask().getUserSpaceTask();
-                               
-                               // send ACK 
+
+                               // send ACK
                                transaction = callAck(transaction);
                                if (!running  && !quiescing ) {
                                        break;
@@ -291,22 +291,22 @@ public class DefaultServiceProtocolHandl
 
                                // assume success
                                Action action = Action.CONTINUE;
-                               // check if process error occurred.  
+                               // check if process error occurred.
                                String errorAsString = processResult.getError();
 
                                if (processResult.terminateProcess()) {
                                        action = Action.TERMINATE;
                                } else if ( Objects.isNull(errorAsString)){
-                                       // success 
+                                       // success
                                        
transaction.getMetaTask().setPerformanceMetrics(processResult.getResult());
-                               } 
+                               }
                                if ( Objects.nonNull(errorAsString ) ) {
                                        IMetaTask mc = 
transaction.getMetaTask();
                                        // the ducc.deploy.JpType is only 
present for jobs. If not specified
                                        // we return stringified exception to 
the client. The JD expects
                                        // Java Exception object for its error 
handling
                                        if ( 
Objects.isNull(System.getProperty("ducc.deploy.JpType")) ) {
-                                               
+
                                                
mc.setUserSpaceException(errorAsString);
                                        } else {
                                                logger.log(Level.INFO, "Sending 
Exception to JD:\n" +
@@ -316,7 +316,7 @@ public class DefaultServiceProtocolHandl
                                        }
 
                                }
-                               
+
                                // send END Request
                                callEnd(transaction);
                                if (running && Action.TERMINATE.equals(action)) 
{
@@ -333,8 +333,8 @@ public class DefaultServiceProtocolHandl
                                        }).start();
                                        running = false;
                                }
-                                       
-                               
+
+
 
                        } catch( IllegalStateException e) {
                                break;
@@ -342,9 +342,9 @@ public class DefaultServiceProtocolHandl
                                break;
                        }
                        catch (Exception e) {
-                               
+
                                logger.log(Level.WARNING,"",e);
-                       }               
+                       }
                }
                stopLatch.countDown();
                System.out.println(Utils.getTimestamp()+">>>>>>> 
"+Utils.getShortClassname(this.getClass())+".call() >>>>>>>>>> Thread 
["+Thread.currentThread().getId()+"] "+ " ProtocolHandler stopped requesting 
new tasks - Stopping processor");
@@ -365,13 +365,13 @@ public class DefaultServiceProtocolHandl
                } catch (Exception e) {
                        try {
                                logger.log(Level.WARNING, "Unable to Serialize 
"+t.getClass().getName()+" - Will Stringify It Instead");
-                               
+
                        } catch( Exception ee) {}
                        throw e;
                } finally {
                        oos.close();
                }
-               
+
                return baos.toByteArray();
        }
        private void delegateStop() {
@@ -404,7 +404,7 @@ public class DefaultServiceProtocolHandl
                // change state of transport to not running but keep connection 
open
                // so that other threads can quiesce (send results)
                transport.stop(true);
-               
+
                quiescing = true;
                running = false;
                try {
@@ -442,8 +442,8 @@ public class DefaultServiceProtocolHandl
        public void setTransport(IServiceTransport transport) {
                this.transport = transport;
        }
-       
-       
+
+
         public static class Builder {
                        private IServiceTransport transport;
                        private IServiceProcessor processor;
@@ -460,15 +460,15 @@ public class DefaultServiceProtocolHandl
                        public Builder withProcessor(IServiceProcessor 
processor) {
                                this.processor = processor;
                                return this;
-                       }                       
+                       }
                        public Builder withInitCompleteLatch(CountDownLatch 
initLatch) {
                                this.initLatch = initLatch;
                                return this;
-                       }                       
+                       }
                        public Builder withDoneLatch(CountDownLatch stopLatch) {
                                this.stopLatch = stopLatch;
                                return this;
-                       }                       
+                       }
                        public Builder 
withNoTaskStrategy(INoTaskAvailableStrategy strategy) {
                                this.strategy = strategy;
                                return this;


Reply via email to