From f70123a661ffab2ec2b10f4916599f4861fdc705 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Tue, 12 Jan 2010 21:18:19 +0000 Subject: [PATCH] [299422] [dstore] OutputHandler.readLines() not compatible with servers that return max 1024bytes available to be read --- .../universal/miners/command/CommandMinerThread.java | 10 ++++++++-- .../dstore/universal/miners/command/OutputHandler.java | 7 ++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java index 3c49a689c87..8c3e1e2f418 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2009 IBM Corporation and others. + * Copyright (c) 2003, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,6 +24,7 @@ * David McKnight (IBM) - [286671] Dstore shell service interprets < and > sequences * David McKnight (IBM) [290743] [dstore][shells] allow bash shells and custom shell invocation * David McKnight (IBM) [287305] [dstore] Need to set proper uid for commands when using SecuredThread and single server for multiple clients[ + * Peter Wang (IBM) [299422] [dstore] OutputHandler.readLines() not compatible with servers that return max 1024bytes available to be read *******************************************************************************/ package org.eclipse.rse.internal.dstore.universal.miners.command; @@ -681,7 +682,12 @@ public class CommandMinerThread extends MinerThread writer.write(input); writer.newLine(); - writer.flush(); + try{ + writer.flush(); + } + catch (Exception e){ + //TODO find actual cause of problem. This only fails on certain machines. + } if (!_isWindows && (input.startsWith("cd ") || input.equals("cd"))) //$NON-NLS-1$ //$NON-NLS-2$ { diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/OutputHandler.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/OutputHandler.java index 069d0ab0374..643f46c0d99 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/OutputHandler.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/OutputHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,6 +18,7 @@ * David McKnight (IBM) - [282919] [dstore] server shutdown results in exception in shell io reading * David McKnight (IBM) - [286671] Dstore shell service interprets < and > sequences * David McKnight (IBM) [287305] [dstore] Need to set proper uid for commands when using SecuredThread and single server for multiple clients[ + * Peter Wang (IBM) [299422] [dstore] OutputHandler.readLines() not compatible with servers that return max 1024bytes available to be read *******************************************************************************/ package org.eclipse.rse.internal.dstore.universal.miners.command; @@ -166,7 +167,7 @@ public class OutputHandler extends Handler { // if there's none, wait a bit and return true to continue if (available <= 0) { - sleep(100); + sleep(1500); available = _reader.available(); } return available; @@ -272,7 +273,7 @@ public class OutputHandler extends Handler { int lastIndex = 0; - available = _reader.available(); + available = checkAvailable(); if (available > 0) { while (!_endOfStream && lastIndex < MAX_OFFSET)