1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 23:55:26 +02:00

[209825] fix: Update SystemTarHandler so that archive operations could be cancelable.

This commit is contained in:
Xuan Chen 2007-11-30 16:45:52 +00:00
parent 1ad0910bd2
commit 78845993fb
3 changed files with 642 additions and 410 deletions

View file

@ -8,6 +8,7 @@
* {Name} (company) - description of contribution.
*
* Xuan Chen (IBM) - initial API and implementation
* Xuan Chen (IBM) - [209825] add some info of printing the lock status
********************************************************************************/
package org.eclipse.rse.services.clientserver;
@ -206,5 +207,22 @@ public class SystemReentrantMutex {
}
}
}
/*
* Method used to debug this mutex
* uncomment it when needed
*
private void printLockMessage(int status, Thread myself)
{
if (status == LOCK_STATUS_AQUIRED)
{
System.out.println("Lock is AQUIRED by thread " + myself.getId());
}
else if (status == LOCK_STATUS_BORROWED)
{
System.out.println("Lock is BORROWED by thread " + myself.getId());
}
}
*/
}

View file

@ -1838,7 +1838,9 @@ public class SystemZipHandler implements ISystemArchiveHandler
{
name = ArchiveHandlerManager.cleanUpVirtualPath(name);
name = name + "/"; //$NON-NLS-1$
return createVirtualObject(name, true, archiveOperationMonitor);
boolean returnCode = createVirtualObject(name, true, archiveOperationMonitor);
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
return returnCode;
}
/* (non-Javadoc)
@ -1847,7 +1849,9 @@ public class SystemZipHandler implements ISystemArchiveHandler
public boolean createFile(String name, ISystemOperationMonitor archiveOperationMonitor)
{
name = ArchiveHandlerManager.cleanUpVirtualPath(name);
return createVirtualObject(name, true, archiveOperationMonitor);
boolean returnCode = createVirtualObject(name, true, archiveOperationMonitor);
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
return returnCode;
}
/**
@ -1862,13 +1866,11 @@ public class SystemZipHandler implements ISystemArchiveHandler
{
if (!_exists)
{
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
return false;
}
if (exists(name, archiveOperationMonitor))
{
// The object already exists.
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
return false;
}
@ -1914,7 +1916,6 @@ public class SystemZipHandler implements ISystemArchiveHandler
replaceOldZip(outputTempFile);
if (closeZipFile) closeZipFile();
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
return true;
}
}
@ -1924,14 +1925,12 @@ public class SystemZipHandler implements ISystemArchiveHandler
System.out.println("Could not add a file."); //$NON-NLS-1$
System.out.println(e.getMessage());
if (closeZipFile) closeZipFile();
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
return false;
}
finally
{
releaseMutex(mutexLockStatus);
}
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
return false;
}