Skip to content

Commit

Permalink
dcap: Drop dead code
Browse files Browse the repository at this point in the history
Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7417/
  • Loading branch information
gbehrmann committed Oct 29, 2014
1 parent c7b0b60 commit e3ca25b
Showing 1 changed file with 60 additions and 72 deletions.
132 changes: 60 additions & 72 deletions modules/dcache-dcap/src/main/java/diskCacheV111/doors/DCapDoor.java
Expand Up @@ -46,7 +46,7 @@ public class DCapDoor
private PrintWriter _out;
private String _host;
private Subject _subject;
private Thread _workerThread , _anyThread ;
private Thread _workerThread;
private int _commandCounter;
private String _lastCommand = "<init>";
private Reader _reader;
Expand Down Expand Up @@ -96,8 +96,6 @@ public DCapDoor( String name , StreamEngine engine , Args args )
_workerThread = _nucleus.newThread( this , "worker" );
_workerThread.start();

// _anyThread = _nucleus.newThread( this , "anyThread" ) ;
// _anyThread.start() ;
start() ;
}

Expand All @@ -121,81 +119,71 @@ public void keepAlive(){
// will be interrupted.
//
@Override
public void run(){
if( Thread.currentThread() == _workerThread ){
//
// check for lock
//

Transfer.initSession();

_log.info( "Checking DCap lock" ) ;
try{
while( true ){
String lock = (String)_nucleus.getDomainContext().get("dcapLock") ;
if( lock == null ) {
break;
}
TimeUnit.SECONDS.sleep(5);
}

}catch(InterruptedException iee){
_log.info("Interrupted the 'dcap' lock" ) ;
_log.info( "ComThread : Client communication Thread finished" );
_stateChanged( __connectionLostEvent ) ;
return ;
}
_log.info("DCapLock released");
_dcapLock = false ;

try {
while (true) {
if ((_lastCommand = _in.readLine()) == null) {
break;
}

if(_lastCommand.length() == 0) {
continue;
}

_commandCounter++;
_log.info("Executing command: " + _lastCommand);
VspArgs args;
try {
args = new VspArgs(_lastCommand);
}catch(IllegalArgumentException e) {
println("protocol violation: " + e.getMessage());
_log.debug("protocol violation [{}] from {}", e.getMessage(), _engine.getInetAddress());
break;
}

if (execute(args) > 0) {
println("0 0 server byebye");
_log.info("ComThread : protocol ended");
break;
}
public void run()
{
//
// check for lock
//

Transfer.initSession();

_log.info("Checking DCap lock");
try {
while (true) {
String lock = (String) _nucleus.getDomainContext().get("dcapLock");
if (lock == null) {
break;
}
} catch (IOException e) {
_log.warn("Got IO exception " +e.toString() + " from: " + _engine.getInetAddress());
} catch (Exception e) {
_log.warn("ComThread : got " + e, e);
}finally{
_out.close();
TimeUnit.SECONDS.sleep(5);
}
} catch (InterruptedException iee) {
_log.info("Interrupted the 'dcap' lock");
_log.info("ComThread : Client communication Thread finished");
_stateChanged(__connectionLostEvent);
return;
}
_log.info("DCapLock released");
_dcapLock = false;

try {
while (true) {
if ((_lastCommand = _in.readLine()) == null) {
break;
}

_log.info( "ComThread : Client communication Thread finished" );
_stateChanged( __connectionLostEvent ) ;
}else if( Thread.currentThread() == _anyThread ){
try{
_log.info( "AnyThread : started" ) ;
Thread.sleep( 60 * 60 * 1000 ) ;
_log.info( "AnyThread : woke up" ) ;
}catch(InterruptedException ie ){
_log.info( "AnyThread : was interrupted" ) ;
if (_lastCommand.length() == 0) {
continue;
}

_commandCounter++;
_log.info("Executing command: " + _lastCommand);
VspArgs args;
try {
args = new VspArgs(_lastCommand);
} catch (IllegalArgumentException e) {
println("protocol violation: " + e.getMessage());
_log.debug("protocol violation [{}] from {}", e.getMessage(), _engine.getInetAddress());
break;
}

if (execute(args) > 0) {
println("0 0 server byebye");
_log.info("ComThread : protocol ended");
break;
}
}
_log.info( "AnyThread : finished" ) ;
} catch (IOException e) {
_log.warn("Got IO exception " + e + " from: " + _engine.getInetAddress());
} catch (Exception e) {
_log.warn("ComThread : got " + e, e);
} finally {
_out.close();
}

_log.info("ComThread : Client communication Thread finished");
_stateChanged(__connectionLostEvent);
}

private static final int __connectionLostEvent = 1 ;
private static final int __weWereKilledEvent = 2 ;
private static final int __abortCacheFinishedEvent = 3 ;
Expand Down

0 comments on commit e3ca25b

Please sign in to comment.