[Swift-commit] cog r3561
swift at ci.uchicago.edu
swift at ci.uchicago.edu
Wed Jan 23 22:30:04 CST 2013
------------------------------------------------------------------------
r3561 | hategan | 2013-01-23 22:25:19 -0600 (Wed, 23 Jan 2013) | 1 line
synchronizing on the channel when updating the last used time prevents the channel configuration from completing, so use another lock
------------------------------------------------------------------------
Index: modules/karajan/src/org/globus/cog/karajan/workflow/service/channels/AbstractKarajanChannel.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/workflow/service/channels/AbstractKarajanChannel.java (revision 3560)
+++ modules/karajan/src/org/globus/cog/karajan/workflow/service/channels/AbstractKarajanChannel.java (working copy)
@@ -48,6 +48,9 @@
private Service callbackService;
private final boolean client;
private long lastTime;
+ private final Object lastTimeLock = new Object();
+
+ private TimerTask timeoutCheckTask;
protected AbstractKarajanChannel(RequestManager requestManager, ChannelContext channelContext,
boolean client) {
@@ -114,7 +117,7 @@
}
public void configureTimeoutChecks() {
- Timer.every(TIMEOUT_CHECK_INTERVAL * 1000, new TimerTask() {
+ Timer.every(TIMEOUT_CHECK_INTERVAL * 1000, timeoutCheckTask = new TimerTask() {
public void run() {
checkTimeouts();
}}
@@ -129,15 +132,20 @@
TimeoutException e = new TimeoutException(this, "Channel timed out", lastTime);
context.notifyRegisteredCommandsAndHandlers(e);
handleChannelException(e);
+ timeoutCheckTask.cancel();
}
}
- protected synchronized void updateLastTime() {
- lastTime = System.currentTimeMillis();
+ protected void updateLastTime() {
+ synchronized(lastTimeLock) {
+ lastTime = System.currentTimeMillis();
+ }
}
- protected synchronized long getLastTime() {
- return lastTime;
+ protected long getLastTime() {
+ synchronized(lastTimeLock) {
+ return lastTime;
+ }
}
protected boolean clientControlsHeartbeats() {
More information about the Swift-commit
mailing list